FOnline Development > Questions and Answers
[2238] Worried callback
(1/1)
SEGA_RUS:
--- Code: ---[14:09:560] Script exception: Null pointer access : main : void critter_dead(Critter&inout, Critter@) : 5474, 3 : FOServer::KillCritter : Npc (5002122).
[14:09:560] Execution of script stopped due to exception.
[14:09:560] Context<FOServer::KillCritter : Npc (5002122)>, state<Exception>, call stack<1>:
[14:09:560] 0) main : void critter_dead(Critter&inout, Critter@) : 5474, 3.
--- End code ---
My path
--- Code: ---void critter_dead(Critter& cr, Critter@ killer)
............................................
// npc
if(cr.IsNpc() && killer.IsPlayer() )
{
// Добавляет в стек игрока. Было Clear NPC memory about enemies after it dies.
cr.AddEnemyInStack(killer.Id);
}
else // players
--- End code ---
NPC with 5002122 ID have 1 player in enemy stack?
Is it something wrong in critter_dead working?
How to disable that callbacks or fix it?
Wipe:
killer can be null and you're not checking it before using.
--- Code: ---if(cr.IsNpc() && (valid(killer) && killer.IsPlayer()) )
--- End code ---
Oh btw, your code does exactly opposite of what comment says :P [at least english part]
SEGA_RUS:
--- Quote from: Wipe on August 16, 2015, 05:19:29 pm ---killer can be null and you're not checking it before using.
--- Code: ---if(cr.IsNpc() && (valid(killer) && killer.IsPlayer()) )
--- End code ---
Oh btw, your code does exactly opposite of what comment says :P [at least english part]
--- End quote ---
Thanks Wipe. I found 4 ghouls in 1 Glow lvl. They are dying and respawning after some sec.
--- Code: --- // npc
if(cr.IsNpc())
{
if(valid(killer) && killer.IsPlayer())
{
// Добавляет в стек убийцу. Было Clear NPC memory about enemies after it dies.
cr.AddEnemyInStack(killer.Id);
}
}
else // players
--- End code ---
btw there is on russian
--- Quote ---Add killer in stack. Was Clear NPC memory about enemies after it dies.
--- End quote ---
Navigation
[0] Message Index
Go to full version