• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Making the next map in a campaign dependent on the victor

Status
Not open for further replies.
Level 1
Joined
Dec 10, 2017
Messages
3
I have a question on how to set up some triggers. I am a programmer and know some basic programming, but I don’t know how to use JASS yet.

The idea: I have created a custom campaign with 5 levels: Northerend, undercity, West Plaugelands, East Plaugelands, and Quel’Thalas. I’ve created a copy of each one of these maps playable from the view of the Scourge, the Forsaken, the Legion, the Blood Elves, and the Scarlet Crusade.

What I want to happen: I have a multiboard that I want to update with every victory to show who controls each zone. I have the basics of this set up, however, I’m trying to use a game cache to update that value and carry it into the next map.

So basically, if player 2, the Forsaken, won the Undercity map: Then I want it to check if Undercity is controlled by Forsaken

If no, load the ForsakenUndercity map

If yes, Check if West Plaugelands is controlled by Forsaken

If no, load Forsaken West Plaugelands map

If yes, Check East Plaugelands

If no, load Forsaken East Plaugelands map

And so on and so forth


Can anybody help me with this? This campaign is really just for my own benefit, I don’t plan on publishing it. I’m just trying to make the Multiboard update and I’m trying to figure out how to create a trigger in the editor similar to what I wrote above.

Thank you in advance for any help you can give me. Here is my code so far. I am sure there is a lot missing.

Capture1.JPG
Capture2.JPG
 
Level 14
Joined
Aug 30, 2004
Messages
909
That sounds like a really cool idea. I'm a bit confused by what you're asking, and I'm not sure I can help, but I"ll try. Are you asking:

1. How do I know who owns this map?

or

2. How do I transition to the right map?

or

3. How do I make the multiboard display properly?
 
Level 1
Joined
Dec 10, 2017
Messages
3
Sorry for the confusion. There are two parts to my question.

I want to know how to make a trigger that will check who is the current "owner" of each of the maps. (This would also be displayed in the multiboard. For example, if the Scarlet Crusade wins the Northerend map, then they would "own" Northerend). When a player wins a game, This trigger would then check and see which maps the winning player already owns. It would loop through the maps until it finds one that the winning player does not own, and then would load it. It is kind of like the board game risk, and the end goal of the campaign is for one of the factions to own all the territories.

Second, I am trying to figure out how to update the multiboard so that it shows which players currently "own" each territory.

Does that make any more sense?

Thank you for offering to help me out. I appreciate it.
 
Level 20
Joined
Feb 23, 2014
Messages
1,264
So, the first issue is randomly selecting a map that isn't owned by the player? Here's how I would go about doing it:

The basic idea is to create an integer variable for each map. This variable will hold the number of the player that controls it. Once you beat the current map, you can easily import them from game cache and compare to the number of the player that won the current map. If they are the same, it means that both areas are controlled by the same player, i.e. the map is not eligible for loading.

1. Create these variables:

- MapOwnerNumber[Index] = Integer Variable Array, with "Index" ranging from 0 to X, where X is the total number of available zones. The initial values should be set to player numbers of players that start with the corresponding zone controlled.
- IndexInteger = Integer Variable

2. Once a map is started, granted it isn't the first map to be played, I would load the values from Game Cache:

  • For each (Integer IndexInteger) from 1 to X, do (Actions)
    • Loop - Actions
      • Set MapOwnerNumber[IndexInteger] = (Load (MON + (String(IndexInteger))) of MapOwnerNumbers from GameCacheVariable)
Where:

- X (in "from 1 to X" part) = total amount of rows in the multiboard = total amount of zones available.
- MON = just a string I used as a first part of a Label's name, you can set it to whatever as long as it corresponds to an appropriate Label in Game Cache.
- MapOwnerNumbers = just a string I used as a Category's name, you can set it to whatever as long as it corresponds to an appropriate Category in Game Cache.
- GameCacheVariable = your Game Cache Variable

Functions within "Set Variable" action:

- "Game Cache - Load Integer Value"
- "Concatenate Strings" - used to create an equation with strings.
- "Conversion - Convert Integer to String" with IndexInteger set as the integer to be converted.

How it should work:

- Functions should add MON and the converted integer together, creating strings like MON1, MON2, MON3, etc.
- This is how what the saved integer values should be labeled as in your Game Cache.
- I haven't tested this - if it doesn't work, load each integer manually.

