TriggerHappy
...
- Reaction score
- 341
Introduction
Code
This library is simple enough. It allows you to enable or disabled game saving. It works by showing a dialog instantly before a game is saved. This closes the save screen therefor the game is never actually saved. Nothing visually happens to the game except for maybe a quick open and close of the save dialog, though it's hardly noticeable.
This even works in single player surprisngly without pausing the game which usually happens when a dialog is opened offline. You can toggle allowing or disallowing saving by setting GAME_ALLOW_SAVE to true, or false.
This even works in single player surprisngly without pausing the game which usually happens when a dialog is opened offline. You can toggle allowing or disallowing saving by setting GAME_ALLOW_SAVE to true, or false.
Code
JASS:
//====================================
// PreventSave
//====================================
//
// This library is simple enough. It allows you to enable or
// disabled game saving. It works by showing a dialog instantly
// before a game is saved. This closes the save screen therefor
// the game is never actually saved.
//
// Nothing visually happens to the game except for maybe a quick open
// and close of the save dialog, though it's hardly noticeable.
// This even works in single player surprisngly without pausing the game
// which usually happens when a dialog is opened offline.
//
// You can toggle allowing or disallowing saving by setting
// GameAllowSave to true, or false.
//
//====================================
// Import Instructions
//====================================
//
// 1. Copy this entire script.
// 2. Create a new trigger in your trigger
// editor and convert it to Jass.
// 3. Paste this in there and save the map.
//
// This requires JassHelper which is included
// in JassNewGenPack.
//
library PreventSave initializer onInit
globals
boolean GameAllowSave = false
endglobals
globals
private dialog D = DialogCreate()
private timer T = CreateTimer()
endglobals
private function Exit takes nothing returns nothing
call DialogDisplay(GetLocalPlayer(), D, false)
endfunction
private function StopSave takes nothing returns nothing
if not GameAllowSave then
call DialogDisplay(GetLocalPlayer(), D, true)
call TimerStart(T, 0.00, false, function Exit)
endif
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterGameEvent(t, EVENT_GAME_SAVE)
call TriggerAddAction(t, function StopSave)
endfunction
endlibrary