Ir al contenido

Foto

No scripting skills . . need script to make Creature go hostile when PCs enter trigger


  • Por favor identifícate para responder
4 respuestas en este tema

#1
Arianna0

Arianna0
  • Members
  • 20 mensajes

Been trying to make a trigger  so that  my  constructs will not go hostile until the  players enter a specific trigger area

 

So far my attempts have  either  messed with the whole faction making creatures hostile in other parts of the server 

 

or nothing at all happens 

 

Now to be fair I have mostly tested with NPCs 

 

 

Current attempt is

    #include "x0_i0_partywide"
#include "nw_i0_generic"


void main()
{
    object oTarget;

    // Get the creature who triggered this event.
    object oPC = GetEnteringObject();

    // Only fire for (real) PCs.
    if ( !GetIsPC(oPC)  ||  GetIsDMPossessed(oPC) )
        return;

    // Attack the PC.
    ChangeToStandardFaction(oTarget, STANDARD_FACTION_HOSTILE);

    AdjustReputation(oPC, oTarget, -100);
    //AdjustReputation(oPC, GetNearestObjectByTag("009_cr_q24_golem"), -100);
    SetIsTemporaryEnemy(oPC, GetNearestObjectByTag("009_cr_q24_golem"));
    AssignCommand(GetNearestObjectByTag("009_cr_q24_golem"), DetermineCombatRound(oPC));

    // Make "009_cr_q24_golem" dislike the PC's party more.
    oTarget = GetObjectByTag("009_cr_q24_golem");
    AdjustReputationWithFaction(oPC, oTarget, -100);
}

My  Construct  has a unique  faction tag that  should not mess with   factions elsewhere



#2
kevL

kevL
  • Members
  • 4.052 mensajes
looks like things have become over-complicated :)

an important technical detail first: oTarget has not been defined.


But all you really have to do is set the creature to the Hostile faction and tell it to attack.
 
#include "nw_i0_generic"

void main()
{
    object oPC = GetEnteringObject();

    if (!GetIsPC(oPC) || GetIsDMPossessed(oPC))
        return;

    object oTarget = GetNearestObjectByTag("009_cr_q24_golem");
    ChangeToStandardFaction(oTarget, STANDARD_FACTION_HOSTILE);
    AssignCommand(oTarget, DetermineCombatRound(oPC));
}
tbh, it doesn't even have to be told to attack if it uses the standard-AI scripts. A heartbeat or perception would/should initiate aggro, also. So sometimes i May give the creature just a move-toward-PC command and let things happen that way.

#3
Tchos

Tchos
  • Members
  • 5.030 mensajes

For one of my encounters, I gave the player the option of responding to a conversation by the enemy or attacking without answering to gain a surprise advantage.  If the player decides to talk, then I set the enemy hostile and I also issue a command to attack.  If the player chooses to attack preemptively, I simply set the enemy hostile and let the creature's perception take care of it.  It's a short advantage window, but it's something.


  • A GCoyote le gusta esto

#4
Arianna0

Arianna0
  • Members
  • 20 mensajes

Thanks  ... reason I want a trigger script rather then the general go hostile scripts is so that  my construct doesn't move till the PCs get to close to the object its guarding



#5
Tchos

Tchos
  • Members
  • 5.030 mensajes

Not sure if this is clear or not, but the script kevL provided is a trigger script that should do what you want.  What you don't want is to use the AdjustReputationWithFaction, since that's what was making the entire faction hostile.