New Trigger Variable - Wait State

  • WhiskyTest
  • WhiskyTest's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
More
2 years 4 months ago #5552 by WhiskyTest
WhiskyTest created the topic: New Trigger Variable - Wait State
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
2 years 3 months ago #5578 by Krell
Krell replied the 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
2 years 3 months ago #5580 by Rumble
Rumble replied the 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

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

  • WhiskyTest
  • WhiskyTest's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
More
2 years 3 months ago #5585 by WhiskyTest
WhiskyTest replied the 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.931 seconds