New Trigger Variable - Wait State

  • WhiskyTest
  • WhiskyTest's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
7 years 4 weeks ago #5552 by WhiskyTest
New Trigger Variable - Wait State was created by WhiskyTest
Ever wanted to 'stun' or force a character to stay put?
I wanted to make a falling pit trap that a player takes damage from after entering the room.
The messages come up one second after entering the room - by then the player may well have simply left!
So... I added 'wait' as below, so I could prevent said player from doing anything until after the script resolved.

usage:
nop %actor.wait(1)% // adds a 1 second wait to the character

in dg_variables.c, approximately after line 1125 where it has just handled Wisdom:

           snprintf(str, slen, "%d", GET_WIS(c));
          }
          
+          else if (!str_cmp(field, "wait")) 
+          {
+            if (subfield && *subfield)
+            {
+              int addition = atoi(subfield);
+              WAIT_STATE(c, addition * ( PULSE_VIOLENCE / 2) ); // by default violence is 2 seconds
+            }
+            snprintf(str, slen, "%d", GET_WAIT_STATE(c));
+          }
          
          break;
      } /* switch *field */
The following user(s) said Thank You: thomas, Valkin

Please Log in or Create an account to join the conversation.

More
6 years 11 months ago #5578 by krell
Replied by krell on topic New Trigger Variable - Wait State
That's pretty cool and I think it makes sense mechanics-wise.

Please Log in or Create an account to join the conversation.

More
6 years 11 months ago #5580 by Rumble
Replied by Rumble on topic New Trigger Variable - Wait State
Well done. This has come up numerous times in trigger discussions but you are the first to post a solution. I will add it.

Rumble
The Builder Academy
tbamud.com 9091
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

  • WhiskyTest
  • WhiskyTest's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
6 years 11 months ago #5585 by WhiskyTest
Replied by WhiskyTest on topic New Trigger Variable - Wait State
Nice, glad it was helpful! :)

It would be worth changing ( PULSE_VIOLENCE / 2) to ( RL_SEC )
I couldn't think of the definition name at the time

Please Log in or Create an account to join the conversation.

Time to create page: 0.150 seconds