Trying to spawn more than one model.
-
Hello Plutonium, I am trying to create a script so I can spawn models with set origin.
My script DOES work but I have one issue... It only spawns one of the models and won't spawn any more than that. Any help would be appreciated!makejumppad(origin, velocity) { self endon("disconnect"); dospawn = spawn("script_model", origin); dospawn setModel("prop_suitcase_bomb"); for(;;) { if (distance(self getOrigin(), origin) <= 15) { self setVelocity(velocity); } wait 0.01; } } jumppads() { if (getDvar("mapname") == "mp_courtyard_ss") { makejumppad((490.875, -2121, 134.676), (50, 0, 430)); makejumppad((-2957.64, 995.975, 994.125), (50, 0, 430)); } }
-
You are running a loop inside the function you called, so the thread is probably blocked.
Something like this could work, but idk enough about gsc to be sure.
level thread makejumppad((490.875, -2121, 134.676), (50, 0, 430)); level thread makejumppad((-2957.64, 995.975, 994.125), (50, 0, 430));
Best case would probably be that you move your loop to another function and start a thread for the loop function from makejumppad.
-
mxve Ay thanks for the help!
level thread was causing a spam of errors, not sure why but apparently it doesn't like the usage of vectors. I switched it to self thread and everything works now!