Aller au contenu

Photo

One-armed man


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
Nebril2

Nebril2
  • Members
  • 59 messages

Hi all!

 

 

I want to make a companion npc wich you can modify inventory as you wish, one armed.

 

So, he  has his right hand invisible, and i want to make it impossible to equip items in that hand.

 

I tried creating an invisible object (fashion) wich goes in the right hand and flaging it cursed, but can be unequiped. 

 

There is a way to flag items as un-unequipables?

 

Or maybe another idea. 

 

Thank you.



#2
Proleric

Proleric
  • Members
  • 2 352 messages

I have a very similar problem with an NPC who has to keep a stick in her left hand, because she only has one good leg.

 

I'd be very interested if anyone has a better solution.

 

The frustration is that the OnEquip event doesn't fire for companions.

 

The kludge I came up with is to use the companion's OnHeartbeat to check that the stick is still in the left hand. In my case, it doesn't look too bad - if the PC forces an item into her left hand, or a two-handed item into her right hand, she almost immediately re-equips the stick. In your case, you might want a pseudoheartbeat running very frequently (once per second?) to make it seem that the right hand can't be equipped.

 

Another consideration is that my henchman AI equips the most effective weapon. I have the following system to prevent two-handed weapons being equipped:

 

Spoiler

 

This is not quite foolproof if the PC removes all other weapons from inventory, but the heartbeat kludge overcomes that.

 

My function which checks if an item is a weapon is as follows:

 

Spoiler

 

No doubt that check could made more general by examining baseitems.2da, as long as it isn't called too often.



#3
Nebril2

Nebril2
  • Members
  • 59 messages

Thanks for your reply.

 

I will use the pseudoheartbeat, but isnt this method heavy for the pc? i mean my module uses lots of onheartbeat functions, and im trying to reduce them, making a pseudoheartbeat consumes much than a simple heartbeat? or is not something i shouldnt worry about?

 

Been here i will also ask, if i add some scripts to the cached list, will it help? and will it change the way this heartbeat scripts work?

 

 

Thankkks   :D  :ph34r:



#4
Shadooow

Shadooow
  • Members
  • 4 470 messages

Pseudoheartbeat isnt much better than normal heartbeat, however you can use it in different intervals and you can turn it off and on as needed which can make it much more efficient than normal heartbeat.



#5
Proleric

Proleric
  • Members
  • 2 352 messages
My understanding is that the script cache does more harm than good. This is the Lexicon info:

http://www.nwnlexico...=Script_Caching

I don't find it helps, even in SP.

A pseudoheartbeat on one NPC will have a negligible effect on performance if it's only checking whether an item's equipped in the right hand. It's a good way to achieve a near-instantaneous result.