• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] interesting trigger

Status
Not open for further replies.
Level 3
Joined
May 12, 2012
Messages
59
im trying to set up a few regions to act as second stage starting areas. by which i mean:

In the map im working on you purchase your starting species, after which you get transported to a random region to build your base without forcing you to walk your character to a starting area. Ive mad a blank map and added the triggers to the map so theres no confusion as to what needs done. ill just copy the fix over and modify it to work in the map itself. if you could make the trigger initially work ill do the rest

I have only three units that need to be moved to locations and 12 regions to move them to so id like it to avoid doing them in order of the variable, forgive me if i rant for i work the night shift and have been up total for 18 hours... yaaaaay

below are the triggers, i added one out of the four of the test map as theyre pretty much identical so you can see it first then hopefully fix it:

  • Untitled Trigger 001
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • Set region_count = (region_count + 1)
      • Set Region[region_count] = Region 000 <gen>
  • Untitled Trigger 005
    • Events
      • Unit - A unit enters spot <gen>
    • Conditions
    • Actions
      • Unit - Move (Entering unit) instantly to (Center of Region[(Random integer number between 0 and region_count)])
      • Set region_count = (region_count - 1)
Ive also included the map so you can tweak it.
Thank you everyone for your help in this problem. its much appriciated
 

Attachments

  • Start Location Test.w3x
    17.2 KB · Views: 35
Aaaaaaargh please give your triggers names!

I provided a similar fix in a thread a few weeks ago, let me see if I can find it.

EDIT: Can't find it.

What you need to do, in your Untitled Trigger 005, is set an integer variable (let's call it ChosenRegionId) to a random number between 0 and the total number of regions (you'll need another integer variable [let's call it TotalRegions] to keep track of the total number of regions).
You then move the entering unit to Region[ChosenRegionId]. Up until now the function is the same as in your trigger.
Next, you need to reorganise the list of regions. What your current trigger is doing is removing the last region in the list, regardless of which one was chosen.
What you need to do is this:
  • For each (Integer A) from ChosenRegionId to region_count, do (Actions)
    • Loop - Actions
      • Set Region[(Integer A)] = Region[((Integer A) + 1)]
What it does is it takes all regions after the chosen region ID, and writes each one over the region before it.

So e.g. if you have
Region[0] = Region A
Region[1] = Region B
Region[2] = Region C
Region[3] = Region D
and region B (id 1) is picked,
Region[1] will be set to Region C (Region[1+1]),
Region[2] will be set to Region D (Region[2+1])
and the total number will come down to 2.
 
Level 3
Joined
May 12, 2012
Messages
59
lol

dude i know... but in my defense its just a test map thingy... its ENTIRELY blank except for thoes... i didnt want to add the 150+ triggers to it so i just copied and pasted them to a new one.
 
Level 3
Joined
May 12, 2012
Messages
59
damn

its still crapping out on me, sending them to the same positions or at the center of the playable map area, dont suppose you have any other ideas?
 
Level 3
Joined
May 12, 2012
Messages
59
here ya go

i attached the map file, and no i did not name the triggers; i just dont see the point of actually naming them when theyre getting named and tweaked for the actual map when its done, sorry buddy
 

Attachments

  • Start Location Test.w3x
    17.2 KB · Views: 37
Level 3
Joined
May 12, 2012
Messages
59
still havent solved it

to anyone checking back now and again, i still havent solved the issue. im still getting help on it but anyone with a much simpler solution or a solution in general would be appriciated, solving this would make for a much more balanced game play for one of the species i have set up.
 
Level 12
Joined
Oct 16, 2010
Messages
680
  • blabla
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Set Region[1] = Region 000 <gen>
      • Set Region[2] = Region 001 <gen>
      • Set Region[3] = Region 002 <gen>
      • Set Region[4] = Region 003 <gen>
      • Set Region[5] = Region 004 <gen>
      • Set Region[6] = Region 005 <gen>
      • Set Region[7] = Region 006 <gen>
      • Set Region[8] = Region 007 <gen>
      • Set Region[9] = Region 008 <gen>
      • Set Region[10] = Region 009 <gen>
      • Set Region[11] = Region 0010 <gen>
      • Set Region[12] = Region 0011 <gen>
      • Set region_count = 12
  • blabla2
    • Events
      • Unit - A unit enters spot <gen>
    • Conditions
    • Actions
      • Set random_int = (Random integer number between 1 and region_count)
      • Unit - Move (Triggering Unit) instantly to (Center of Region[random_int])
      • Set Region[random_int] = Region[region_count]
      • Set region_count = (region_count - 1)
this is a better way for clearing the randomed Regions

instead of pushing all the regions back, it puts the last in the choused region's place

I don't have WE ATM, but maybe this could help
 
Status
Not open for further replies.
Top