Warcraft 3 documentation
vJASS & Zinc Documentation
For the latest documentation about how it works vJASS and Zinc language layers for Warcraft III, please follow these links:
Jasshelper documentation - Zinc documentation - WC3 Optimizer documentation

[Snippet] Disable Transmission Skip No New Posts Codes & Snippets

Started by
Purgeandfire

0 Members and 1 Guest are viewing this topic.

[Snippet] Disable Transmission Skip
on: July 02, 2013, 02:48:08 AM
Category: Interface
Language: vJASS

This library will allow you to disable/enable the feature that allows you to skip cinematic transmissions by pressing ESC. Some RPG's are ruined when other players press ESC during a cinematic because it skips the transmission for everyone. This neat script can prevent that.

Code: jass
  1. library TransmissionSkip /* v.1.0.0.0
  2. ********************************************************************
  3. *
  4. *   The normal GUI cinematic functions allow you to skip
  5. *   transmissions by pressing ESC. This snippet will allow
  6. *   you to disable/enable that feature.
  7. *
  8. ********************************************************************
  9. *   
  10. *   Functions
  11. *
  12. *       DisableTransmissionSkip()
  13. *
  14. *           - Prevents players from skipping cinematic
  15. *             transmissions by pressing ESC.
  16. *
  17. *       EnableTransmissionSkip()
  18. *
  19. *           - Allows players to skip cinematic transmissions
  20. *             by pressing ESC, if you use the BJ/GUI functions.
  21. *
  22. ********************************************************************/
  23.  
  24.     function DisableTransmissionSkip takes nothing returns nothing
  25.         if bj_cineSceneBeingSkipped == null then
  26.             call TryInitCinematicBehaviorBJ()
  27.         endif
  28.     endfunction
  29.  
  30.     function EnableTransmissionSkip takes nothing returns nothing
  31.         if bj_cineSceneBeingSkipped == null then
  32.             return
  33.         endif
  34.     endfunction
  35.    
  36. endlibrary

Example code:
Example Code
Code: jass
  1. scope Test initializer onInit
  2. /*
  3.     Implementing this code will disable skipping transmissions
  4.     until EnableTransmissionSkip() is called
  5. */
  6.     private function onInit takes nothing returns nothing
  7.         call DisableTransmissionSkip()
  8.     endfunction
  9. endscope

To use it, just create a new trigger and paste the code in there. If you do not have JNGP, then here is a JASS version:
Vanilla JASS Version
Code: jass
  1. // TransmissionSkip Library
  2.    
  3.     function DisableTransmissionSkip takes nothing returns nothing
  4.         if bj_cineSceneBeingSkipped == null then
  5.             call TryInitCinematicBehaviorBJ()
  6.         endif
  7.     endfunction
  8.  
  9.     function EnableTransmissionSkip takes nothing returns nothing
  10.         if bj_cineSceneBeingSkipped == null then
  11.             return
  12.         endif
  13.     endfunction
  14.  
  15. // End TransmissionSkip Library

Simply paste that into the map header. To access the map header, open the trigger editor and click on the map name listed on the left. Paste the code there. Then you can make a trigger like so:

My Trigger
    Events
        Map Initialization
    Conditions
    Actions
        Custom script:   call DisableTransmissionSkip()
 

And it should disable transmission skipping for the entire game until you call "EnableTransmissionSkip()". To disable it again, simply call "DisableTransmissionSkip()" again.

Credits to: Troll-Brain for the suggestion long ago to disable the trigger instead of doing it the odd way I did it before.
« Last Edit: December 19, 2017, 07:52:33 PM by moyack »



[Snippet] Disable Transmission Skip
Reply #1 on: July 02, 2013, 11:58:46 AM

I love this kind of scripts: small and straight to the point.

~Approved


[Snippet] Disable Transmission Skip
Reply #2 on: July 02, 2013, 01:34:55 PM

Thanks moyack :D

Yeah, I'm trying to remember all these little snippets that I used to use before I forget them. :P Oh and thanks for fixing the trigger for me.



 

Started by PitzerMike

Replies: 0
Views: 1640
Codes & Snippets

Started by Purgeandfire

Replies: 0
Views: 1717
Codes & Snippets

Started by Bribe

Replies: 0
Views: 1970
Codes & Snippets

Started by moyack

Replies: 0
Views: 9882
Codes & Snippets

Started by Magtheridon96

Replies: 1
Views: 8664
Codes & Snippets
Vivir aprendiendo.co - A place for learning stuff, in Spanish   Chaos Realm - The world of Game modders and wc3 addicts   Diplo, a gaming community   Power of Corruption, an altered melee featuring Naga and Demon. Play it now!!!   WC3JASS.com - The JASS Vault + vJASS and Zinc   Jetcraft - A Starcraft II mod   WormTastic Clan (wTc)   Warcraft RESOURCES Reforged: Modelos, mapas, proyectos y mas...