3. I don't know how you want to determine whether a player has gained control over the map/area, so I cannot write you a trigger for that, but once you do determine that, put this at the end of that trigger:

  • Set PlayerVariable = Player Y (Color)
  • Set MapOwnerNumber[Z] = (Player number of PlayerVariable)
  • For each (Integer IndexInteger) from 1 to X, do (Actions)
    • Loop - Actions
      • Game Cache - Store MapOwnerNumber[IndexInteger] as (MON + (String(IndexInteger)) of MapOwnerNumbers in GameCacheVariable
  • Trigger - Run Next Chapter Selection <gen> (checking conditions)
Where:

- Z (as MapOwnerNumber index) = the number corresponding to a currently played map.
- PlayerVariable = Player Variable, set its value to the player that has gained control over the currently played map/area [i.e. Player X (Color)].
- Next Chapter Selection = next trigger that I'm about to post, that's the one that selects a chapter to play next.

4. Run something like this - i.e. Next Chapter Selection trigger:

  • Set PlayerVictorious = True
  • For each (Integer IndexInteger) from 1 to X, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MapOwnerNumber[IndexInteger] Not Equal to MapOwnerNumber[Z]
        • Then - Actions
          • Set PlayerVictorious = False
        • Else - Actions
          • -------- do nothing --------
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • PlayerVictorious = False
    • Then - Actions
      • -------- do nothing --------
    • Else - Actions
      • -------- any other actionss you want to happen before giving the victory to the player that won curent map --------
      • Game - Victory (Player(MapOwnerNumber[Z])) (Show dialogs, Show scores)
      • Skip remaining actions
  • Set CheckingOrder = (Random integer number between 1 and IndexInteger)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • MapOwnerNumber[CheckingOrder] Equal to MapOwnerNumber[Z]
    • Then - Actions
      • Trigger - Run (This trigger) (checking conditions)
    • Else - Actions
      • Game - Set the next level to (Maps\Map + ((String(CheckingOrder)) + .w3x))
      • -------- any other functions you want to happen before loading the next map --------
      • Game - Victory (Player(MapOwnerNumber[Z])) (Show dialogs, Show scores)
Where:

- "PlayerVictorious" - Boolean Variable
- "CheckingOrder" - Integer Variable

Functions:

- "Conversion - Convert Player Index to Player" - used in this part: "(Player(MapOwnerNumber[Z]))" with MapOwnerNumber[Z] as the index.

Things to note:
- In the example above, the map path will look like this: "Maps\Map2.w3x", "Maps\Map3.w3x" as it should be generated by this code: "(Maps\Map + ((String(CheckingOrder)) + .w3x))". This is actually the addition of three separate strings.

How this should work:

- First it sets "PlayerVictorious" as True
- If all maps are controlled by the same player as the one who won the currently played one, this player will get the victory.
- If at least one other map is not controlled by the same player, it will randomly select a map to check.
- If that map is also controlled by the same player, the trigger will run itself again.
- If not, it will set the next map to the corresponding map.

Honestly, it's a bit late here and I have to go to bed, so I really don't have any idea if this will even work. You might want to try it out, though.

If it doesn't work and you don't care about a random map being selected, you might just want to run through the maps individually through the "If/Then/Else" cascade with "Skip Remaining Actions". Something like this basically:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • MapOwnerNumber[1] Equal to MapOwnerNumber[Z]
    • Then - Actions
      • -------- do nothing --------
    • Else - Actions
      • Game - Set the next level to (Maps\Map1.w3x))
      • -------- any other functions you want to happen before loading the next map --------
      • Game - Victory (Player(MapOwnerNumber[Z])) (Show dialogs, Show scores)
      • Skip remaining actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • MapOwnerNumber[2] Equal to MapOwnerNumber[Z]
    • Then - Actions
      • -------- do nothing --------
    • Else - Actions
      • Game - Set the next level to (Maps\Map2.w3x))
      • -------- any other functions you want to happen before loading the next map --------
      • Game - Victory (Player(MapOwnerNumber[Z])) (Show dialogs, Show scores)
      • Skip remaining actions
  • etc.
---

As for the Multiboard thing.

I'd create a multiboard that in Column 1 lists all the available zones and in column 2 displays the name of the player that has control over that zone. Column 1 doesn't change, but all string values have to be manually inserted. Column 2 values change and are directly determined by this set of actions:

  • For each (Integer IndexInteger) from 1 to X, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MapOwnerNumber[IndexInteger] Equal to 0
        • Then - Actions
          • Multiboard - Set the text for MultiboardVariable item in column 2, row IndexInteger to No Owner
        • Else - Actions
          • Multiboard - Set the text for MultiboardVariable item in column 2, row IndexInteger to (Name of (Player(MapOwnerNumber[IndexInteger])))
Explanations:

- X (in "from 1 to X" part) = total amount of rows in the multiboard = total amount of zones available
- MapOwnerNumber[IndexInteger] = Integer Variable Array, the values for each variable in the array have to be imported from the Game Cache as in the example above.
- IndexInteger = Integer Variable
- MultiboardVariable = Multiboard Variable

To get to the last part of the final action, use functions:

- "Player - Player Name" and then
- "Conversion - Convert Player Index to Player" and then
- set "MapOwnerNumber[IndexInteger] as the index number for that function

On the contrary to the map selection triggers, I've tested this one and it works.
 
Last edited:
Level 1
Joined
Dec 10, 2017
Messages
3
Thank you very much! I will give this a shot and see if I can't get it to work. I really appreciate you taking the time to reply, to create those triggers yourself and to add pictures as well.
 
Level 20
Joined
Feb 23, 2014
Messages
1,264
Hey, the multiboard thing should work, not really sure if the mission changing one will, though if it doesn't just shoot me a PM and we'll try to figure something out.

Also, the concept of your campaign sounds really intruiging and I think you should definetely consider publishing it once you're done :)
 
Status
Not open for further replies.
Top