• 🏆 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] Need help.. trigger for campaign

Status
Not open for further replies.
Level 11
Joined
Sep 12, 2008
Messages
657
The triggers basicly save a game cache when you write -save, then when you write -load it loads it.. for some reason i cant make it work if i leave game, then i load..
if im wrong at the trigger, or it shouldn't be used as game cache, please say me =]

(single player campaign)

load trigger

  • Load
    • Events
      • Player - Player 1 (Red) types a chat message containing -load as An exact match
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
      • Unit - Create 1 Paladin for Player 1 (Red) at (Center of Region 000 <gen>) facing Default building facing degrees
      • Hero - Set (Last created unit) Hero-level to (Load Level of Save from SaveCache), Hide level-up graphics
      • Hero - Set (Last created unit) experience to (Load Exp of Save from SaveCache), Hide level-up graphics
      • Hero - Modify Strength of (Last created unit): Set to (Load Str of Save from SaveCache)
      • Hero - Modify Agility of (Last created unit): Set to (Load Agi of Save from SaveCache)
      • Hero - Modify Intelligence of (Last created unit): Set to (Load Int of Save from SaveCache)
save trigger

  • Save
    • Events
      • Player - Player 1 (Red) types a chat message containing -save as An exact match
    • Conditions
    • Actions
      • Game Cache - Create a game cache from MapName.w3v
      • Set SaveCache = (Last created game cache)
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Set HeroType = (String((Unit-type of (Picked unit))))
          • Game Cache - Store HeroType as Hero of Save in SaveCache
          • Game Cache - Store (Hero level of (Picked unit)) as Level of Save in SaveCache
          • Game Cache - Store (Hero experience of (Picked unit)) as Exp of Save in SaveCache
          • Game Cache - Store (Strength of (Picked unit) (Exclude bonuses)) as Str of Save in SaveCache
          • Game Cache - Store (Agility of (Picked unit) (Exclude bonuses)) as Agi of Save in SaveCache
          • Game Cache - Store (Intelligence of (Picked unit) (Exclude bonuses)) as Int of Save in SaveCache
      • Game Cache - Save SaveCache
just a test trigger to add str...

  • Test
    • Events
      • Player - Player 1 (Red) types a chat message containing Str as A substring
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Hero - Modify Strength of (Picked unit): Add (Integer((Substring((Entered chat string), 4, 9))))
Thanks in advance..
 
Level 11
Joined
Sep 12, 2008
Messages
657
Yeah.. the leaks i dont care.. this was just a tryout.. (trying to make another 1 after i understend how it works, or else i would remove all units in game :p)

Edit:

Something is odd in we..

in "Game Cache - Store Real"

and everything else, store trigger, or such, it says:

"Use the 'game cache - load real value' function to load this value from a cache."

but i dont have the 'game cache - load real value' function..

only got store 1.. hope some 1 can help me ;p

Edit2: Ah.. nvm about edit 1 ^^
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
EDIT: Whoops.

  • Save
  • Events
    • Conditions
    • Actions
      • Game Cache - Create a game cache from mapname.w3v
      • Game Cache - Store Hero1 as somestring of Heroes in (Last created game cache) // Hero1 is the unit stored to a variable.
      • Game Cache - Save (Last created game cache)
  • Restore
    • Events
    • Conditions
    • Actions
      • Game Cache - Create a game cache from mapname.w3v
      • Game Cache - Restore somestring of Heroes from (Last created game cache) for Player 1 (Red) at (Center of somelocation <gen>) facing 270.00
      • Set Hero1 = (Last restored unit)
 
Level 9
Joined
Jun 7, 2007
Messages
195
Could the...

Pick Every unit in playable map area
Save X as Y to SaveCache
. . .

...pick other units than your hero and cause problems that way.
I mean it could crash WC3 if you try to read the STR of a non-hero unit.


Change this:
  • Hero - Modify Strength of (Picked unit): Add (Integer((Substring((Entered chat string), 4, 9))))

To this:
  • Hero - Modify Strength of (Picked unit): Add (Integer((Substring((Entered chat string), 4, (Length of (Entered chat string))))))
 
Status
Not open for further replies.
Top