Deafen the Player

I need to temporarily deafen the player. that is, I need “listen” and “listen to” to route to my own “you can’t hear because…” message.

can’t simply “modify” the IAction because the sensory actions seem to be “different” (at least it doesn’t work when modifying ListenImplicitAction).

I tried adding a dummy notifySoundEvent to the player but this doesn’t fire with a simple “listen”.

tried overriding

 nothingToHearMsg = '{You/he} hear{s/d} nothing out of the ordinary. 

which would be the easiest and most efficient but this doesn’t work either. at least not when I attach it to the player or gameMain object. I’m thinking there may be a better place to declare this?

any help would be appreciated…

2 Likes

Are you still using adv3?
I would put it in the actorAction method of your player character object.
Something like

me: Actor
    isDeafened = nil
    actorAction() {
        if(isDeafened && gActionIn(ListenTo, ListenImplicit)
            failCheck('You can\'t hear because... ');
    }
;

beforeAction would probably work just the same, but it’s neater code organization to put PC-specific “before-action” code in actorAction.

2 Likes

yup, that works.thx!

1 Like

The neater, “TADSy” way to do it would be:

me: Actor
    isDeafened = nil
    cantHearWhenDeafenedMsg {
        if(someCondition)
            return 'Message for this condition. ';
        else
            return 'Generic deafened message. ';
    }
    actorAction() {
        if(isDeafened && gActionIn(ListenTo, ListenImplicit)
            failCheck(cantHearWhenDeafenedMsg);
    }
;

which is more robust and flexible than hardcoding a string into the failCheck.

2 Likes

Deafen the player character, I hope?!

3 Likes