Spawn() new entity as argument inside function body
Posted: Sat Nov 19, 2016 5:43 pm
Hi guys, I'm trying to do something like this
Then calling the function with an entity already declared
But it just won't work. If I change the spawning function removeing the spawn()
and then spawning the entity OUTSIDE function block
It works. But, of course, I consider it a very ugly way of coding.
I think it's not possible to do it in QuakeC but, why not ask?
Thanks in advance
PS: I use FTE but I think it's the same for every engine
Code: Select all
void myspawnfunc(entity ent)
{
ent = spawn();
setlocation(ent,[-200,20,200]);
ent.health = 100;
//and so on..
}
Code: Select all
entity myshinynewent;
myspawnfunc(myshinynewent);
Code: Select all
void myspawnfunc(entity ent)
{
setlocation(ent,[-200,20,200]);
ent.health = 100;
//and so on..
}
Code: Select all
entity myshinynewent;
myshinynewent = spawn();
myspawnfunc(myshinynewent);
I think it's not possible to do it in QuakeC but, why not ask?
Thanks in advance
PS: I use FTE but I think it's the same for every engine