Jump to content
Sign in to follow this  
orbit

How to use "Ring of Air Control (Ring28)" in a script?

Recommended Posts

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?

Share this post


Link to post

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.

Share this post


Link to post

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?

Share this post


Link to post

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.

Share this post


Link to post
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?

Edited by orbit

Share this post


Link to post
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).

Edited by Mike1072

Share this post


Link to post

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*)

Edited by Avenger

Share this post


Link to post

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

Edited by HerrSvensson

Share this post


Link to post
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...