Is NW_I_WAS_ATTACKED used to call the creature friends?

I realized OnPerception event has a code that fires if the creature perceive a possible enemy to attack:

SpeakString(“NW_I_WAS_ATTACKED”, TALKVOLUME_SILENT_TALK);

Two questions about it:

  1. Is this to call others creatures that didnt perceive the enemy?

  2. Do I need to have a custom dialog in my creature for this to work?

I would like to implement this to my bosses creatures. Sometimes only the boss perceive the player and is lured alone for combat. Any idea to resolve this?

Hey have you ever played my module? Click here: Amnesia Chapter 1 - Enjoy it!

The following script should do what you want. It needs to be in the bosses OnPhysicalAttacked event. In order for it to work you need to give every hench person the exact same tag. This tag must not be used elsewhere. The script -

void CallTheCavalry(string sThisTag, object oPC, object oCenteredOn = OBJECT_SELF, float fRadius = RADIUS_SIZE_COLOSSAL);

    void main()
    {
    		object oPC = GetLastAttacker();
    		
    		if(!(GetIsPC()))
    			return;
    			
    		CallTheCavalry(sHenchTag, oPC);
    }

    void CallTheCavalry(string sThisTag, object oPC, object oCenteredOn = OBJECT_SELF, float fRadius = RADIUS_SIZE_COLOSSAL)
    {
        vector vCenterPoint = GetPosition(oCenteredOn);
        location lTarget = GetLocation(oCenteredOn);

        object oHenchy = GetFirstObjectInShape(SHAPE_SPHERE, fRadius, lTarget, FALSE, OBJECT_TYPE_CREATURE, vCenterPoint);

        while(GetIsObjectValid(oHenchy))
        {
            if(GetTag(oHenchy) == sThisTag)
            {
                AssignCommand(oHenchy, SetIsTemporaryEnemy(oPC, oHenchy));
    			DetermineCombatRound();
    			AssignCommand(oHenchy, ActionAttack(oPC));
            }
            oHenchy = GetNextObjectInShape(SHAPE_SPHERE, fRadius, lTarget, FALSE, OBJECT_TYPE_CREATURE, vCenterPoint);
        }
    }

Change the sHenchTag in CallTheCavalry(sHenchTag, oPC); to the tag of your hench persons. Example if your hench persons have the tag Fred, you need to change it to CallTheCavalry(“Fred”, oPC);
The hench persons need to be within 10 metres of the boss in order to hear their cry for help.

TR

1 Like

Thanks for the feedback. I’ll try it.