Jump to content

Equip and unequipitem don't exist?


danshive

Recommended Posts

I want to make a spell that can force targets to equip items that are temporarily added to their inventory. "additem" and "removeitem" compile just fine, but "equipitem" and "unequipitem" result in "equiptiem is not a function or does not exist" errors.

 

Here is the script I'm trying to make work in the Magic Effect:

 

Scriptname AA_redress extends activemagiceffect  

import game

MiscObject Property Equipment Auto

EVENT onEffectStart(ACTOR akTarget, ACTOR akCaster)

objectReference target = akTarget	

target.additem(Equipment, 1) 
target.EquipItem(Equipment, TRUE)

endEVENT


EVENT onEffectFinish(ACTOR akTarget, ACTOR akCaster)

objectReference target = akTarget	

target.UnequipItem(Equipment)
target.removeitem(Equipment, 1)

endEVENT

Link to comment
Share on other sites

Yeah like an event:

Event OnEquipped(Actor Player)
          {Do Stuff}
endEvent

I dont think its going to help you much with what you are trying to do tho, I cant help you there, been looking into that kind of functions myself and came up empty, let me know if you find anything.

Link to comment
Share on other sites

I got it to work! I don't think this will work for weapons, as I believe you have to specify which hand equips what, but it seems to work armor.

 

Scriptname AA_redress extends activemagiceffect  

Armor Property Equipment Auto

EVENT onEffectStart(ACTOR akTarget, ACTOR akCaster)   

       akTarget.additem(Equipment, 1) 
       akTarget.EquipItem(Equipment, TRUE)

endEVENT

EVENT onEffectFinish(ACTOR akTarget, ACTOR akCaster) 

       akTarget.UnequipItem(Equipment, TRUE)
       akTarget.additem(Equipment, 1) 
       akTarget.removeitem(Equipment, 2)

endEVENT

 

The reason the equipment gets added a second time is to get the actor to reevaluate what they're wearing, because apparently ADDING items will make them do that, but NOT removing them. Were I using this to get an actor superior equipment, I would have two equipment variables with something really sucky as the second thing to add and immediately remove just to get them to not walk around in their undies afterward.

Edited by danshive
Link to comment
Share on other sites

  • Recently Browsing   0 members

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