AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Very strange error [ENGINE] Invalid entity (https://forums.alliedmods.net/showthread.php?t=229401)

hattfield 11-07-2013 02:56

Very strange error [ENGINE] Invalid entity
 
L 11/07/2013 - 17:42:26: [ENGINE] Invalid entity 80
L 11/07/2013 - 17:42:26: [AMXX] Displaying debug trace (plugin "npc.amxx")
L 11/07/2013 - 17:42:26: [AMXX] Run time error 10: native error (native "entity_set_float")
L 11/07/2013 - 17:42:26: [AMXX] [0] npc.sma::set_entity_anim (line 507)
L 11/07/2013 - 17:42:26: [AMXX] [1] npc.sma::stop_run (line 326)

Plugin works fine, but if npc doing skill (before it, i wrote "sv_restart 1") and skill animation in progress - the game is restarted and this error occurs. What's that?

From source:

Code:

public stop_run(ent)
{
    push_and_crush = 0
    set_entity_anim(ent, 8)  -------------------line 326
    entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE)
    entity_set_float(ent, EV_FL_takedamage, 1.0)
    entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.1)
}

Anim stock code

Code:

stock set_entity_anim(ent, anim)
{
    entity_set_float(ent, EV_FL_animtime, get_gametime())
    entity_set_float(ent, EV_FL_framerate, 1.0)
    entity_set_float(ent, EV_FL_frame, 0.0)
    entity_set_int(ent, EV_INT_sequence, anim)   
}


hattfield 11-07-2013 03:44

Re: Very strange error [ENGINE] Invalid entity
 
Fixed by adding checking for every animation:x...

Code:

public stop_run(ent)
{
    if(is_valid_ent(ent))
    {   
        push_and_crush = 0
        set_entity_anim(ent, 8)
        entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE)
        entity_set_float(ent, EV_FL_takedamage, 1.0)
        entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.1)
    }
}

This is not good, maybe somebody knows, how to fix it without checking?

baneado 11-07-2013 16:32

Re: Very strange error [ENGINE] Invalid entity
 
Is stop_run called in a task or in the NPC think?

hattfield 11-08-2013 14:49

Re: Very strange error [ENGINE] Invalid entity
 
in a task

baneado 11-08-2013 16:36

Re: Very strange error [ENGINE] Invalid entity
 
Quote:

Originally Posted by hattfield (Post 2058474)
in a task

so, make a task like:
PHP Code:

#define TASK_STOP 3876
set_task(yourfloat"stop_run"entity+TASK_STOP)

// when ent disappeared/removed by you
remove_task(entity+TASK_STOP

I think do you remove the ent at round end? This would be fix it.

hattfield 11-08-2013 16:44

Re: Very strange error [ENGINE] Invalid entity
 
Thanks! It's very useful.


All times are GMT -4. The time now is 23:22.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.