• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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,258
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