Raised This Month: $ Target: $400
 0% 

Odd Entity Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 08-13-2009 , 14:13   Odd Entity Problem
Reply With Quote #1

I'm displaying an unmoving model in 3d space at some coordinates I load from MySQL.

When I pass the coordinates thusly, it displays the model at the location:
PHP Code:
entity_set_origin(entity,Origin
When I do it this way, I see nothing at the location:
PHP Code:
set_pev(entity,pev_origin,Origin
In one compile, I even went as far as logging the origin, calling entity_set_origin(entity,Origin), and then reading it back by using pev(entity,pev_origin,Origin) and logging the value a second time. (I could see the model and everything)

In a second compile, I logged the origin, called set_pev(entity,pev_origin,Origin), and then read it back by using pev(entity,pev_origin,Origin) and logged the value a second time. (Though I could not see the model because I used set_pev)

All four of the logged origins were exactly the same, yet set_pev makes no model appear. Any suggestions?
__________________
Bad_Bud is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-13-2009 , 14:15   Re: Odd Entity Problem
Reply With Quote #2

set_pev acts as entity_set_vector( iEnt, EV_VEC_origin, vecOrigin )

engfunc( EngFunc_SetOrigin, iEnt, vecOrigin )
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 08-13-2009 , 14:16   Re: Odd Entity Problem
Reply With Quote #3

I used set_pev(entity,pev_origin,Origin) for some other entities I spawned. Why is it that in this case I need to use engfunc?
__________________
Bad_Bud is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-13-2009 , 14:17   Re: Odd Entity Problem
Reply With Quote #4

Because you used set_pev BEFORE you spawn those ents.
Then the game sends SetOrigin in the spawn function.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 08-13-2009 , 14:44   Re: Odd Entity Problem
Reply With Quote #5

The engfunc worked perfectly, but it still bothers me that I don't understand it completely!

Here's the order everything went in on both.

One that already worked:
PHP Code:
new Item=engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))

new 
Float:Location[3]
pev(id,pev_origin,Location)

new 
Float:Minbox[3]={-2.5,-2.5,-2.5}
new 
Float:Maxbox[3]={2.5,2.5,-2.5}
new 
Float:Angles[3]//={0.0,0.0,0.0}

Angles[1]=float(random_num(0,359)) 

set_pev(Item,pev_mins,Minbox)
set_pev(Item,pev_maxs,Maxbox)
set_pev(Item,pev_angles,Angles)            
set_pev(Item,pev_solid,SOLID_TRIGGER)
set_pev(Item,pev_movetype,MOVETYPE_TOSS)            
set_pev(Item,pev_classname,CLASS_ITEM)

new 
String[65]
format(String,64,"Stuff")
set_pev(Item,pev_targetname,String)

format(String,64,"Modelpath")
engfunc(EngFunc_SetModel,Item,String)
set_pev(Item,pev_origin,Location
What you just helped with:
PHP Code:
//I passed some coordinates through to the threaded query
new Float:Origin[3]
for(new 
i=0;i<3;i++)
        
Origin[i]=float(Data[i])

new 
Float:Angles[3]
for(new 
i=0;i<3;i++)
        
Angles[i]=float(Data[i+3])

entity=engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))
        
set_pev(entity,pev_angles,Angles)        
set_pev(entity,pev_solid,SOLID_NOT)
set_pev(entity,pev_movetype,MOVETYPE_NONE)        
set_pev(entity,CLASS_SALEITEM)

format(Model,64,"Modelpath",Model)
engfunc(EngFunc_SetModel,entity,Model)

engfunc(EngFunc_SetOrigin,entity,Origin
So I guess the second one was created differently in the engine because it was not solid and had no min/maxbox? Otherwise, I think everything else was done in the same order.
__________________
Bad_Bud is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-13-2009 , 14:45   Re: Odd Entity Problem
Reply With Quote #6

Also, use EngFunc_SetSize.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 08-13-2009 , 14:46   Re: Odd Entity Problem
Reply With Quote #7

What for? The bounding box on the first one?
__________________
Bad_Bud is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-14-2009 , 00:27   Re: Odd Entity Problem
Reply With Quote #8

Instead of :

set_pev(Item,pev_mins,Minbox)
set_pev(Item,pev_maxs,Maxbox)

Then, absmin and absmax will also be set.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 15:08.


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