• 🏆 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!

risk game

Status
Not open for further replies.
Level 19
Joined
May 1, 2008
Messages
1,130
i was thinking of this risk game:
the map is divided in "imaginary provinces" (a rect) and every province has a main city with circles around it (slots) that can be upgraded to buildings. Also the province has some slots of its own that can be upgraded to say mines, farms etc.

so its like you can't upgrade a slot to say blacksmith if you don't have a mine slot already upgraded
this could be done with techtree requirements but that way it will work for every province in witch i have a city even if i don't have a mine slot upgraded in that city. So when i make a mine it should be ''available" only inside that province

how can i do this?
 
Check if that upgrade has taken place in the specific region (equals to "city") and if yes, then set it in a unit variable, with arrays.

E.g.

  • Map Initialization
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Set Region[1] = <Your region 0001 <gen>>
    • Set Region[2] = ..
  • Events
    • Unit - A unit finishes an upgrade
  • Conditions
  • Actions
    • Set Point1 = (Position of (Triggering unit))
    • For each (Integer A) from 1 to X, do (Actions)
      • Loop - Actions
        • If/ Then/ Else
          • If (Conditions)
            • (Region[IntegerA] contains (Point1)) Equal to True
          • Then (Actions)
            • Set Unit1 = (Triggering unit)
          • Else (Actions)
    • Custom script: call RemoveLocation (udg_Point1)
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
When an upgrade is made, set Province1[Slot] to the building's ID number that's being build there (the result of an upgrade). At this point the name might be confusing, because it represents the slot number, not the province. But after this, it will make sense. This way, you can check the slots per Province with the Integer A function.
As I said, you need to make an ID for all your buildings. This ID is just an imaginary as if it was a dummy ID. You best write down the IDs and the buildings they represent in the trigger comments, so you can easily look them up. If you want to check if a building has been build, just search for your building's ID with Province1[Integer A] with an Integer A between 1 and your amount of slots.

Nothing beats back to the basics! :cgrin:
 
Status
Not open for further replies.
Top