Posted By: June
Is it possible to create multiple entities with one line? - 03/10/18 04:46
I'm working on a giblet effect for an exploding object and want to create multiple gibs when the object explodes.
Is it possible to create more than one entity with a line of code or does one need to use "ent_create" for each individual gib?
Posted By: June
Re: Is it possible to create multiple entities with one line? - 03/10/18 06:19
I'm ot sure what you mean by that. Though I think I found a solution to create 20 gib models with less code than writing out ent_create 20 times:
.....
var gibness = 20;
while (gibness > 0)
{
ent_create ("gib1.mdl", my, move_gib);
gibness -= 1;
wait(1);
}
.....
This may be the most simple way.
Posted By: Ayumi
Re: Is it possible to create multiple entities with one line? - 03/10/18 07:29
Sure, just use an Animation (or an effect). But it s just one Entity
Edit: You mean a loop
Posted By: June
Re: Is it possible to create multiple entities with one line? - 03/10/18 08:45
Well the intention is to create 20 gibs as soon as the oil barrel explodes. I suppose I could use an effect but these gibs are going to be on fire and bounce around too, maybe leave some scorch marks all over the place.
Posted By: Superku
Re: Is it possible to create multiple entities with one line? - 03/10/18 10:53
Remove the wait(1).
What 20BN meant was the following (I've never tried it though, not sure how it behaves):
A8 ent_create can create several entities at once by loading a WMB entity that contains sub-entities.
Posted By: 20BN
Re: Is it possible to create multiple entities with one line? - 03/10/18 16:10
create a new level and put your model in VECTOR(you need xyz), save and build.
and in your main game level use ent_create("new_level.wmb",vector,NULL);
now use 1 script create many model( and you can set deferent action in every models)
Posted By: June
Re: Is it possible to create multiple entities with one line? - 03/10/18 20:21
That is an interesting feature, I will check it out when I upgrade to A8. Thank you guys for your guidance.
Posted By: Dooley
Re: Is it possible to create multiple entities with one line? - 04/21/18 23:51
while (gibness > 0){ent_create ("gib1.mdl", my, move_gib);gibness -= 1;wait(1);}
You're Welcome
Posted By: NeutronBlue
Re: Is it possible to create multiple entities with one line? - 05/14/18 20:27
I think (not 100%) that using a WMB the way described here, is the same as using a "prefab".
In which case, you're very limited with what can be done to it after creation.
I'm *not* calling you a dummy - but "Entities vs. Prefabs" and the "Entity Selection Guide" parts of the manual might help your decision..
Best regards,
~Neut.