Game Cache

salem

New Member
Reaction score
3
Just want to know if there's a way to save and load strings using the game cache in multiplayer maps?

For example if i host a map and store the string "Test 1" and save the game cache. If i host the map again some other time, will i be able to load the string i saved before ("Test 1")?

Apparantly, it works perfectly for singleplayer maps, but when i host the map in multiplayer mode, it suddenly stops working...

I searched the forums for "store string" found many things, most include jass coding which i know nothing about. Everything that i found however had to do with storing units, but i need something much simpler, i just want to store strings.
 

SFilip

Gone but not forgotten
Reaction score
634
lets just say that one map cannot use the same cache twice in multiplayer...as far as i know that is.
 

Lobster

Old Fogey ofthe site
Reaction score
90
They are called save/load codes, just type in save and you wil see some posts on it.
 

salem

New Member
Reaction score
3
Lobster said:
They are called save/load codes, just type in save and you wil see some posts on it.

i looked over these as well, but they are all about saving/loading heroes or units. And I'm not exactly sure how they work, but i don't think that they load your hero from nothing.

Like from what i understood without spending a good 20 min reading the whole thing, the save/load codes will simply give you a code to use so you can load your hero with all his items. The code describes your hero and the items he has so that when you enter the code in the next game, you think that you "loaded" the hero but you actually made one with exactly the same items/proprieties of the hero you saved.

anyhow back on the subject. The triggers that i have work perfectly in singleplayer maps, and i know that they do not work in multiplayer maps, so i just wanted to know if there's a way around it.
 

SFilip

Gone but not forgotten
Reaction score
634
the only way to do something like that is, as mentioned, using load/save codes.
i dont see what is wrong with creating the unit again...yet the problem is to create a good save/load system but when you do its all ok.
 

salem

New Member
Reaction score
3
SFilip said:
the only way to do something like that is, as mentioned, using load/save codes.
i dont see what is wrong with creating the unit again...yet the problem is to create a good save/load system but when you do its all ok.

nono, i don't want to save or load units. i just want to save and load strings, texts.
 

SFilip

Gone but not forgotten
Reaction score
634
oh...that makes it simple at least.
you encrypt strings easily and turn them intro integers for example this way:
a=2
b=4
c=6
etc.
pretty complex though so you might aswell post what you need exactly.
 

salem

New Member
Reaction score
3
okay, well i'm trying to make an auto suggestion system, where the players are able to leave their comments simply by typing a chat command:
for example, "-suggest" is the chat command that triggers the system "-suggest I really like this map, however i think that you should..."
So what i did after is, i stored what the players said using the chat command in a quest tab so i can view it easily.

In singleplayer everything works perfectly, the strings and can be easily stored and loaded so you would have a list of comments left by all the players who used the "-suggest" function.

In multiplayer... you can't load anything from game cach.
I've found a way to counter it, but it ain't that pretty... Now sinse the whole point of my system is to give players an easy way to send me feedbacks, knowing that most of them will not bother going to a website or sending an email, my system will allow the player to leave a comment in-game and view the comments of others.

So what i've done to counter this multiplayer malfuntion of game cache is, after the end of each game, i would save the game, i would then load it and view the comments that the players left which are stored in a quest tab "F9".

Here's a copy of the triggers i used (not sure if these would help or not).


This is what controls the "-suggest" command.
Code:
Enter Suggestion
    Events
        Player - Player 1 (Red) types a chat message containing -suggest as A substring
        Player - Player 2 (Blue) types a chat message containing -suggest as A substring
        Player - Player 3 (Teal) types a chat message containing -suggest as A substring
        Player - Player 4 (Purple) types a chat message containing -suggest as A substring
        Player - Player 5 (Yellow) types a chat message containing -suggest as A substring
        Player - Player 6 (Orange) types a chat message containing -suggest as A substring
        Player - Player 7 (Green) types a chat message containing -suggest as A substring
        Player - Player 8 (Pink) types a chat message containing -suggest as A substring
        Player - Player 9 (Gray) types a chat message containing -suggest as A substring
        Player - Player 10 (Light Blue) types a chat message containing -suggest as A substring
        Player - Player 11 (Dark Green) types a chat message containing -suggest as A substring
        Player - Player 12 (Brown) types a chat message containing -suggest as A substring
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Length of (Entered chat string)) Greater than or equal to 30
            Then - Actions
                Trigger - Run Check quest description length <gen> (checking conditions)
                Game Cache - Store (Player_Color[(Player number of (Triggering player))] + (  + (Entered chat string))) as Comment of Suggestions in Cache
                Game - Display to (Player group((Triggering player))) the text: (Thank's for your comment: " + ((Entered chat string) + ".))
                Set Suggestions_quest_description[Suggestions_quest_number] = (Suggestions_quest_description[Suggestions_quest_number] + (  + (Load Comment of Suggestions from Cache)))
                Game Cache - Store Suggestions_quest_description[Suggestions_quest_number] as (Comment + (String(Suggestions_quest_number))) of Suggestions in Cache
                Game Cache - Save Cache
                Quest - Change the description of Suggestions_quest[Suggestions_quest_number] to Suggestions_quest_description[Suggestions_quest_number]
                Quest - Flash the quest dialog button
            Else - Actions
                Game - Display to (Player group((Triggering player))) the text: Minimum suggestion ...


Since i'm storing all the suggestions in a quest tab, and the quest tabs have limited space, I need to verify that the quest tab is not full or the game would crash when i try to store more strings in it. If the quest tab is full, this trigger will make a new one and give it a different number.
Code:
Check quest description length
    Events
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Length of Suggestions_quest_description[Suggestions_quest_number]) Greater than or equal to 1827
            Then - Actions
                Set Suggestions_quest_number = (Suggestions_quest_number + 1)
                Game Cache - Store Suggestions_quest_number as quest_number of Suggestions in Cache
                Game Cache - Save (Last created game cache)
                Quest - Create a Optional quest titled (Suggestions ( + ((String(Suggestions_quest_number)) + ))) with the description Suggestions_quest_description[Suggestions_quest_number], using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
                Set Suggestions_quest[Suggestions_quest_number] = (Last created quest)
            Else - Actions


