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

[Trigger] Multiple Hero Campaign

Status
Not open for further replies.
Level 1
Joined
Oct 10, 2007
Messages
3
Looking for an example of either triggers or Jass to do a multiple hero campaign.
Have built one, but pretty buggy and seems to lose heros after third map. Looking to carry around 3 to 5 heros between 4 to 5 maps. could really use some help! Like i said either triggers or Jass would be fine! :thumbs_up:
 
Level 1
Joined
Oct 10, 2007
Messages
3
yes, I understand how to carry a single hero with a game cache, its when I carry 2 or more Hero's n a map that things start to unwind. Especially when loading hero"s into map three! If you could give me some help that would be great! Thx!
 
Level 5
Joined
Aug 16, 2007
Messages
149
Use arrays. The Save trigger should go like this:
  • Store Heroes
    • Events
      • Player - Player 1 (Red) leaves the game with a victory
    • Conditions
    • Actions
      • Game Cache - Create a game cache from MyCache.w3v
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Heroes[(Integer A)] Not equal to No unit
            • Then - Actions
              • Game Cache - Store Heroes[(Integer A)] as (Heroes_ + (String((Integer A)))) of Heroes in (Last created game cache)
            • Else - Actions
              • Do nothing
and the load trigger is:
  • Load Heroes
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Game Cache - Create a game cache from MyCache.w3v
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Game Cache - Restore (Heroes_ + (String((Integer A)))) of Heroes from (Last created game cache) for Player 1 (Red) at [WHEREVER YOU WANT IT TO START] facing 0.00
          • Set Heroes[(Integer A)] = (Last restored unit)
if you have more heroes than 10, make the loops go from 1 to [more than 10]. This requires just an array unit variable called Heroes.
Whenever you get a new hero, just set it to Heroes[next number] and my system will save and load it for you every time.
 
Level 1
Joined
Oct 10, 2007
Messages
3
thanks so much! completely makes sense now! thought thats the direction i needed to go, but was not sure of all the steps! thanks again!!!

Mad props and Rep to you+++++++
 
Status
Not open for further replies.
Top