Page 4 of 4

Posted: Sat Jan 06, 2007 12:59 am
by SniperWolf
Well I need them all to be called differently when the target is hit. Each one will print different text representing the score for the part hit.

What I would like to do is once the target is hit all the triggers for that target are disabled. That way some one else cant shot the taget & mess up the score keeping.

Etc:

$rifletarget_triggerb is a head shot & will print "Head Shot! I Scored 10 Points" when hit. At that point I want all 11 triggers to become nottriggerable.

I know I can do it by nottriggerable - ing each one separate but was trying to get it so I didn't have to add 22 lines ( 11 nottriggerable lines & 11 triggerable lines )to each script for 3 target.

Is it possible or am I stuck adding all those lines??

Posted: Sat Jan 06, 2007 10:25 am
by Rookie One.pl
You could replace the letters in the targetnames with numbers 1-22 and do this:

Code: Select all

for (local.i = 1; local.i <= 22; local.i++)
   $("rifletarget_trigger" + local.i) nottriggerable
If this was C, you could also leave everything as is and use this:

Code: Select all

for (local.i = 'a'; local.i <= 'z'; local.i++)
   $("rifletarget_trigger" + local.i) nottriggerable
Try it, not sure if it'll work, though (don't really know how MoHAA handles chars).

Third option looks like this:

Code: Select all

local.alphabet = "a"::"b"::"c"::"d"::"e"::"f"::"g"::"h"::"i"::"j"::"k"::"l"::"m"::"n"::"o"::"p"::"q"::"r"::"s"::"t"::"u"::"v"::"w"::"x"::"y"::"z"
for (local.i = 1; local.i <= 22; local.i++)
   $("rifletarget_trigger" + local.alphabet[local.i]) nottriggerable
100% sure to work, although not as effective performance-wise (I'm an efficiency freak :P). ;) I recommend you try the 2nd method first and then use this one if that doesn't work. :)

Posted: Sun Jan 07, 2007 1:39 pm
by SniperWolf
Rookie

This code works perfectly. Thanks!

Code: Select all

for (local.i = 1; local.i <= 22; local.i++)
   $("rifletarget_trigger" + local.i) nottriggerable