orbit Posted October 3, 2012 Share Posted October 3, 2012 I know how to use an item with useitem(), however it doesnt work with the "Ring Of Air Control" For example: IF Global("BackStab","LOCALS",1) See([EVILCUTOFF]) HasItemEquiped("Ring28",Myself) Global("UsedRing28","LOCALS",0) !StateCheck(Myself,STATE_INVISIBLE) CheckStatGT(Myself,1,BACKSTABDAMAGEMULTIPLIER) THEN RESPONSE #100 UseItem("Ring28",Myself) SetGlobal("UsedRing28","LOCALS",1) END This doesn't work, what am I doing wrong? Link to comment
Avenger Posted November 8, 2012 Share Posted November 8, 2012 I would move SetGobal in front of UseItem. Link to comment
Mike1072 Posted November 9, 2012 Share Posted November 9, 2012 The ability not firing as expected might have something to do with the item having multiple abilities. Check here for a discussion and possible solution. I'm not sure how you'd determine in which ring slot the item was equipped. Link to comment
orbit Posted November 19, 2012 Author Share Posted November 19, 2012 Thanks - according to that post it should look like this: IF Global("BackStab","LOCALS",1) See([EVILCUTOFF]) HasItemEquiped("Ring28",Myself) Global("UsedRing28","LOCALS",0) !StateCheck(Myself,STATE_INVISIBLE) CheckStatGT(Myself,1,BACKSTABDAMAGEMULTIPLIER) THEN RESPONSE #100 UseItemSlot(Myself,RING_LEFT) // Or "RING_RIGHT" or the itemslot number SetGlobal("UsedRing28","LOCALS",1) END However, this only activates the first ability on the ring, which in this case is not invisibility. I guess there is no solution for this. Another thing I'd like to know: UseItem() works with equipment, but not with weapons, does anyone know why? How can I activate a spell on a weapon through scripting? Link to comment
Mike1072 Posted November 19, 2012 Share Posted November 19, 2012 Instead of UseItemSlot(Myself,RING_LEFT), try UseItemSlot(Myself,RING_LEFT,1). Make sure your action.ids file contains this line: 34 UseItemSlotAbility(O:Target*, I:Slot*, I:AbilityNum*). Disclaimer: I haven't tested this personally. UseItem() works with equipment, but not with weapons, does anyone know why? How can I activate a spell on a weapon through scripting? Probably the same reason as for this ring - the first ability on these items is their melee or ranged attack, not their activated ability. Link to comment
orbit Posted November 20, 2012 Author Share Posted November 20, 2012 I would move SetGobal in front of UseItem. Is this important? What's the difference? Instead of UseItemSlot(Myself,RING_LEFT), try UseItemSlot(Myself,RING_LEFT,1). Make sure your action.ids file contains this line: 34 UseItemSlotAbility(O:Target*, I:Slot*, I:AbilityNum*). Disclaimer: I haven't tested this personally. Does that mean I'd have to edit the Action.ids file? I'd like my script to work without any additional editing. Huh, why was this not in Action.ids in the first place? I can't imagine that I could just add custom actions to this file? Link to comment
Mike1072 Posted November 20, 2012 Share Posted November 20, 2012 Instead of UseItemSlot(Myself,RING_LEFT), try UseItemSlot(Myself,RING_LEFT,1). Make sure your action.ids file contains this line: 34 UseItemSlotAbility(O:Target*, I:Slot*, I:AbilityNum*). Disclaimer: I haven't tested this personally. Does that mean I'd have to edit the Action.ids file? Yes. I'd like my script to work without any additional editing. That doesn't seem possible. Huh, why was this not in Action.ids in the first place? I can't imagine that I could just add custom actions to this file? This IDS file is there to make life simpler for scripting. It doesn't define functionality; it acts as a reference when translating human-readable scripts into BCS and DLG files, in which most everything is referenced by number. Adding that line to action.ids allows you to compile scripts that use the action, translating it to the internally-known "34". Whether or not "34" behaves as you'd expect when given these 3 parameters is anyone's guess (though Razfallow seemed to have tested this one). Link to comment
Avenger Posted November 27, 2012 Share Posted November 27, 2012 Yes, the used ability is always the second int parameter. If an item is not designated by slot number, leave the slot number at 0. Actions: 34 UseItemSlotAbility(O:Target*, I:Slot*, I:AbilityNum*) 34 UseItemRESSlotAbility(S:ResRef*, O:Target*, I:Dummy*, I:AbilityNum*) Link to comment
HerrSvensson Posted January 22, 2013 Share Posted January 22, 2013 SetGlobal interrupts actions, even hiding, detecting traps, singing etc. That's why it's always best to start with it in my opinion. It might just interrupt your next actions in queue. If all else fails, you could try to force the spell, and maybe add a delay/wait: IF Global("BackStab","LOCALS",1) See([EVILCUTOFF]) HasItemEquiped("Ring28",Myself) Global("UsedRing28","LOCALS",0) !StateCheck(Myself,STATE_INVISIBLE) CheckStatGT(Myself,1,BACKSTABDAMAGEMULTIPLIER) THEN RESPONSE #100 //UseItem("Ring28",Myself) SetGlobal("UsedRing28","LOCALS",1) ForceSpell(Myself,WIZARD_IMPROVED_INVISIBILITY) END Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.