Jump to content

Script command to get the animation type of a weapon?


ObieDwyer

Recommended Posts

I'm working on a script that needs to know what kind of weapon a player is holding. I've tried using a formlist filled with keywords to determine if an equipped weapon is one-handed or not, but I think a simpler and more compatible method would be to determine whether the weapon uses 1 handed or 2 handed animations.

 

I recall there being a condition that asks what kind of animations a weapon is using (something along the lines of GetWeaponAnimType) but I was wondering if there is a command (or at least some work around) that can be used in a script?

Link to comment
Share on other sites

I couldn't get either of those to work for some reason. It keeps saying that "(GetWeaponType/GetEquippedItemType) is not a function or does not exist"

 

 

Script Fragment:

Event OnObjectEquipped(form akBaseObject , ObjectReference player)

if akBaseObject.GetWeaponType() == 1

Debug.MessageBox("1h weapon equip")

else

Debug.MessageBox("Untrue weapon equip")

endif
endevent

I just get these two error messages:

 

(10,16): GetWeaponType is not a function or does not exist

(10,32): cannot compare a none to a int (cast missing or types unrelated)
I still get those same messages if I use:
if (player.GetEquippedItemType(1) == 1)
Does it matter that the script is extending ReferenceAlias?
Edited by Cdr248
Link to comment
Share on other sites

/facepalm

 

the way you are defining player it is a OBJECTreference

 

The command getequippeditemtype can only be ran on a ACTOR

 

 

------------- For instance, this compiles, dont know if it works correctly but it sure as hell compiles :P---

 

Event OnObjectEquipped(form akBaseObject , actor player)
if (player.GetEquippedItemType(0) == 7)
DO mah crap!
endif
endevent
The more assured way is to run the function as ----if (game.getplayer().getequippeditemtype(1) ==1)
Link to comment
Share on other sites

The problem is that you are not using either function correctly

 

 

Event OnObjectEquipped(form akBaseObject , ObjectReference player)

if player.GetEquippedItemType() == 1

Debug.MessageBox("1h weapon equip")

else

Debug.MessageBox("Untrue weapon equip")

endif
endevent

OR

Event OnObjectEquipped(form akBaseObject , ObjectReference player)

if (akBaseObject as Weapon).GetWeaponType() == 1

Debug.MessageBox("1h weapon equip")

else

Debug.MessageBox("Untrue weapon equip")

endif
endevent

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...