In some circunstances I would be interested that my NPCs couldn´t hear anything my players could say them.
For example, if I hide my mercenary NPCs, I don´t want anyone can speak with them when they are hidden. But they need to talk when they are not hide.
I can not remove a TSPEECH from a NPC because is a read only value, any ideas?
Inside your tspeech, add
PHP Code:
ON=*
IF <flags> & statf_hidden
return 1
endif
tested with an alchemist

The problem is after that code, the npc don´t hear anything.
Either if it is true or false that conditional, don´t enter in other words like ON=Britain, or ON=Yew because have entered before ON=*
That is what you asked for...
(03-06-2013 02:15 AM)Gil Amarth Wrote: [ -> ]In some circunstances I would be interested that my NPCs couldn´t hear anything my players could say them.
For example, if I hide my mercenary NPCs, I don´t want anyone can speak with them when they are hidden. But they need to talk when they are not hide.
I can not remove a TSPEECH from a NPC because is a read only value, any ideas?
In some circunstances, not always.
The NPC don´t hear anything with that code even if he is not hidden. Because when goes into ON=*, don´t enter in others ON= words even is not hidden.
Code:
[speech spk_hidden_silence]
ON=*
IF <flags> & statf_hidden
return 1
endif
Have a speechblock like the above.
Then add it to your NPCs, either on your custom hiding event or on=@create with:
Code:
on=@create
speech +spk_hidden_silence
Speech added with speech command are checked before any tspeech.
Maybe setup context menus to communicate with them when they are hidden.
I believe if you want the NPC to respond to certain things while hidden, you can put them before the on=* in the speech block and it checks in order.
on=Britain
say hi
on=reveal thyself
say ok fine
on=*
if hidden, return 1
Or, when they hide, add a speech event then and when revealed, remove it?