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

[JASS] whats the code to save game?

Status
Not open for further replies.
Level 9
Joined
Jul 24, 2007
Messages
308
well , i just need the code to save game withouch loading or changing lvl , all i know its native , but i dont have the functions and codes . for a trigger at time 0.20 seconds to save the game .. i know the events but not actions , help me please
 
Level 9
Joined
Jul 24, 2007
Messages
308
well , i tried the code and i typed :

native SaveGame takes string saveFileName returns nothing
call SaveGame("HuntersArnea")
//===========================================================================
function InitTrig_Save_the_Game takes nothing returns nothing
set gg_trg_Save_the_Game = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Save_the_Game, 1.00 )
call TriggerAddAction( gg_trg_Save_the_Game, function Trig_Untitled_Trigger_001_Actions )
endfunction


is that correct? no , what should i type im lazy JASS beginner..
and btw , i made the event to start when game time is 1 second.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
JASS:
function Trig_Save_the_Game_Actions takes nothing returns nothing
    call SaveGame("HuntersArnea")
endfunction

function InitTrig_Save_the_Game takes nothing returns nothing
    set gg_trg_Save_the_Game = CreateTrigger( )
    call TriggerRegisterTimerEventSingle( gg_trg_Save_the_Game, 1.00 )
    call TriggerAddAction( gg_trg_Save_the_Game, function Trig_Save_the_Game_Actions )
endfunction
 
JASS:
function Trig_Save_the_Game_Actions takes nothing returns nothing
    call SaveGame("HuntersArnea")
endfunction

function InitTrig_Save_the_Game takes nothing returns nothing
    set gg_trg_Save_the_Game = CreateTrigger( )
    call TriggerRegisterTimerEventSingle( gg_trg_Save_the_Game, 1.00 )
    call TriggerAddAction( gg_trg_Save_the_Game, function Trig_Save_the_Game_Actions )
endfunction

Lol... Wtf is "Arnea"?? :grin: *Arena

Well, anyways... Natives are hardcoded warcraft III functions. Any function, must be called with the prefix "call" before it unless you are setting/creating a variable or returning something.

Any "function" must be called within a "function block" which allows you to call a function eg:
JASS:
function FUNCNAME takes nothing returns nothing

endfunction

Funcname can be anything other than unrecognized characters or a name with spaces in it. Look at wyrmlord's tutorial for a explanation of the "takes" and "returns" field.

So say you want to call "SaveGame". It takes a string. So the string must be contained within the parentheses as so:
JASS:
call SaveGame("text")

Think of the Parentheses as the block that contains the fields, and the "SaveGame" as the thing that holds them up.

In this case, the "text" will be the filename. So if you want the filename to be "The Fart Pit", then put this:
JASS:
function SaveGameFunc takes nothing returns nothing
    call SaveGame("The Fart Pit")
endfunction

And it will work.

But in your case, just use the functions that Dr. Super Good gave you in the post above.

I hope this helped you gain at least a small knowledge/understanding of function calling! :grin:
 
Status
Not open for further replies.
Top