|
2 registered members (steyr, alibaba),
534
guests, and 4
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: defining entities
[Re: exile]
#339048
08/24/10 06:28
08/24/10 06:28
|
Joined: Aug 2008
Posts: 482
bart_the_13th
Senior Member
|
Senior Member
Joined: Aug 2008
Posts: 482
|
|
|
|
Re: defining entities
[Re: exile]
#339061
08/24/10 09:30
08/24/10 09:30
|
Joined: Sep 2009
Posts: 987 Budapest
Aku_Aku
User
|
User
Joined: Sep 2009
Posts: 987
Budapest
|
For example:
STRING* entname;
ENTITY* gun1;
...
function my_ent_create(ENTITY* myent, STRING* myentname) {
STRING* myname;
str_cpy(myname,myentname);
myent=ent_create(myname);
}
...
function main() {
...
str_cpy(entname,"gun.mdl");
my_ent_create(gun1, entname);
...
}
It maybe seems to too complicated, but it has a lot of potential place in the code, to extend, to make it general and so on... (not tested)
Last edited by Aku_Aku; 08/24/10 09:34.
|
|
|
Re: defining entities
[Re: Aku_Aku]
#339081
08/24/10 14:12
08/24/10 14:12
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
For example:
STRING* entname;
ENTITY* gun1;
...
function my_ent_create(ENTITY* myent, STRING* myentname) {
STRING* myname;
str_cpy(myname,myentname);
myent=ent_create(myname);
}
...
function main() {
...
str_cpy(entname,"gun.mdl");
my_ent_create(gun1, entname);
...
}
It maybe seems to too complicated, but it has a lot of potential place in the code, to extend, to make it general and so on... (not tested) Nice idea, but most of this wouldn't work and the rest of it's unneeded
STRING* entname; //unneeded
ENTITY* gun1;
...
function my_ent_create(ENTITY* myent, STRING* myentname) { //passed entity won't be set
STRING* myname; //unneeded
str_cpy(myname,myentname); //unneeded
myent=ent_create(myname); //just use ent_create(myentname, NULL, NULL)
}
...
function main() {
...
str_cpy(entname,"gun.mdl"); //unneeded
my_ent_create(gun1, entname); //as above, won't set entity
...
}
try something like
ENTITY* gun1;
function my_ent_create(STRING* myentname) {
you=ent_create(myentname, NULL, NULL);
vec_fill(your.scale_x, 1);
return(you);
}
function main() {
gun1 = my_ent_create("gun.mdl");
}
although this isn't a way to 'predefine' entities
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|