What toggles the AI level? Anything hardcoded/automatic?
I am specifically interested in knowing if DM possession lower teh AI level for a creature.
AI Level and what toggles it
Débuté par
henesua
, août 11 2012 07:54
#1
Posté 11 août 2012 - 07:54
#2
Posté 11 août 2012 - 12:10
DM possession completely disables AI, including any custom OnDeath scripts that might be handing out XP.
#3
Posté 11 août 2012 - 02:04
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.
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
Posté 11 août 2012 - 04:07
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
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
Posté 11 août 2012 - 04:40
Hmm, Did you give it a DM possessed HB script?
#6
Posté 11 août 2012 - 05:12
For debuging I threw in the following snippet in the heartbeat script:
I only tested the AI level 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
Posté 11 août 2012 - 05:23
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
Posté 11 août 2012 - 05:34
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.
This means that unless I add the default scripts to statescripts.2da, I don't need to catch DM Possession in the AI.
#9
Posté 11 août 2012 - 05:37
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
Posté 11 août 2012 - 06:17
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.
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
Posté 11 août 2012 - 08:39
Did another test:
statescripts.2da functions adequately as server side only. Doesn't need to be on the client.
statescripts.2da functions adequately as server side only. Doesn't need to be on the client.
#12
Posté 12 août 2012 - 03:21
Just FYI. This feature was added in initial Community Patch 1.70 release already. The script in DMOnDeath event looks like this: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.
and all default monsters (resp. their blueprints) with nonstandard OnDeath script has the local variable DEATH_SCRIPT defined.void main()
{
string script = GetLocalString(OBJECT_SELF,"DEATH_SCRIPT");
if(script == "")
{
script = "nw_c2_default7";
}
ExecuteScript(script,OBJECT_SELF);
}





Retour en haut