This creates the Game Cach and loads the important variable that all game cache variables depend upon "Suggestions_quest_number".
Code:
Create and load Game Cach
    Events
        Map initialization
    Conditions
    Actions
        Game Cache - Create a game cache from Footman.w3v
        Set Cache = (Last created game cache)
        Set Suggestions_quest_number = (Load quest_number of Suggestions from Cache)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Suggestions_quest_number Equal to 0
            Then - Actions
                Set Suggestions_quest_number = 1
            Else - Actions
        For each (Integer A) from 1 to Suggestions_quest_number, do (Actions)
            Loop - Actions
                Set Suggestions_quest_description[(Integer A)] = (Load (Comment + (String((Integer A)))) of Suggestions from Cache)
        Game Cache - Save Cache


This will allow me to clear the game cache
Code:
Clear Cache
    Events
        Player - Player 1 (Red) types a chat message containing -clear as A substring
    Conditions
        Or - Any (Conditions) are true
            Conditions
                (Name of (Triggering player)) Equal to namegoeshere
               
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Entered chat string) Equal to -clear suggestions
            Then - Actions
                Game Cache - Clear all labels of Suggestions in Cache
                Game Cache - Save Cache
                Game - Display to (Player group((Triggering player))) the text: Cache "Suggestions"...
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Entered chat string) Equal to -clear cache
            Then - Actions
                Game Cache - Clear Cache
                Game Cache - Save Cache
                Game - Display to (Player group((Triggering player))) the text: Cache cleared.
            Else - Actions


And this is where i create the quests at the beginning of the map
Code:
Quest
    Events
        Time - Elapsed game time is 3.00 seconds
    Conditions
    Actions
        Quest - Create a Optional quest titled Votes with the description At the start of the..., using icon path ReplaceableTextures\WorldEditUI\DoodadPlaceholder.blp
        Quest - Create a Optional quest titled Units 1 with the description ----------Orcs:  Le..., using icon path ReplaceableTextures\WorldEditUI\Editor-Random-Unit.blp
        Quest - Create a Optional quest titled Units 2 with the description ----------Undead:  ..., using icon path ReplaceableTextures\WorldEditUI\Editor-Random-Unit.blp
        Quest - Create a Required quest titled Comments with the description To leave a comment,..., using icon path ReplaceableTextures\WorldEditUI\Editor-Random-Building.blp
        Quest - Create a Optional quest titled Advanced Features with the description The Shade unit, loc..., using icon path ReplaceableTextures\WorldEditUI\Editor-MultipleUnits.blp
        Quest - Create a Optional quest titled King of The Hill with the description KOTH stands for Kin..., using icon path ReplaceableTextures\WorldEditUI\Editor-MultipleUnits.blp
        Quest - Create a Required quest titled Heroes & Bounty with the description A hero's normal bou..., using icon path UI\MiniMap\MinimapIcon\MinimapIconGold.blp
        Quest - Create a Required quest titled Changes Beta3c with the description -------- Changes in..., using icon path ReplaceableTextures\CommandButtons\BTNAcorn.blp
        Quest - Create a Required quest titled Changes Beta3d with the description ------ Changes in B..., using icon path ReplaceableTextures\CommandButtons\BTNAcorn.blp
        Quest - Create a Required quest titled Changes v1.00 with the description -------- Changes in..., using icon path ReplaceableTextures\CommandButtons\BTNAcorn.blp
        Quest - Create a Required quest titled Changes v1.01 with the description -------- Changes in..., using icon path ReplaceableTextures\CommandButtons\BTNAcorn.blp
        Quest - Create a Required quest titled Changes v1.02 with the description -------- Changes in..., using icon path ReplaceableTextures\CommandButtons\BTNAcorn.blp
        Quest - Create a Required quest titled Changes v1.02a with the description -------- Changes in..., using icon path ReplaceableTextures\CommandButtons\BTNAcorn.blp
        Quest - Create a Required quest titled Changes v1.02b with the description -------- Changes in..., using icon path ReplaceableTextures\CommandButtons\BTNAcorn.blp
        Quest - Create a Required quest titled Changes v1.02c with the description -------- Changes in..., using icon path ReplaceableTextures\CommandButtons\BTNAcorn.blp
        Quest - Create a Required quest titled Changes v1.03 with the description -------- Changes in..., using icon path ReplaceableTextures\CommandButtons\BTNAcorn.blp
        Quest - Create a Required quest titled Changes v1.03b with the description -------- Changes in..., using icon path ReplaceableTextures\CommandButtons\BTNAcorn.blp
        Quest - Create a Required quest titled Changes v1.04 with the description -------- Changes in..., using icon path ReplaceableTextures\CommandButtons\BTNAcorn.blp
        For each (Integer A) from 1 to Suggestions_quest_number, do (Actions)
            Loop - Actions
                Quest - Create a Optional quest titled (Suggestions ( + ((String((Integer A))) + ))) with the description Suggestions_quest_description[(Integer A)], using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
                Set Suggestions_quest[(Integer A)] = (Last created quest)
        Quest - Flash the quest dialog button
 

salem

New Member
Reaction score
3
bumping this.
You don't need to find a solution, i just want to know if it is possible or not to know if i should keep the effort up or stop wasting my time.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top