Page 1 of 1

Random Event

Posted: Fri Nov 09, 2018 10:17 pm
by j3rry
Hello.

I need a help.
Can I force random event in a ruleset? I am trying to make spawn of some random units. It could be 10 Grunts, 6 Machinegunners or 2 Half-tracks for example. So I need to know the way of making random spawns.

Here is the code:

Code: Select all

SpawnObjects()
    {
      Formation("Box");
      Direction(0);
      Region("@.engine.name");
      AddType("army.unit.grunt");
      AddType("army.unit.machinegunner");
      AddType("army.unit.halftrack");
    }

Re: Random Event

Posted: Fri Nov 09, 2018 10:50 pm
by TommyCD1
In order to have a random event occur, you'd need to use the random objective action.

Normally you'd use this to call a new objective:

Code: Select all

    NewObjective("objective_example1");
        NewObjective("objective_example2");
            NewObjective("objective_example3");
However, you'd should rather use this to choose randomly between objectives:

Code: Select all

    NewRandomObjective()
    {
      Add("objective_example1", 30);
      Add("objective_example2", 10);
      Add("objective_example3", 60);
    }
You should add each new objective you want to be pooled for random selection, with the numbers on the right being each objectives weight which should ideally add up to 100.

Although keep in mind that when doing this, Army Men RTS does not use true randomness, and you may be able to discern a pattern after enough play time.

Re: Random Event

Posted: Fri Nov 09, 2018 11:08 pm
by j3rry
Thank you.

I will keep that in mind.