Aller au contenu

Photo

AI Level and what toggles it


  • Veuillez vous connecter pour répondre
11 réponses à ce sujet

#1
henesua

henesua
  • Members
  • 3 882 messages
What toggles the AI level? Anything hardcoded/automatic?

I am specifically interested in knowing if DM possession lower teh AI level for a creature. 

#2
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
DM possession completely disables AI, including any custom OnDeath scripts that might be handing out XP.

#3
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
I have no Idea if DM possession changes the AI state or not. You could place a Hb on your DM possessed creature to report there AI state.

The Script set used by a DM possessed creature is set in statescripts.2da, The default settings clear all of the scripts from the creature. I have also never tested to find out if the 2da is client/server side.

#4
henesua

henesua
  • Members
  • 3 882 messages
 Preliminary Test:

No PC/DM in area AI level = VERY LOW
1 PC/DM in area AI = LOW
PC Attacks NPC AI = NORMAL

after DM dispossesses an NPC  AI = HIGH
during DM possession the heartbeat script of the creature did not run at all

#5
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Hmm, Did you give it a DM possessed HB script?

#6
henesua

henesua
  • Members
  • 3 882 messages
 For debuging I threw in the following snippet in the heartbeat script:

    int nAI     = GetAILevel();
    string sName= GetName(OBJECT_SELF);

    object oNotify    = GetFirstPC();
    if(GetIsDMPossessed(OBJECT_SELF))
        oNotify   = OBJECT_SELF;
    // * if not runnning normal or better Ai then exit for performance reasons
    if(nAI == AI_LEVEL_INVALID)
    {
        SendMessageToPC(oNotify, sName+" AI invalid ... setting to default");
        SetAILevel(OBJECT_SELF, AI_LEVEL_DEFAULT);
    }
    else if (nAI == AI_LEVEL_VERY_LOW)
    {
        SendMessageToPC(oNotify, sName+" AI very low exiting");
        return;
    }
    else
    {
        SendMessageToPC(oNotify, sName+" AI level("+IntToString(nAI)+")");
    }


I only tested the AI level in the heartbeat script

#7
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Yes the Possesed creature has its scripts changed to the settings in statescripts.2da when he gets possesed. so unless you placed your script name on line 23 DMPossessedHeartbeat, Your script will not run when possesed by the DM.

#8
henesua

henesua
  • Members
  • 3 882 messages
Yeah... I was lazy. Looked into that 2da now.

This means that unless I add the default scripts to statescripts.2da, I don't need to catch DM Possession in the AI.

#9
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Correct. But if you want your NPC to give a custom XP when possesed and Killed, You may want to add a OnDeath event.

#10
henesua

henesua
  • Members
  • 3 882 messages
Ok I made some changes to statescripts including a dm possessed statescript.

When DM Possessed an NPC's AI is HIGH, and it remains so when dispossessed until there are no PCs in the area.

[EDIT]
Another upside about this is that I now have a better system for tracking the DM object on a DM possessed creature. Thanks for the info on statescripts.

By using a DM Possessed heartbeat I can use that to track DM possession (place a pointer to the DM on the NPC) without the need to add this code to the default heartbeat.

Modifié par henesua, 11 août 2012 - 06:47 .


#11
henesua

henesua
  • Members
  • 3 882 messages
Did another test:

statescripts.2da functions adequately as server side only. Doesn't need to be on the client.

#12
Shadooow

Shadooow
  • Members
  • 4 471 messages

Lightfoot8 wrote...

Correct. But if you want your NPC to give a custom XP when possesed and Killed, You may want to add a OnDeath event.

Just FYI. This feature was added in initial Community Patch 1.70 release already. The script in DMOnDeath event looks like this:

void main()
{
string script = GetLocalString(OBJECT_SELF,"DEATH_SCRIPT");
 if(script == "")
 {
 script = "nw_c2_default7";
 }
ExecuteScript(script,OBJECT_SELF);
}

and all default monsters (resp. their blueprints) with nonstandard OnDeath script has the local variable DEATH_SCRIPT defined.