AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with Entity Think (https://forums.alliedmods.net/showthread.php?t=215722)

darktemplar 05-11-2013 12:53

Problem with Entity Think
 
Hi, My code is :

[php]

stock create_grenade(id)
{
new iEnt1 = create_entity("info_target")
set_pev(iEnt1, pev_classname, "XBOW")
set_pev(iEnt1, pev_aiment, id)
set_pev(iEnt1, pev_movetype, MOVETYPE_FOLLOW)
set_pev(iEnt1, pev_nextthink, get_gametime() + 2.0)
}

Entity 1 is created and follows id successfully, but I can't make it think . Can anyone help me plz :).
Thanks :)

hleV 05-11-2013 14:00

Re: Problem with Entity Think
 
Maybe "info_target" doesn't get deleted when it thinks?

darktemplar 05-11-2013 14:23

Re: Problem with Entity Think
 
Whatever entity. Engine doesn't call think while it is attached to another entity. When the host entity is dead, Ent1 will be called think . Anyone has solution?

Xalus 05-11-2013 14:30

Re: Problem with Entity Think
 
Show your code.

darktemplar 05-11-2013 14:34

Re: Problem with Entity Think
 
Didn't you notice my code above?

meTaLiCroSS 05-11-2013 14:42

Re: Problem with Entity Think
 
Quote:

Originally Posted by darktemplar (Post 1950069)
Didn't you notice my code above?

And the think callback function? lol

hleV 05-11-2013 14:44

Re: Problem with Entity Think
 
PHP Code:

#include <engine>

public plugin_init()
{
    
register_think("XBOW""OnXbowThink");
}

public 
OnXbowThink(ent)
{
    
// Should be called fine.



ConnorMcLeod 05-11-2013 14:52

Re: Problem with Entity Think
 
Try to add flag FL_KILLME instead of hooking Think function.

darktemplar 05-11-2013 14:55

Re: Problem with Entity Think
 
Can you help me to test that ? Because I don't have CS right now (Plz send me screen shot) :D

PHP Code:


#include <amxmodx>
#include <engine>
#include <fakemeta>

public plugin_init()
{
    
register_concmd("testxbow""cmdtest")
    
register_think("xbow""fw_XbowThink")
}

public 
cmdtest(id)
{
    new 
iEnt create_entity("info_target")
    if (!
iEnt || !pev_valid(iEnt))
        return

    
set_pev(iEntpev_aimentid)
    
set_pev(iEntpev_movetypeMOVETYPE_FOLLOW)
    
set_pev(iEntpev_nextthinkget_gametime() + 5.0)
}

public 
fw_XbowThink(iEnt)
{
    if (!
iEnt || !pev_valid(iEnt))
        return

    new 
id pev(iEntpev_aiment)
    
client_print(idprint_center"THINK SUCCESSFULLY")



darktemplar 05-11-2013 14:56

Re: Problem with Entity Think
 
Quote:

Originally Posted by ConnorMcLeod (Post 1950079)
Try to add flag FL_KILLME instead of hooking Think function.

I want to do something in Think forward ;) . Not only remove the entity


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

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