Scripting question: how do I make an item unusable in combat

Post » Fri May 27, 2011 5:43 am

By unusable I mean not equip-able in the inventory. I can use "player.IsInCombat" to check if the player is in combat but how do I actually make a particular item not equip-able?
User avatar
Setal Vara
 
Posts: 3390
Joined: Thu Nov 16, 2006 1:24 pm

Post » Fri May 27, 2011 10:51 am

Just give it a script with an OnEquip block that unequips it if the player's in combat.
User avatar
Sophie Morrell
 
Posts: 3364
Joined: Sat Aug 12, 2006 11:13 am

Post » Fri May 27, 2011 7:24 am

But that won't work with consumables, will it?
User avatar
Pants
 
Posts: 3440
Joined: Tue Jun 27, 2006 4:34 am

Post » Fri May 27, 2011 10:00 am

Be aware that the isincombat check will catch the player if he's in the "Caution" state with an enemy, not just fighting.

I don't believe that consumables can be equipped. If you click them, they.... get consumed.

You could try an onactivate block on your consumable. I've never looked at or tried such a thing. No idea if such a block will run, or if it will work as an intercept point.
User avatar
ijohnnny
 
Posts: 3412
Joined: Sun Oct 22, 2006 12:15 am

Post » Fri May 27, 2011 10:13 am

Nope, it won't. But the fact it's a consumable makes the whole thing trivial, really- just add an "Isincombat == 0" condition on whatever the effects are, and add another effect with "isincombat == 1" that shows a message saying "Can't do" and adds a copy of the ingestible back.
User avatar
JR Cash
 
Posts: 3441
Joined: Tue Oct 02, 2007 12:59 pm

Post » Fri May 27, 2011 5:33 am

Nope, it won't. But the fact it's a consumable makes the whole thing trivial, really- just add an "Isincombat == 0" condition on whatever the effects are, and add another effect with "isincombat == 1" that shows a message saying "Can't do" and adds a copy of the ingestible back.


This is exactly what I was thinking of doing, was just wondering if there was an simpler way. Thanks for the help though
User avatar
djimi
 
Posts: 3519
Joined: Mon Oct 23, 2006 6:44 am


Return to Fallout: New Vegas