Raised This Month: $ Target: $400
 0% 

Questions about preThink and entity thinking


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KCE
Senior Member
Join Date: Jan 2005
Location: Los Angeles, CA
Old 09-07-2005 , 03:20   Questions about preThink and entity thinking
Reply With Quote #1

Is prethink called in the engine like normal think?
KCE is offline
LynX
Veteran Member
Join Date: Oct 2004
Old 09-07-2005 , 07:37  
Reply With Quote #2

No.
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
KCE
Senior Member
Join Date: Jan 2005
Location: Los Angeles, CA
Old 09-07-2005 , 17:40  
Reply With Quote #3

Few more questions:

1. Are fakemeta hooks to FM_Think called in the engine also?

2. Would doing this make the entity think instantly?
Code:
entity_set_float( id , EV_FL_nextthink, halflife_time() )

And would it be faster than doing this:

Code:
entity_set_float( id , EV_FL_nextthink, halflife_time() + 0.0001 )

3. Is it okay to hook a think function to a player?
Code:
register_think( "player", "think_player" )
KCE is offline
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 09-07-2005 , 19:11  
Reply With Quote #4

for #3 use:
Code:
register_touch("*", "player", "player_touch"); public player_touch(ent, id) {   // ect. }
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 09-07-2005 , 22:57  
Reply With Quote #5

1. Dunno

2. Dunno to the first part, but as to the second part I think 0.1 is the lowest you can make it, just like set_task

3. Yes, that's fine

knekter: start reading.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
KCE
Senior Member
Join Date: Jan 2005
Location: Los Angeles, CA
Old 09-17-2005 , 14:48   Please
Reply With Quote #6

I reallly need to know the answer to these questions please. I know one of you devs know it

Basically I'm trying to detect an entity being created and replacing that entity with another one, when a player fires their weapon (its a grenade launcher). I want the fastest but most efficient method, so their's less delay when they're grenade is switched. I tried to check when entity's are spawned so I hooked FM_CreateEntity, which was able to catch the grenade being created but all the values I got with entity_get_int were 0 so I couldn't find out who fired it.

I'm deciding whether to use player think (not prethink), or prethink. I want to know which one is more efficient to use. Currently I'm using the player think since its called in engine so its less laggy then prethink. Though If I were to hook FM_PlayerPreThink, it would be like PrePlayerPreThink, since the hook is executed before the real thing, which could probably be the fastest check.
  • 1. Are fakemeta hooks to FM_Think and the engine forward pfn_think, called in the engine?

    2. Lynx, are you sure prethink is not called in the engine? Doesn't seem to make sense that the player think (not prethink) is called in engine but the prethink is not, unless the prethink method was made by amxmodx and its not an engine native like normal thinks are. Likewise for postthink also I guess.

    3. BTW, the FL_ALWAYSTHINK flag does not seem to work, I tried everything including setting other flags. I registered a think to the entity and it was never called. Maybe it can only use generic think like FM_Think or pfn_think? Does this have something to do with the ltime being set?

Correct me if I'm wrong.
KCE is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 09-17-2005 , 16:07  
Reply With Quote #7

FL_ALWAYSTHINK is only for brush entities, so it's funny whenever people try to incorporate it into their plugins.
The only thing that uses it by default are trains.

Quote:
Originally Posted by const.h
#define FL_ALWAYSTHINK (1<<21) // Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path)
Try catching FM_SetModel to see when the grenade entity receives its model.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
KCE
Senior Member
Join Date: Jan 2005
Location: Los Angeles, CA
Old 09-18-2005 , 00:32  
Reply With Quote #8

Okay, FM_SetMode worked, now to see whether it's more efficient than the think method.
KCE 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 14:24.


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