Self Destruct on Cue!

Got any custom JavaScript additions/tweaks you think other people would like to see? Post 'em here!
Post Reply
Mindless Automaton
UOX3 Apprentice
Posts: 189
Joined: Wed May 10, 2006 3:48 am
Has thanked: 0
Been thanked: 1 time
Contact:

Self Destruct on Cue!

Post by Mindless Automaton »

A combo of the speech_001.js and stranf's firetrap.js for some good clean fun!

Code: Select all

function onSpeech( myString, myPlayer, myNPC )
{
	if( !myNPC.InRange( myPlayer, 2 ) )
		return;
	var Speech_Array = myString.split(" ");
	var i = 0, currObj = 0;
	for( i = 1; i <= Speech_Array.length; i++ ) 
	{
		if( Speech_Array[currObj].match( /\bboom\b/i ) )	
		{			myNPC.TurnToward( myPlayer );
					var damage = RandomNumber(20,10);
					myNPC.MagicEffect( 43 );
					myNPC.SoundEffect(0x0207, true);
					myNPC.health =myNPC.health - damage;
			return;		}
		currObj++;
	}
}// [EOF]
You may need to adjust the damage if you want it to kill some bigger critters. I used it on small furries. :)

Enjoy!
Last edited by Mindless Automaton on Tue Jul 22, 2008 1:34 pm, edited 1 time in total.
Mindless Automaton
Linux - UOX3 - 0.99.5 dev branch
Win10Pro 19042.572 - UOX3 0.99.3a; Razor 1.0.14; Client 7.0.87.11 or 4.0.11c (Patch 0)
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

lol, nice!

Grimson/Xuri/Maarc - I'm too lazy to look, didn't we expose some form of JS Method that handled dealing damage (rather than health = health - damage).
Maarc
Developer
Posts: 576
Joined: Sat Mar 27, 2004 6:22 am
Location: Fleet, UK
Has thanked: 0
Been thanked: 0
Contact:

Post by Maarc »

Yup we did. Damage(). It was for damage tracking stuff, so (if desired, not done in code), you could apportion out karma/fame stuff based on who did what damage. Takes 1 (amount), 2 (amount and attacker) or 3 (amount, attacker and doRepsys) parameters.
Post Reply