Page 1 of 1
Summon random thing
Posted: Wed Jan 11, 2006 9:28 pm
by Mr. J
Hey, does anyone know how to summon a random thing in a script?
I see the SNDINFO lump uses a random-like thing where the game will play a random sound, from a list in the file. Well, is there a script that'll do that same thing, but spawn a thing, in this case a DECORATE actor, semi-randomly, from a list of choices?
...I can do a lot, but scripts are really hard, for some reason.
Thanks a lot, in advance.

Posted: Wed Jan 11, 2006 9:52 pm
by Necromage
You have to tinker with this but this is something that could work:
Code: Select all
#include "zcommon.acs"
script 1 (void)
{
int RandomProjectile = random(1,5);
//1 is the lower and five is the higher
//change the values based on what how many projectiles you want
if RandomProjectile == 1
{
Thing_Projectile(tid, type, angle, speed, vspeed);
//tid is the mapspot tag
//type is the type of projectile, each if-then should spawn a different projectile
//angle is the angle the projectile travels
//speed is the speed of the projectile
//vspeed is the virticle speed of the projectile
}
}
//then you keep having if-then clauses for all the projectiles you want
//I think type is the spawnid, which can be looked up in the wiki
Posted: Wed Jan 11, 2006 10:08 pm
by Mr. J
"Thing_Projectile"? Hmm... I was expecting something like:
'SpawnSpot("nameofDECORATEactor",26);"
I'll tinker with it, and see if It's what I was thinking.
Thanks!
Posted: Wed Jan 11, 2006 11:00 pm
by jallamann
Code: Select all
str randomness[10] = { "decorateactor1", "decorateactor2", bla bla bla, "decorateactor10" };
// the [10] means you can put up to 10 actors inside the array ( the {} brackets), increase this number if you need more than ten possibilities
script 1 (void)
{
int blargh = random(1,10); //this picks a random monster from 1 to 10 inclusive. Have the last number equal the amount of entries in the array.
spawnspot(randomness[blargh], mapspot);
}
This should work, but I'm no expert on arrays

Posted: Wed Jan 11, 2006 11:35 pm
by Mr. J
WOW! Yeah, that was it all right. I had some trouble at first getting it to work. It tended to get stuck on one actor, and just spawn it over again. But. after a little adjustment, it seems to work great!
Thanks, jallmann.
... You ever drink the Grolsch with a little ceramic stopper-thing, and a wire at the top of the bottle?
Posted: Wed Jan 11, 2006 11:53 pm
by jallamann
Glad to be of help
I drink it either from the can or from a glass

It's not often you see foreign beer in anything else than cans here in Norway
