• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Region: Random Point in Playable Map

Status
Not open for further replies.

Kenji.1484

K

Kenji.1484

Hi, it's me again! :hohum:

I was wondering if you could help me for this:

I want to make about 20 regions of Gold, where when a player walks in it, he picks up a set amount of gold. My problem is that I want each of these regions to be put in a random point of the playable map at the beginning of the game, so that you can never know when you find some.

I've tried with Variables, but so far, I can't figure out how to do this.

Please help me! :confused:

Thank you. :)
 

Kenji.1484

K

Kenji.1484

Okay, +Rep thanks. =) If anybody else has another idea, please post it. ^^

EDIT: I just thought of another thing:

I can just create an unselectable invisible unit instead of making regions. ^^
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
It's very easy like this:

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Region_Array[0] = Region 006 <gen>
      • Set Region_Array[1] = Region 005 <gen>
      • Set Region_Array[2] = Region 002 <gen>
      • Set Region_Array[3] = Region 004 <gen>
      • Set Region_Array[4] = Region 003 <gen>
  • Untitled Trigger 001
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 0 to 4, do (Actions)
        • Loop - Actions
          • Set Temp_Loc_1 = (Random point in (Playable map area))
          • Region - Center Region_Array[(Integer A)] on Temp_Loc_1
          • Unit - Create 1 Footman for Player 1 (Red) at (Center of Region_Array[(Integer A)]) facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Temp_Loc_1)
Don't mind the "create footman" line, it's just to test that it actually works. Note that the region might center on points that aren't accessible.
 
Level 9
Joined
Oct 22, 2006
Messages
599
You cannot create 20 regions at the beggining of the game, but you can Move 20 regions. So place 20 regions in the world editor (where you put them doesnt matter at all) and add the following trigger.

  • Random Regions
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Regions[0] = Region 000 <gen>
      • Set Regions[1] = Region 001 <gen>
      • Set Regions[2] = Region 002 <gen>
      • Set Regions[3] = Region 003 <gen>
      • Set Regions[4] = Region 004 <gen>
      • Set Regions[5] = Region 005 <gen>
      • -------- ...and so on... --------
      • Set Regions[19] = Region 019 <gen>
      • Set Regions[20] = Region 020 <gen>
      • For each (Integer A) from 0 to 20, do (Actions)
        • Loop - Actions
          • Set tmpPoint = (Random point in (Playable map area))
          • Region - Center Regions[(Integer A)] on tmpPoint
          • Custom script: call RemoveLocation(udg_tmpPoint)
There are 21 regions in this trigger (20 regions plus the region 0)

I don't recommend moving those regions in playble map, 'cause they might go somewhere where unit can't reach, so the region will be useless. It is possible to check if the unit can reach that region but that would be outside my knowledge boundaries. You'll have to ask further help for that matter (I suggest the Triggers & Scripts section).
 

Kenji.1484

K

Kenji.1484

Whoa thanks everyone!!! :D
+Rep to all, VergilThazaar, it says I have to spread some around before giving you rep again. ^^ I will +Rep you when I can.
 
Level 9
Joined
Oct 22, 2006
Messages
599
Whoa thanks everyone!!! :D
+Rep to all, VergilThazaar, it says I have to spread some around before giving you rep again. ^^ I will +Rep you when I can.

Ok! Good Luck!
If you are using MSN then I could help you directly (if you want) mostly for answering specific questions or helping you out. If you need a complete trigger, the best place to ask is here.
 
Status
Not open for further replies.
Top