Raised This Month: $ Target: $400
 0% 

It has become apparent that ...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mugwump
Senior Member
Join Date: May 2004
Old 06-23-2004 , 22:46   It has become apparent that ...
Reply With Quote #1

... entities hate me. In continuing from the previous two threads, I have somehow gotten past the model issue, now I have an entity being created which falls halfway through the floor. Can anyone looking at the following code see my flaw? The following excerpt uses some code from the sh_beyonder script and some code from a previous thread by JJkiller. I tried _solid and _movetype settings from the beyonder script but they did not work, the entity didn't show up at all when I used those settings.


Code:
   new arg[64]
   new Float:arg2[3]
   new vec[3]
   new aimvec[3]
   new Float:b_orig[3]

   get_user_origin(id, vec)
   get_user_origin(id, aimvec, 2)

   b_orig[0] = float(aimvec[0]);
   b_orig[1] = float(aimvec[1]);
   b_orig[2] = float(aimvec[2] + 40);
    
   entity_get_string(id, EV_SZ_classname, arg, 63)
   //client_print(id, print_chat, "Your class: %s", arg)
   new dEnt = create_entity(arg)
   entity_set_string(dEnt, EV_SZ_classname, "test_entity")
   //entity_set_edict(dEnt, EV_ENT_pContainingEntity, 26)
   entity_set_byte(dEnt, EV_BYTE_controller1, 127)

   entity_get_vector(id,EV_VEC_absmin,arg2)
   entity_set_vector(dEnt, EV_VEC_absmin, arg2)
   entity_get_vector(id,EV_VEC_absmax,arg2)
   entity_set_vector(dEnt, EV_VEC_absmax, arg2)

   entity_get_vector(id,EV_VEC_mins,arg2)
   entity_set_vector(dEnt, EV_VEC_mins, arg2)
   entity_get_vector(id,EV_VEC_maxs,arg2)
   entity_set_vector(dEnt, EV_VEC_maxs, arg2)
   entity_get_vector(id, EV_VEC_size,arg2)
   entity_set_vector(dEnt, EV_VEC_size, arg2)

   // Next 5 lines take current player model and use it for entity
   new model[32]
   new pmodel[128]
   get_user_info(id,"model",model,31)
   format(pmodel, 127, "models/player/%s/%s.mdl", model, model)
   entity_set_model(dEnt, pmodel)

   entity_set_float(dEnt, EV_FL_health,99999200.0)
   entity_set_float(dEnt, EV_FL_takedamage, 1.0)
   entity_set_float(dEnt, EV_FL_dmg_take, 1.0)

   entity_set_int(dEnt, EV_INT_movetype, 13)
   //entity_set_int(dEnt, EV_INT_movetype, 4)

   entity_set_int(dEnt, EV_INT_solid, 2)
   //entity_set_int(dEnt, EV_INT_solid, 3)

   entity_set_int(dEnt, EV_INT_flags, 544)
   entity_set_int(dEnt, EV_INT_spawnflags, 0)
   entity_set_int(dEnt, EV_INT_sequence, 0)

   entity_set_float(dEnt, EV_FL_health, 100.0)

   entity_set_origin(dEnt, b_orig)
Ok, the above creates the entity with the proper model and it spawns at the right spot, but then it falls through the floor, which makes me tink its a problem with the _solid setting, but I tried other settings and couldn't make them work any better.

I will accept your pity for anyone that can point me to my error and help me fix this.

Thank you,
Mugwump
Mugwump is offline
BAILOPAN
Join Date: Jan 2004
Old 06-23-2004 , 23:56  
Reply With Quote #2

I went through this same ordeal, I think the entity code in CSDM works fairly well, so you might want to take a look there for the properties it sets.

Some things I discovered, you can't make a random create_entity() class, I usually do "info_target" and then set a random classname string... depending on the create_entity class you choose WEIRD things can happen. For example, creating "weaponbox" would crash after a while.

Also, I also had trouble with entities falling beneath the world, but _only_ when they were placed in corners. CSDM contains a command to plop things down, and when you use it in tight spaces, the item will just sink away. Strange.
__________________
egg
BAILOPAN is offline
Mugwump
Senior Member
Join Date: May 2004
Old 06-24-2004 , 11:08  
Reply With Quote #3

Thank you BAILOPAN, I have grabbed a copy of CSDM and will look through it, I appreciate your help!

EDIT: One of the things that immediately struck me is that I was trying to create_entity("info target") instead of create_entity("info_target"), I'm ready for glasses ...

Mugwump
Mugwump 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:40.


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