Welcome to the Builder Academy

Question Trigger of the Day - Double Barrelled Shotgun

More
01 Apr 2014 16:49 #4791 by Rumble
This is a very simple shotgun. The player uses it randomly while fighting with it wielded and it only has 2 rounds.
Code:
Name: 'Rumble's Shotgun', VNum: [ 45], RNum: [ 45] Trigger Intended Assignment: Objects Trigger Type: Random , Numeric Arg: 100, Arg list: None Commands: * By Rumble of The Builder Academy builderacademy.net 9091 * If the object is being wielded. if %self.worn_by% * This is a random trigger so actor has to be defined. eval actor %self.worn_by% * If the person wielding the object is fighting. if %actor.fighting% * Count the shots. eval shotgun_rounds %shotgun_rounds% + 1 * Remember the count for the next time this trig fires. global shotgun_rounds * This double barrel shotgun, only has 2 rounds. if %shotgun_rounds% > 2 * Detaching trig since gun is out of ammo. detach 1361 %self.id% halt end * We also have to define the victim. eval victim %actor.fighting% * Send the messages and do the damage. %echoaround% %actor.name% %actor.name% points %self.shortdesc% at %victim.name% and pulls the trigger. %send% %actor% You point %self.shortdesc% at %victim.name% and pull the trigger. %damage% %victim% 10 end 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
01 Apr 2014 22:13 #4792 by Parnassus
Parna's watch list:
Define the actor.
Count the shots.
Global the shots.
Detach the trigger.
Define the victim.
Send messages.
Apply damage (This, and other affects, can also be applied with nop).

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

Time to create page: 0.172 seconds