... 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