|
|
|
|
JASS Functions Approved JASS functions will be located here.
Remember to submit your own resources to the submission forum. |
 |
02-05-2010, 09:08 PM
|
#1 (permalink)
|
|
Development Moderator
Join Date: Jun 2007
Posts: 1,202
|
PreventSave
IntroductionThis 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.
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
//====================================
// Do not edit below this line
//====================================
globals
private dialog D = DialogCreate()
private timer T = CreateTimer()
private player p
endglobals
private function Exit takes nothing returns nothing
call DialogDisplay(p, D, false)
endfunction
private function StopSave takes nothing returns nothing
if not GameAllowSave then
call DialogDisplay(p, 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)
set p = GetLocalPlayer()
endfunction
endlibrary
__________________
♥ Moderator since 10-04-2009 ♥
Spending all my money on dope and extreme high price tickets. But in the end, it's all worth it.
I like to live in my own world. I'm told to enjoy every moment, every hour, every minute.
Why should I take life so seriously? I just want to do what I like to do. Be far from reality, because I can't stand society.
It's my own world. I just want to hear the music.
Last edited by TriggerHappy; 02-06-2010 at 08:35 PM.
|
|
|
02-05-2010, 09:33 PM
|
#2 (permalink)
|
|
Made of explodium
JASS Moderator
Join Date: Oct 2008
Posts: 277
|
Efficient, and well tested. I myself can verify that it works on both single player and online.
Approved.
|
|
|
02-06-2010, 01:55 AM
|
#3 (permalink)
|
|
The Untitled... wait...
Join Date: Nov 2008
Posts: 644
|
Every map should have an option to use this, to prevent laming.
Thank you!
Edit: Wait... why are you setting a global variable to GetLocalPlayer()? I'm pretty sure that desyncs.
Jass:
library PreventSave initializer onInit
globals
boolean GameAllowSave = false
endglobals
//====================================
// Do not edit below this line
//====================================
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
Shouldnt it be like that?
Last edited by TriggerHappy; 02-06-2010 at 08:36 PM.
|
|
|
02-06-2010, 03:45 AM
|
#4 (permalink)
|
|
Made of explodium
JASS Moderator
Join Date: Oct 2008
Posts: 277
|
No. Setting a global to the local player works just fine.
|
|
|
02-10-2010, 01:05 AM
|
#5 (permalink)
|
|
The Untitled... wait...
Join Date: Nov 2008
Posts: 644
|
But dont globals sync, and having them different cause a desync?
Is it just when you try to use that data?
|
|
|
02-10-2010, 02:58 AM
|
#6 (permalink)
|
|
Made of explodium
JASS Moderator
Join Date: Oct 2008
Posts: 277
|
Globals are not synced.
|
|
|
02-10-2010, 07:44 PM
|
#7 (permalink)
|
|
User
Join Date: Nov 2009
Posts: 181
|
I have no clue about what you guys are talking about but what version of jass is this for?
|
|
|
02-10-2010, 07:46 PM
|
#8 (permalink)
|
|
Development Moderator
Join Date: Jun 2007
Posts: 1,202
|
Do you mean vJass? Blizzard doesn't give Jass patch versions it's just Jass2. If you do mean vJass, just get the newest Jasshelper or download the GUI one in the spells section (check my profile).
__________________
♥ Moderator since 10-04-2009 ♥
Spending all my money on dope and extreme high price tickets. But in the end, it's all worth it.
I like to live in my own world. I'm told to enjoy every moment, every hour, every minute.
Why should I take life so seriously? I just want to do what I like to do. Be far from reality, because I can't stand society.
It's my own world. I just want to hear the music.
|
|
|
02-10-2010, 07:59 PM
|
#9 (permalink)
|
|
User
Join Date: Nov 2009
Posts: 181
|
I mean like i just got JNGP and i dont know if different editor versions use different forms of jass.
|
|
|
02-12-2010, 04:38 PM
|
#10 (permalink)
|
|
Mr. Stuck In Time Loop
Join Date: May 2009
Posts: 566
|
finally! i've been looking for something to prevent this! finally! a way to stop seekers from saving and exploiting moving props!
|
|
|
03-26-2010, 01:54 PM
|
#11 (permalink)
|
|
Vamp Zero God
Join Date: Oct 2009
Posts: 165
|
Taken from TheHelper and not even given credits...
__________________
Size is Relative, Energy is Absolute.
Pain is Temporary, Losing is Forever.
Massive Pain is Relatively Short, Powerful Losing is Absolutely Forever.
Vampirism Zero Pro
Site about me
|
|
|
03-26-2010, 02:34 PM
|
#12 (permalink)
|
|
Why so serious?
Join Date: Nov 2009
Posts: 1,418
|
Er.... Proof?
__________________
BBCodes| THW Chat| HIVE'S RULES| Art Gallery|      |
"Ash, for the last time, we don't have harpoons. Harpoons are for lazy asses.
Real men fight with kitchen knives, even in ship-to-ship combat." ~ WILL THE ALMIGHTY
|
|
|
03-26-2010, 03:29 PM
|
#13 (permalink)
|
|
User
Join Date: Jul 2009
Posts: 104
|
Quote:
Originally Posted by Fanny.Shaver
Taken from TheHelper and not even given credits...
|
Wrong - this was posted by its author.
Why is there no facepalm emote?
|
|
|
03-29-2010, 02:24 PM
|
#14 (permalink)
|
|
Vamp Zero God
Join Date: Oct 2009
Posts: 165
|
Quote:
Originally Posted by dead-man-walking
Er.... Proof?
|
Proof, is that I have it on my map for about six months...
@up
Well, I knew someone did that on thehelper, didn't knew who did. Strange that long later in here. Honors back.
__________________
Size is Relative, Energy is Absolute.
Pain is Temporary, Losing is Forever.
Massive Pain is Relatively Short, Powerful Losing is Absolutely Forever.
Vampirism Zero Pro
Site about me
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|
All times are GMT. The time now is 09:13 PM.
|