SphereCommunity
How to deaf a NPC? - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: How to deaf a NPC? (/Thread-How-to-deaf-a-NPC)



How to deaf a NPC? - Gil Amarth - 03-06-2013 02:15 AM

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?


RE: How to deaf a NPC? - darksun84 - 03-06-2013 03:53 AM

Inside your tspeech, add

PHP Code:
ON=*
    IF <
flags> & statf_hidden
        
return 1
    
endif 


tested with an alchemist Tongue


RE: How to deaf a NPC? - Gil Amarth - 03-06-2013 07:29 AM

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


RE: How to deaf a NPC? - Mordaunt - 03-06-2013 07:33 AM

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?



RE: How to deaf a NPC? - Gil Amarth - 03-06-2013 07:45 AM

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.


RE: How to deaf a NPC? - sco - 03-06-2013 10:12 AM

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.


RE: How to deaf a NPC? - RanXerox - 03-06-2013 04:09 PM

Maybe setup context menus to communicate with them when they are hidden.


RE: How to deaf a NPC? - BladeCraft - 03-07-2013 11:59 PM

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?