danshive Posted February 10, 2012 Share Posted February 10, 2012 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 More sharing options...
porroone Posted February 10, 2012 Share Posted February 10, 2012 Equip and Unequipobjects are events not functions, you cant call them just like that. Link to comment Share on other sites More sharing options...
danshive Posted February 10, 2012 Author Share Posted February 10, 2012 Do you know how I would call them? Link to comment Share on other sites More sharing options...
porroone Posted February 11, 2012 Share Posted February 11, 2012 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 More sharing options...
danshive Posted February 11, 2012 Author Share Posted February 11, 2012 (edited) 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 February 11, 2012 by danshive Link to comment Share on other sites More sharing options...
porroone Posted February 11, 2012 Share Posted February 11, 2012 Yea I dont know what I was thinking when I read those functions, sorry mate, for some reason I was confusing them with the OnEquip and OnUnequip events :/ glad to see you got it working ^^ Link to comment Share on other sites More sharing options...
Recommended Posts