Jump to content
Sign in to follow this  
HateDread

Randomly Spawning Group In Three Different Positions

Recommended Posts

How do I spawn a group from a random choice between three locations, (East, West, and North)?

In the trigger, condition is CHN_UNDEAD_ZEDGRPCNT < 4 && true && isserver

Where CHN_UNDEAD_ZEDGRPCNT returns the total number of infected groups in Charon's zombie mod.

I need to spawn new groups at one of the three locations whenever the total count < 4.

I started writing it, but it's obviously incorrect syntax, as the hint doesn't fire, and probably the wrong method, too.

SpawnNum = random 3;

If (SpawnNum == 1) then (East = 1) AND (West = 0) AND (North = 0);

If (SpawnNum == 2) then (East = 0) AND (West = 1) AND (North = 0);

If (SpawnNum == 3) then (East = 0) AND (West = 0) AND (North = 1);

globalVariable "SpawnNum";

globalVariable "East";

globalVariable "West";

globalVariable "North";

player sidechat "Check";

Any ideas?

Cheers!

Share this post


Link to post
Share on other sites

Try it this way

SpawnNum = random 3;

If (SpawnNum == 1) then 
{
East = 1;
West = 0;
North = 0;
};
If (SpawnNum == 2) then 
{
East = 0;
West = 1;
North = 0;
};
If (SpawnNum == 3) then 
{
East = 1;
West = 0;
North = 0;
};

globalVariable "SpawnNum";
globalVariable "East";
globalVariable "West";
globalVariable "North";

player sidechat "Check"; 

Share this post


Link to post
Share on other sites

My god, I can't believe I did that.

Thank you! I got those mixed up somehow :S

EDIT:

So, I came up with that much of the idea so far, but I don't know how to connect this with the actual group spawn. Would it be something like if (East == 1) then...? I just can't think of how to proceed from there!

Cheers.

Share this post


Link to post
Share on other sites

I can teach you how to put them in the direction that the player's going... Example: The player chooses to go East, then the group will be moved to the east!

you simply place a trigger activated by the side of the player and add to the OnAct: {_x setpos getpos <direction>} foreach units group <leadername>; :P it's not what you were asking but i was bored and this doesn't harm anyone xD

If i know something else i'll post it ;)

Best Regards, SGJackson!

---------- Post added at 02:54 PM ---------- Previous post was at 02:39 PM ----------

I just got this from the editing guide that i told you to download:

The following Syntax enables one to move a unit or an Object to a random position. The

Syntax consists out of the values of the XYZ – coordinates and the marker positions.

The Engine will recalculate the random position by using this information.

Name setVehiclePosition [[1000,2000], ["Marker1", "Marker2", "Marker3"], 0]

I didin't test it... Do it yourselve :P

Best Regards, SGJackson!

---------- Post added at 03:04 PM ---------- Previous post was at 02:54 PM ----------

FORGET EVERYTHING THAT I SAID!!!!!! I GOT THE ANSWER AND YOU KNOW WHAT? IT'S IN THE GUIDE TOO!!

THIS IS EXACTLY WHAT YOU NEED!!!!

_Start = random 3;



? _Start < 1 : goto "P1";

? _Start < 2 : goto "P2";

? _Start < 3 : goto "P3";

#P1

Player setPos [x,y,z];



exit;

#P2

Player setPos [x,y,z];



exit;

#P3

Player setPos getPos HP1;

exit;

well, that's what it said in the guide: Random positions

Best, Best, Best Regards, SGJackson!

Edited by SGJackson
Forgot the explanation :P

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×