Help with Trigger Expressions

ChaosChronicle

New Member
Reaction score
0
I'm looking to randomize a particular variable between different strings (so it returns one of the units I ask for). Problem is I don't know how the Expression part of a trigger works and I *think* it's what I need to use.
Basically I just want to do Set <Variable> to <X or Y or Z>
Is that possible?
 

hopy

Active Member
Reaction score
64
Basicly what you'll need to do is the following:
Add every "Option" to an array, and than choose a random array number. As an example, if you're supposed to choose a Marine, Zergling or Zealot, it'll require the following (don't have the editor open, so I'm doing this from my head - using W3 trigger knowlage):
Trigger:
  • Actions
    • Set RandomUnit[0] = Marine
    • Set RandomUnit[1] = Zergling
    • Set RandomUnit[2] = Zealot
    • Set RandomNumber = (Random Integer between 0 and 2)
    • Unit - Create 1 RandomUnit[RandomNumber] for (player 1) at Point facing (Standard facing direction)

Something like that.

RandomUnit is a Unit type array, RandomNumber is an Integer Variable. The random integer part is written a bit different in the actual trigger editor, like I said, I'm doing this from my head.
 

hopy

Active Member
Reaction score
64
Most welcome. :) Glad I could help someone in the SC2 section. Triggering is still pretty much the same though. :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top