Welcome to the Builder Academy

Question Trigger of the Day - Damage Example

More
25 Mar 2014 11:09 #4778 by Rumble
Code:
Name: 'Damage Example', VNum: [ 16], RNum: [ 16] Trigger Intended Assignment: Rooms Trigger Type: Enter , Numeric Arg: 100, Arg list: None Commands: * By Rumble of The Builder Academy builderacademy.net 9091 * First put a wait in so the echo waits for the player to get into the room. wait 1 sec %echo% As %actor.name% enters the room a bolt of lightning smites %actor.himher%. * Take away 10 hitpoints %damage% %actor% 10 wait 5 sec %echo% The Gods feel sorry for %actor.name% and restore him to full health. * Restore 10 hitpoints (-# heals the actor). %damage% %actor% -10 * Another Example that damages actor to 1 hitpoint wait 2 sec %echo% hp: %actor.hitp% eval all_but_one_hitp %actor.hitp% - 1 %echo% all_but_one_hitp: %all_but_one_hitp% if %all_but_one_hitp% > 0 %damage% %actor% %all_but_one_hitp% %echo% hp: %actor.hitp% End
If this was helpful please vote or leave a review for TBA.

Rumble
The Builder Academy
tbamud.com 9091
rumble@tbamud.com

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

More
12 May 2014 01:09 #4894 by Parnassus
Parna's watch list:

%damage% %actor% -10 (to restore health)

Also: note the actor variable to determine hitpoints and the use of variables and eval to work out how many hitpoints need to be taken away to achieve the objective of 1hp. Pay attention to the wait comment.

However: Three things dealing with this echo that I would change if this were my trigger rather than an example:
%echo% The Gods feel sorry for %actor.name% and restore him to full health.

Warning: Spoiler!


Warning: Spoiler!


Warning: Spoiler!

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

Time to create page: 0.203 seconds