HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

trigger help(RAmdom)

09-15-2004, 10:02 PM#1
Elthanor
When the map starts, how do i make a unit spawn in 1 of 4 places. Its random. i cant figur it out...
09-15-2004, 10:17 PM#2
Gandalf2349
Here is what you want.

Code:
Make Units
    Events
        Map initialization
    Conditions
    Actions
        Set varMiscInt = (Random integer number between 1 and 4)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                varMiscInt Equal to 1
            Then - Actions
                Unit - Create 1 Seal for Player 1 (Red) at (Center of RegRand1 <gen>) facing (Random angle) degrees
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                varMiscInt Equal to 2
            Then - Actions
                Unit - Create 1 Seal for Player 1 (Red) at (Center of RegRand2 <gen>) facing (Random angle) degrees
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                varMiscInt Equal to 3
            Then - Actions
                Unit - Create 1 Seal for Player 1 (Red) at (Center of RegRand3 <gen>) facing (Random angle) degrees
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                varMiscInt Equal to 4
            Then - Actions
                Unit - Create 1 Seal for Player 1 (Red) at (Center of RegRand4 <gen>) facing (Random angle) degrees
            Else - Actions

The Random number triggers are found under Math - Random Number.

The Random Angle is just for fun.
09-15-2004, 10:59 PM#3
light_blade
it's best to make several small triggers if it's multiplayer, because internet lag can cause trouble for long triggers to run properly
09-15-2004, 11:02 PM#4
-={tWiStÄr}=-
or set 4 regions to spots in a region array. so reg1 = regarray[1], reg2 = regarray[2] etc.
then you have a trigger

create 1 (the unit) at regarray[random number between 1 & 4]
09-16-2004, 06:44 AM#5
Dead-Inside
Quote:
Originally Posted by light_blade
it's best to make several small triggers if it's multiplayer, because internet lag can cause trouble for long triggers to run properly

THAT'S not a long trigger. A long trigger is 15+ different random spawn locations.

You should also create the unit first, and then move "Last created unit" to one of the 4 spots, just like he said.

Quote:
Originally Posted by -={tWiStÄr}=-
or set 4 regions to spots in a region array. so reg1 = regarray[1], reg2 = regarray[2] etc.
then you have a trigger

create 1 (the unit) at regarray[random number between 1 & 4]

More effective, more complicated for newbies.
09-16-2004, 03:08 PM#6
logik
Quote:
Originally Posted by light_blade
it's best to make several small triggers if it's multiplayer, because internet lag can cause trouble for long triggers to run properly


thats stupid... having MORE triggers would cause more lag... If its in 1 trigger its more streamline and does everything in one go instead of doing each thing 1 at a time.
09-16-2004, 08:34 PM#7
Vexorian
Quote:
Originally Posted by logik
thats stupid... having MORE triggers would cause more lag... If its in 1 trigger its more streamline and does everything in one go instead of doing each thing 1 at a time.
Actually There isn't a big difference besides the fact that a lot of triggers take more memory
09-17-2004, 10:05 AM#8
Dead-Inside
Quote:
Originally Posted by Lord Vexorian
Actually There isn't a big difference besides the fact that a lot of triggers take more memory

If you plan on running one trigger and do everything or have one trigger pull a lot of triggers, wouldn't there be a performance loss? Apart from memory?
09-17-2004, 01:00 PM#9
-={tWiStÄr}=-
ok... with this small of a trigger, 10 triggers versus 1 tigger really will make such an unnoticeable difference
09-17-2004, 02:58 PM#10
Elthanor
thanx guys! all all of them helped! THanx again!
09-17-2004, 11:14 PM#11
Vexorian
Quote:
Originally Posted by Dead-Inside
If you plan on running one trigger and do everything or have one trigger pull a lot of triggers, wouldn't there be a performance loss? Apart from memory?
Actualyl I checked the trigger, and he should use a point array instead of the if then elses that are actually too few things to be a problem, the only danger there are the point leaks that can be easily fixed if he just uses a point array