Code:
Name: 'While Damage Example - Grenade O1301', VNum: [ 23], RNum: [ 23]
Trigger Intended Assignment: Objects
Trigger Type: Drop , Numeric Arg: 100, Arg list: None
Commands:
* By Rumble of The Builder Academy builderacademy.net 9091
* A small script to make a grenade go off 3 seconds after it is dropped.
* Set the rooms ID to a variable.
set room_var %actor.room%
wait 3 s
* Send a message when the bomb goes off.
%echo% The Grenade blasts into smithereens, striking everyone here.
* Target the first char.
set target_char %room_var.people%
* Now loop through everyone in the room and hurt them.
while %target_char%
* Set the next target before this one perhaps dies.
set tmp_target %target_char.next_in_room%
* This is where the good/bad things are supposed to happen.
%send% %target_char% The explosion hurts you.
* Damage them... 30 hitpoints. To heal use -#.
%damage% %target_char% 30
* Set the next target.
set target_char %tmp_target%
* Loop back.
done
* After we go through everyone get rid of the grenade.
%purge% %self%
for TBA.