HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Is there a way to make a custom save trigger?

07-12-2007, 01:52 AM#1
Callahan
Hi experienced jassers.I making a map etc...and when my hero acquire a save spot it activate a dialog menu where it ask if you want to save your progression as see in the picture below :
Zoom (requires log in)

I've made a jass trigger when you click the "Save" button but it don't work :

Collapse JASS:
//===========================================================================
// Trigger: Save Yes
//===========================================================================
function Trig_Save_Yes_Func001C takes nothing returns boolean
    if ( not ( GetClickedButtonBJ() == udg_SaveMenu_yes ) ) then
        return false
    endif
    return true
endfunction

function Trig_Save_Yes_Actions takes nothing returns nothing
    if ( Trig_Save_Yes_Func001C() ) then
        call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_1910" )
        call SaveGame( "WoGAutosave.w3z" )
        else
    endif
    call DialogDisplayBJ( false, udg_SaveMenu, Player(0) )
endfunction

//===========================================================================
function InitTrig_Save_Yes takes nothing returns nothing
    set gg_trg_Save_Yes = CreateTrigger(  )
    call TriggerRegisterDialogEventBJ( gg_trg_Save_Yes, udg_SaveMenu )
    call TriggerAddAction( gg_trg_Save_Yes, function Trig_Save_Yes_Actions )
endfunction

//===========================================================================

I think it's the
Collapse JASS:
call SaveGame( "WoGAutosave.w3z" )
that doesn't work.
And it doesn't even display the text message.
But did you know another way to make it or it's simply impossible?

Btw i know what you wonder "Why not using the F10 menu and save?"
And 'ill answer because when you play a campaign you usualy forgot to save your progression.And player don't know when they will meet a "BOSS elite level 100" so there is save spot to make the player save before being pwnd.
Attached Images
File type: jpgCustom save.jpg (60.1 KB)
07-12-2007, 02:38 AM#2
TheSecretArts
as far as im aware, this kinda stuff doesnt work in Multiplayer... game caches dont work, im im pretty sure save games wont work with multiple players whatsoever.
Edit: If this is Single Player, then are u sure that all buttons are set, load your functions tto the brim with debug messeges
07-12-2007, 12:47 PM#3
Callahan
This is singleplayer.
And no the cancel button isn't set but i just want it it do nothing so i didn't think i have to trigger it.
But i think they are set here the trigger :
SaveMenu=Dialog variable
SaveMenu_yes=Dialog button variable
SaveMenu_cancel=Dialog button variable
Trigger:
Save init
Collapse Events
Time - Elapsed game time is 5.00 seconds
Conditions
Collapse Actions
Dialog - Change the title of SaveMenu to Do you want to save...
Dialog - Create a dialog button for SaveMenu labelled Save
Dialog - Create a dialog button for SaveMenu labelled Cancel
So the save menu is set at the begining of the game.

Save0095,0096,0097 are save spot they are unit.
Trigger:
Save
Collapse Events
Unit - A unit comes within 50.00 of Save 0095 <gen>
Unit - A unit comes within 50.00 of Save 0096 <gen>
Unit - A unit comes within 50.00 of Save 0097 <gen>
Collapse Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
(Triggering unit) Equal to Hero[1]
(Triggering unit) Equal to Hero[2]
(Triggering unit) Equal to Hero[3]
Collapse Actions
Dialog - Show SaveMenu for Player 1 (Red)
So now when a unit come to a save spot it show the dialog menu.

Trigger:
Save Yes
Collapse Events
Dialog - A dialog button is clicked for SaveMenu
Conditions
Collapse Actions
If ((Clicked dialog button) Equal to SaveMenu_cancel) then do (Dialog - Hide SaveMenu for Player 1 (Red)) else do (Do nothing)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Clicked dialog button) Equal to SaveMenu_yes
Collapse Then - Actions
Custom script: call SaveGame( "WoGAutosave.w3z" )
Game - Display to (All players) the text: |cff00ff00Game save...
Dialog - Hide SaveMenu for Player 1 (Red)
Collapse Else - Actions
Do nothing
And here what happen when u click a button.
Is there anything wrong?
07-12-2007, 01:27 PM#4
Fireeye
Callahan, you didn't set the save button to the variable, also you don't need any variable for the cancel button, just leave it blank.
Also i'm pretty sure you don't have to hide the dialog afterwards, because it will be automatically hidden when a button is clicked. (At least when i click a button)
Trigger

Trigger:
Save init
Collapse Events
Time - Elapsed game time is 5.00 seconds
Conditions
Collapse Actions
Dialog - Change the title of SaveMenu to Do you want to save...
Dialog - Create a dialog button for SaveMenu labelled Save
Set WantToSave = (Last created dialog Button)
Dialog - Create a dialog button for SaveMenu labelled Cancel
Trigger:
Save Call
Collapse Events
Unit - A unit comes within 50.00 of Save 0095 <gen>
Unit - A unit comes within 50.00 of Save 0096 <gen>
Unit - A unit comes within 50.00 of Save 0097 <gen>
Collapse Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
(Triggering unit) Equal to Hero[1]
(Triggering unit) Equal to Hero[2]
(Triggering unit) Equal to Hero[3]
Collapse Actions
Dialog - Show SaveMenu for Player 1 (Red)
Trigger:
Save
Collapse Events
Dialog - A dialog button is clicked for SaveMenu
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Clicked dialog button) Equal to WantToSave
Collapse Then - Actions
Custom script: call SaveGame( "WoGAutosave.w3z" )
Game - Display to (All players) the text: |cff00ff00Game save...
Else - Actions

07-12-2007, 01:44 PM#5
Callahan
Okaaaaay
07-12-2007, 01:53 PM#6
Dark.Revenant
Wouldn't you be able to do this pretty easily in GUI?
07-12-2007, 02:02 PM#7
Thunder_Eye
Most likely, but why use GUI when you know JASS? (though that jass trigger makes me dizzy)
07-12-2007, 03:23 PM#8
Captain Griffen
GUI is fine where performance is no issue, just so long as it doesn't leak excessively or repeatedly.
07-12-2007, 04:41 PM#9
Callahan
I have another minor issue :the folder.It save at Save/Profile#/CustomSaves/MapName/ so you cannot load your save from the F10 menu in game unless you change the folder of the .w3z
I can trigger to load the map but it would be annoying since you have to start a new game before load your saved file.

I just want to know if it's possible to specifie the folder in jass trigger like
Collapse JASS:
call SaveGame("C:/Program files/Warcraft3/Save/WoGAutosave.w3z")
07-12-2007, 04:43 PM#10
TheSecretArts
errr.... youd probably have to make a native that does SaveGame but adds a directory because the directory is hardcoded (to my knowledge) in the function.
07-13-2007, 09:37 AM#11
Callahan
Any i've fixed with another custom load system.And it appear at the begining before starting the game there is a dialog wich ask if you want to start a new game or load game so that they can load they're map.

But i've encounter another problem,The save can work only once unless you reload the map.Is there a way to fix that?
07-13-2007, 01:09 PM#12
TheSecretArts
Make a handler map, with the code
Trigger:
Game - Load Saved Game <saved game>
unless thats not an actual function. Just make a map that when loaded, loads the save <if any>, else starts a 'new game' using the starter map
07-13-2007, 06:43 PM#13
Callahan
The load work properly.
The problem is that you can save only once during the game.If you try to resave during the same game it won't work.You have to reload your saved game to enable the save again.