Thread: weapon list..
View Single Post
  #5  
Old 11-14-2001, 12:28 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
Quote:
Originally posted by TDK_Admin1
Dude that is awesome! Could you help me learn that type of stuff like:
for (this.i=0;this.i<weaponscount;this.i++) {
please?
that just browses thru all the persons weapons..
since even hidden weapons that start with - are considered weapons,when you make your own weapon list you want to keep those away.

If you do selectedweapon+=1; (to go to the next weapon) it will work fine. but if you subtract one it wont. why? because of the hidden npc's.. If a hidden npc is before the one it will just add 1 to it until it finds a non hidden one..
So i use
NPC Code:

//find index of before non hidden weapon
for (this.i=selectedweapon-1;this.i>-1;this.i--) {
if (!startswith(-,#w(this.i))) { selectedweapon=this.i; return;}
}


which will go from your current weapon down to 0 (the first weapon) and find the closest one to it which is not a hidden weapon.
For example lets say you have
bow, bomb, -system, fireblast
When It is on fireblast and I want to go back, I dont want the -system to become the weapon, because if I set it to -system, Graal will say "thats a hidden weapon" and will go back to the fireblast. Now using the loop It will go from -system to bow looking for the first one that is not hidden, which in the case would be bomb^_^
(confusing i hope it helps hehe)
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote