Raised This Month: $ Target: $400
 0% 

Entity Problems, once again...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Silencer123
Veteran Member
Join Date: Jul 2006
Old 05-12-2007 , 16:42   Entity Problems, once again...
Reply With Quote #1

Is it possible that the first time you test something it never works?
Well, the time has come again.
Code:
new origin[3] pev(i,pev_origin,origin) new uzi=engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"weapon_uziakimbo")) set_pev(uzi,pev_spawnflags,1024) set_pev(uzi,pev_origin,origin) set_pev(uzi,pev_model,"models/w_uzi.mdl")
This does nothing - there does not at least appear an error message in the console.
This should do nothing more than spawn an uziakimbo with spawnflags set to 1024 at the Players origin.
But actually it does nothing - why?
__________________
EAT YOUR VEGGIES
Silencer123 is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 05-12-2007 , 20:44   Re: Entity Problems, once again...
Reply With Quote #2

Well you can't use pev() for everything.

You should use this for origin and model:

Code:
engfunc(EngFunc_SetModel, entid, "chicken")

engfunc(EngFunc_SetOrigin, entid, origin)
stupok is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 05-12-2007 , 21:46   Re: Entity Problems, once again...
Reply With Quote #3

You might also have to call DispatchSpawn.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 05-12-2007 , 22:59   Re: Entity Problems, once again...
Reply With Quote #4

Quote:
Originally Posted by XxAvalanchexX View Post
You might also have to call DispatchSpawn.
This is correct, I had somebody PM this question. You MUST spawn an entity before setting their model and some other stuff. It is a good rule of thumb to always spawn you're entity before messing with it's pev_* section.

However with fakemeta use:
Code:
dllfunc(DLLFunc_Spawn, ent);
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 05-12-2007 , 23:46   Re: Entity Problems, once again...
Reply With Quote #5

Quote:
Originally Posted by Zenith77 View Post
This is correct, I had somebody PM this question. You MUST spawn an entity before setting their model and some other stuff. It is a good rule of thumb to always spawn you're entity before messing with it's pev_* section.

However with fakemeta use:
Code:
dllfunc(DLLFunc_Spawn, ent);
I use this in my new Plugin:
Code:
g_SNentity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
engfunc(EngFunc_SetOrigin, g_SNentity, g_Origin);
engfunc(EngFunc_SetModel, g_SNentity, g_models[0]);
My code works flawless....
Should i use this dllfunc too?
Code:
dllfunc(DLLFunc_Spawn, g_SNentity);
Would that improve my code?
weird!

greetz regalis
__________________
regalis is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 05-13-2007 , 01:27   Re: Entity Problems, once again...
Reply With Quote #6

@regalis
Code:
dllfunc(DLLFunc_Spawn, g_SNentity);
This (i think) notifies the engine of the changes to an entity. So far, i never needed to use it on any entity's besides "info_target" which is manly used for creating new entity's. So, i assume it's used all the time just for the safety. So it wouldn't hurt to add it.

@Silencer123

If i'm right, you need to use the function. As Avalanche said, because you're modifying an already 'made' entity.
(I assume this is for SvenCoop)
__________________
Oh yeah

Last edited by Drak; 05-13-2007 at 01:30.
Drak is offline
Send a message via MSN to Drak
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 05-13-2007 , 01:37   Re: Entity Problems, once again...
Reply With Quote #7

Quote:
Originally Posted by SixTwin View Post
@regalis
Code:
dllfunc(DLLFunc_Spawn, g_SNentity);

This (i think) notifies the engine of the changes to an entity. So far, i never needed to use it on any entity's besides "info_target" which is manly used for creating new entity's. So, i assume it's used all the time just for the safety. So it wouldn't hurt to add it.
Then i will add it in the next update if there is one..0o
But as far as i know myself, there are plenty...i only wait till VEN inspects my Plugin
He always find some flaws..0o

Thanks for the explanation!
I go now sleeping*lol*

greetz regalis
__________________
regalis is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 05-13-2007 , 06:17   Re: Entity Problems, once again...
Reply With Quote #8

Okay, does that dllfunc come right behind the
EngFunc_CreateNamedEntity line one or at the end of all changes made?

EDIT: Just reading your words more carefully and finding out I have to do that before I set something.
__________________
EAT YOUR VEGGIES

Last edited by Silencer123; 05-13-2007 at 06:32.
Silencer123 is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 05-13-2007 , 06:39   Re: Entity Problems, once again...
Reply With Quote #9

It's necessary to spawn an entity in two cases. When you want to apply all previously fired to that entity keyvalue data and when you want it to take all of the native properties of its classname. So for example if you'd going to spawn func_buyzone entity you do not have to care about configuration of its solidity and visibility.
VEN is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 05-13-2007 , 06:49   Re: Entity Problems, once again...
Reply With Quote #10

Okay... Now where I am looking for an alternative for pev I arrived at this point:
Code:
engfunc(EngFunc_SetKeyValue,engfunc(EngFunc_GetInfoKeyBuffer,uzi),"spawnflags","1024")
It says EngFunc_GetInfoKeyBuffer returns "char*" - So is it only one char = one array = one integer?
Or do I have to make a new uberfat string to store long word clusters? *confused*
__________________
EAT YOUR VEGGIES
Silencer123 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 06:46.


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