Raised This Month: $ Target: $400
 0% 

Problem with Entity Think


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
darktemplar
Member
Join Date: Sep 2009
Old 05-11-2013 , 12:53   Problem with Entity Think
Reply With Quote #1

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
darktemplar is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 05-11-2013 , 14:00   Re: Problem with Entity Think
Reply With Quote #2

Maybe "info_target" doesn't get deleted when it thinks?
__________________
hleV is offline
darktemplar
Member
Join Date: Sep 2009
Old 05-11-2013 , 14:23   Re: Problem with Entity Think
Reply With Quote #3

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?
darktemplar is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 05-11-2013 , 14:30   Re: Problem with Entity Think
Reply With Quote #4

Show your code.
__________________
Retired.
Xalus is offline
darktemplar
Member
Join Date: Sep 2009
Old 05-11-2013 , 14:34   Re: Problem with Entity Think
Reply With Quote #5

Didn't you notice my code above?
darktemplar is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 05-11-2013 , 14:42   Re: Problem with Entity Think
Reply With Quote #6

Quote:
Originally Posted by darktemplar View Post
Didn't you notice my code above?
And the think callback function? lol
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 05-11-2013 , 14:44   Re: Problem with Entity Think
Reply With Quote #7

PHP Code:
#include <engine>

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

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

__________________
hleV is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-11-2013 , 14:52   Re: Problem with Entity Think
Reply With Quote #8

Try to add flag FL_KILLME instead of hooking Think function.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
darktemplar
Member
Join Date: Sep 2009
Old 05-11-2013 , 14:55   Re: Problem with Entity Think
Reply With Quote #9

Can you help me to test that ? Because I don't have CS right now (Plz send me screen shot)

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 is offline
darktemplar
Member
Join Date: Sep 2009
Old 05-11-2013 , 14:56   Re: Problem with Entity Think
Reply With Quote #10

Quote:
Originally Posted by ConnorMcLeod View Post
Try to add flag FL_KILLME instead of hooking Think function.
I want to do something in Think forward ;) . Not only remove the entity
darktemplar is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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