Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
cyber-menace

Random Tag

Recommended Posts

I need some help with my Thing_Spawn command. Right now I have

Thing_Spawn (13, T_IMP, 0, random(651, 657);
but the random tag isn't working. I know this because when I removed the random command and put in 657, my Color Translation was working. What am I doing wrong. I need to know how to generate a random tag between 651 and 657 so I can get my imp army looking proper.

Share this post


Link to post
cyber-menace said:

I need some help with my Thing_Spawn command. Right now I have

Thing_Spawn (13, T_IMP, 0, random(651, 657);
but the random tag isn't working. I know this because when I removed the random command and put in 657, my Color Translation was working. What am I doing wrong. I need to know how to generate a random tag between 651 and 657 so I can get my imp army looking proper.


Maybe you should try

Thing_Spawn (13, T_IMP, 0, random(651, 657));

Share this post


Link to post

Well this bugs me, I can't do it. It's not logically possible. There are about 400 requests all on the same line so it is only going to choose one number whether I like it or not. I guess I'll have to make more MapSpots...

Share this post


Link to post

The random function only works for values 0 to 255, so that's why it's not working. Use lower tag numbers, or do something complicated like this:

script 1 (void)

{
int i = random (151, 157);
i += 500;
Thing_Spawn (13, T_IMP, 0, i);
Do_OtherStuffHere
}

This will give a random tag from 151-157 but then adds 500 to it so it ends up being 651-657 when it gets in the spawn command.

Share this post


Link to post

Like I said it isn't possible. It has to vary between 400 or so different map spots, but since they are all spawned at the same time there is no way to switch the variable in mid spawn. Unless Zdoom has something really out of wack to do so.

Share this post


Link to post
cyber-menace said:

Like I said it isn't possible. It has to vary between 400 or so different map spots, but since they are all spawned at the same time there is no way to switch the variable in mid spawn. Unless Zdoom has something really out of wack to do so.



Split the random calls.

If you need 400 different numbers simply do:

random(0,1)*200+random(0,199)


This should generate a random number between 0 and 399. With this you should be able to get enough variation.

Share this post


Link to post
Graf Zahl said:

Split the random calls.

If you need 400 different numbers simply do:

random(0,1)*200+random(0,199)


This should generate a random number between 0 and 399. With this you should be able to get enough variation.



Nooooooooo I have about 400 MAPSPOTS! with the tag 13, and they all ativate at the same time so I can only get one number, but I wanted about 5 or so, but I'm probably going to have to make more map spots for each number...

Share this post


Link to post

How about you divide 5 tags up between the 400 mapspots so you have 80 with each number. Then run this script 5 times:

script 1 (int arg0)

{
int i = random (151, 157);
i += 500;
Thing_Spawn (arg0, T_IMP, 0, i);
Do_OtherStuffHere
}

In the activation script put this line 5 times with no delays in between, and using one of the 5 tags as arg0 each time:

ACS_ExecuteAlways (1, 0, arg0, 0, 0);

This should give 5 sets of imps with one of the random 651-657 tags. And if you've distributed the 5 tags among the 400 mapspots well, then it'll look random too.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×