SphereCommunity

Full Version: Strange issue with NPC equipping item
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So, I have an NPC ive made and it has a trigger under it's chardef that is supposed to make it decide what item to equip during what circumstance
Here's the chunk of code that makes it decide what to do

Code:
on=@NPCActFight
if <argn1> <=2
  findid.i_axe.equip
  elseif <argn1> > 2
  findid.i_pumpkin_launcher.equip
endif

so what happens is that it actually equips the item on the player he is attacking. first it equips the bow on the player because he's typically more then 2 tiles away, then since he doesnt have anything in his hands he charges at the player, then when he's within 2 tiles it equips the axe onto the player.

am i using findid wrong? have I been away too long and lost my goddamn mind?

here's the whole thing chardef included

Code:
[CHARDEF c_headless_horseman]
ID=c_man
NAME=Headless Horseman
SOUND=snd_HUMAN_M_DIE_01
DAM=10,20
ARMOR=30
CAN=MT_WALK|MT_RUN|MT_EQUIP|MT_USEHANDS
DESIRES=i_gold,e_notoriety
// AVERSIONS=t_TRAP,t_eerie_stuff
// ALIGNMENT=EVIL

tspeech=spk_human_prime
tspeech=jobMageEvil
tspeech=spk_needs
tspeech=spk_rehello
tspeech=spk_human_default
//TEVENTS=monster_tag        //if you use these events, uncomment them
//TEVENTS=e_fame_karma_gain

ON=@Create
color=055555
str={450 500}
dex={300 350}
int={200 250}
PARRYING={85.0 98.0}
SWORDSMANSHIP={90.0 95.0}
ARCHERY={90.0 95.0}
WRESTLING={67.0 90.0}
MAGICRESISTANCE={90.0 98.0}
TACTICS={90.0 98.0}
POISONING={90.0 100.0}
NPC=brain_monster
FAME=8000
KARMA=-9999

ON=@NPCRestock
item=i_BLACKROCK_RINGMAIL_GLOVES
item=i_BLACKROCK_RINGMAIL_SLEEVES
item=i_BLACKROCK_RINGMAIL_TUNIC
item=i_BLACKROCK_RINGMAIL_LEGGINGS
item=i_CAPE
color=0053f
item=i_SASH
color=0053f
item=i_boots_calf
color=0053f
itemnewbie=i_axe
itemnewbie=i_pumpkin_launcher
item=i_potion_healgreat
item=i_potion_healgreat
item=i_potion_healgreat
item=i_potion_healgreat
item=i_potion_healgreat
item=random_jewel
item=random_jewel
item=random_jewel
item=random_jewel
item=i_gold,{400 1000}
item=i_mt_horse_tan
color=0455

on=@NPCActFight
if <argn1> <=2
  findid.i_axe.equip
  elseif <argn1> > 2
  findid.i_pumpkin_launcher.equip
endif
dorand 3
  sound 1001
  sound 1003
  sound 1004
enddo

Confused
You have to do:
Code:
on=@NPCActFight
if <argn1> <=2
  equip <findid.i_axe>
elseif <argn1> > 2
  equip <findid.i_pumpkin_launcher>
endif

Using findid.i_axe.equip will cause the SRC to try to equip the weapon, and in @NpcActfight SRC is the player being attacked.
Thank you my good man, and that you are, a very very good man
Reference URL's