[Log in / Register]
| News | Chat | Pastebin | Donations | Tutorials | Rules | Forums | Starcraft II |
| Maps | Skins | Icons | Models | Spells | Tools | Jass | Packs |
(Keeps Hive Alive)
Go Back   The Hive Workshop > Warcraft III Resources > JASS Functions

JASS Functions Approved JASS functions will be located here.
Remember to submit your own resources to the submission forum.

Reply
 
LinkBack Thread Tools
Old 02-05-2010, 10:08 PM   #1 (permalink)
Forum Moderator TriggerHappy
Spell & Trigger Moderator
 
TriggerHappy's Avatar
 
Join Date: Jun 2007
Posts: 1,048
TriggerHappy is just really nice (378)TriggerHappy is just really nice (378)TriggerHappy is just really nice (378)TriggerHappy is just really nice (378)
Zephyr Challenge #6 - Winner: Dune Worm PayPal Donor: This user has donated to The Hive. 
PreventSave

Introduction
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.
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

Last edited by TriggerHappy; 02-06-2010 at 09:35 PM.
TriggerHappy is online now   Reply With Quote
Old 02-05-2010, 10:33 PM   #2 (permalink)
Forum Moderator azlier
Blasphemy!
 
Join Date: Oct 2008
Posts: 161
azlier has little to show at this moment (50)
Efficient, and well tested. I myself can verify that it works on both single player and online.

Approved.
azlier is offline   Reply With Quote
Old 02-06-2010, 02:55 AM   #3 (permalink)
Registered User Mooglefrooglian
The Untitled... wait...
 
Mooglefrooglian's Avatar
 
Join Date: Nov 2008
Posts: 441
Mooglefrooglian has little to show at this moment (38)Mooglefrooglian has little to show at this moment (38)Mooglefrooglian has little to show at this moment (38)Mooglefrooglian has little to show at this moment (38)
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 09:36 PM.
Mooglefrooglian is offline   Reply With Quote
Old 02-06-2010, 04:45 AM   #4 (permalink)
Forum Moderator azlier
Blasphemy!
 
Join Date: Oct 2008
Posts: 161
azlier has little to show at this moment (50)
No. Setting a global to the local player works just fine.
azlier is offline   Reply With Quote
Old 02-10-2010, 02:05 AM   #5 (permalink)
Registered User Mooglefrooglian
The Untitled... wait...
 
Mooglefrooglian's Avatar
 
Join Date: Nov 2008
Posts: 441
Mooglefrooglian has little to show at this moment (38)Mooglefrooglian has little to show at this moment (38)Mooglefrooglian has little to show at this moment (38)Mooglefrooglian has little to show at this moment (38)
But dont globals sync, and having them different cause a desync?

Is it just when you try to use that data?
Mooglefrooglian is offline   Reply With Quote
Old 02-10-2010, 03:58 AM   #6 (permalink)
Forum Moderator azlier
Blasphemy!
 
Join Date: Oct 2008
Posts: 161
azlier has little to show at this moment (50)
Globals are not synced.
azlier is offline   Reply With Quote
Old 02-10-2010, 08:44 PM   #7 (permalink)
Registered User kennyman94
User
 
Join Date: Nov 2009
Posts: 84
kennyman94 has little to show at this moment (4)
I have no clue about what you guys are talking about but what version of jass is this for?
kennyman94 is offline   Reply With Quote
Old 02-10-2010, 08:46 PM   #8 (permalink)
Forum Moderator TriggerHappy
Spell & Trigger Moderator
 
TriggerHappy's Avatar
 
Join Date: Jun 2007
Posts: 1,048
TriggerHappy is just really nice (378)TriggerHappy is just really nice (378)TriggerHappy is just really nice (378)TriggerHappy is just really nice (378)
Zephyr Challenge #6 - Winner: Dune Worm PayPal Donor: This user has donated to The Hive. 
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).
TriggerHappy is online now   Reply With Quote
Old 02-10-2010, 08:59 PM   #9 (permalink)
Registered User kennyman94
User
 
Join Date: Nov 2009
Posts: 84
kennyman94 has little to show at this moment (4)
I mean like i just got JNGP and i dont know if different editor versions use different forms of jass.
kennyman94 is offline   Reply With Quote
Old 02-12-2010, 05:38 PM   #10 (permalink)
Registered User cookies4you
Mr. Stuck In Time Loop
 
cookies4you's Avatar
 
Join Date: May 2009
Posts: 463
cookies4you has little to show at this moment (39)cookies4you has little to show at this moment (39)cookies4you has little to show at this moment (39)cookies4you has little to show at this moment (39)
finally! i've been looking for something to prevent this! finally! a way to stop seekers from saving and exploiting moving props!
__________________
Quote:
Originally Posted by Misha View Post
omg!
I Win
cookies4you is offline   Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 09:12 AM.






Hosting by SliceHost 
Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.1
Copyright©Ralle