(Keeps Hive Alive)
Go Back   The Hive Workshop - A Warcraft III Modding Site > Warcraft III Resources > JASS Functions

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

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 03-21-2008, 11:13 AM   #1 (permalink)
 
Captain Griffen's Avatar

******
 
Join Date: Nov 2005
Posts: 747

Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)


[vJASS] CG's Transmission System

Again, taken from Destiny's Wake, my transmission functions. Basically, you can have skippable and unskippable, voiced and not voiced, and stuff like that, with easy to use functions. The basic version requires you to press escape to move along, after you have read the text.

Easiest way to explain is to take a look at the map I used it in: http://www.hiveworkshop.com/resources_new/maps/6283/

If you wanted, you could put in timed versions whereby it was either after a time or after they escape, but personally I don't feel a need for that.

NB: This is single player ONLY. Will (almost) certainly desync on multiplayer.

library TransmissionFuncs initializer Init

globals
    private unit bufferUnit
    private string bufferName
    private string bufferMessage = null
    private string bufferSound = null

    private sound currentSound = null
    private string currentSoundString = null

    private boolean EscapeInterrupt = false

    boolean END_AFTER_VOICE = true // this controls whether or not the transmission is auto-skipped after the end of a voiced bit.

    private timer soundTimer
    private string soundTimerString

    boolean InCinematic = false

    private code interEx
endglobals

// InCinematic should be set properly to avoid problems with the interrupt.
function CinematicModeOn takes nothing returns nothing
    set InCinematic = true
    call CinematicModeBJ(true, bj_FORCE_ALL_PLAYERS)
endfunction

function CinematicModeOff takes nothing returns nothing
    set InCinematic = false
    call CinematicModeBJ(false, bj_FORCE_ALL_PLAYERS)
endfunction

private function Interruption takes nothing returns nothing
    if InCinematic then
        if bufferMessage != null then
            call TimerStart(CreateTimer(), 0.00, false, interEx)
        else
            set EscapeInterrupt = true
        endif
        if currentSound != null and bufferSound != currentSoundString then
            call StopSound(currentSound, true, false)
        endif
    endif
endfunction

private function SetupVoice takes string snd returns nothing
    if currentSound != null then
        call KillSoundWhenDone(currentSound)
    endif
    call Preload(snd)
set currentSound = CreateSound(snd, false, false, false, 10, 10, "")
    call StartSound(currentSound)
    set currentSoundString = snd
endfunction

private function SoundOver takes nothing returns nothing
    if soundTimer == GetExpiredTimer() and soundTimerString == currentSoundString then
        call Interruption.execute()
endif
    call DestroyTimer(GetExpiredTimer())
endfunction

function DisplayText takes string data returns nothing
    call DisplayTextToPlayer(GetLocalPlayer(), 0., 0., data)
endfunction

function Transmission takes unit talker, string name, string message returns nothing
    call TransmissionFromUnitWithNameBJ( bj_FORCE_ALL_PLAYERS, talker, name, null, message, bj_TIMETYPE_ADD, 9999., false )
endfunction

function TransmissionSound takes unit talker, string name, string message, string snd returns nothing
    local timer t
    call SetupVoice(snd)
    call TransmissionFromUnitWithNameBJ( bj_FORCE_ALL_PLAYERS, talker, name, null, message, bj_TIMETYPE_ADD, 9999., false )
    if END_AFTER_VOICE then
        set t = CreateTimer()
        set soundTimer = t
set soundTimerString = snd
        call TimerStart(t, I2R(GetSoundDuration(currentSound)) * 0.003 + 0.25, false, function SoundOver) // Why this is so, I have no idea. It just works.
    endif
endfunction

function TransmissionAndBuffer takes unit talker, string name, string message returns nothing
    call TransmissionFromUnitWithNameBJ( bj_FORCE_ALL_PLAYERS, talker, name, null, message, bj_TIMETYPE_ADD, 9999., false )
    set bufferUnit = talker
    set bufferName = name
set bufferMessage = message
endfunction

function TransmissionSoundAndBuffer takes unit talker, string name, string message, string snd returns nothing
call SetupVoice(snd)
    call TransmissionFromUnitWithNameBJ( bj_FORCE_ALL_PLAYERS, talker, name, null, message, bj_TIMETYPE_ADD, 9999., false )
    set bufferUnit = talker
    set bufferName = name
set bufferMessage = message
    set bufferSound = snd
endfunction

function TransmissionTimed takes unit talker, string name, string message, real time returns nothing
    call TransmissionFromUnitWithNameBJ( bj_FORCE_ALL_PLAYERS, talker, name, null, message, bj_TIMETYPE_ADD, time-5., false )
endfunction

function TransmissionBufferDisplay takes nothing returns nothing
    call TransmissionFromUnitWithNameBJ( bj_FORCE_ALL_PLAYERS, bufferUnit, bufferName, null, bufferMessage, bj_TIMETYPE_ADD, 9999., false )
endfunction

function TransmissionBuffer takes unit talker, string name, string message returns nothing
set bufferUnit = talker
    set bufferName = name
    set bufferMessage = message
endfunction

function TransmissionSoundBuffer takes unit talker, string name, string message, string snd returns nothing
    set bufferUnit = talker
    set bufferName = name
set bufferMessage = message
    set bufferSound = snd
endfunction

function TransmissionClearBuffer takes nothing returns nothing
    set bufferUnit = null
    set bufferName = null
    set bufferMessage = null
    set bufferSound = null
endfunction

// This waits for escape, and does nothing else
function WaitEscape takes nothing returns nothing
    set EscapeInterrupt = false
    loop
        exitwhen EscapeInterrupt == true
        call TriggerSleepAction(0.)
    endloop
    set EscapeInterrupt = false
endfunction

// This waits for escape, and then displays the buffer, used to stop someone skipping it.
function WaitBuffer takes nothing returns nothing
    set EscapeInterrupt = false
    loop
        exitwhen EscapeInterrupt == true
        call TriggerSleepAction(0.)
    endloop
    call TransmissionBufferDisplay()
    set EscapeInterrupt = false
endfunction

// This clears the buffer, and then waits for escape. Used at the end of a transmission sequence.
function WaitConclude takes nothing returns nothing
    set EscapeInterrupt = false
    call TransmissionClearBuffer()
    loop
        exitwhen EscapeInterrupt == true
        call TriggerSleepAction(0.)
    endloop
    set EscapeInterrupt = false
endfunction

private function InterruptionEx takes nothing returns nothing
    if bufferSound != null and bufferSound != currentSoundString then
        call TransmissionSound(bufferUnit, bufferName, bufferMessage, bufferSound)
        set bufferSound = null
    else
        call Transmission(bufferUnit, bufferName, bufferMessage)
    endif
    set EscapeInterrupt = true
    call DestroyTimer(GetExpiredTimer())
endfunction

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger( )
    call TriggerRegisterPlayerEventEndCinematic( t, GetLocalPlayer() )
    call TriggerAddAction( t, function Interruption )
    set interEx = function InterruptionEx
endfunction

endlibrary

Example usage:

This one is skippable with voice. You do an initial transmission, put the next one in the buffer, and then do WaitBuffer to display the next one when they skip.

    call CinematicModeOn()
    call IssueImmediateOrder(udg_PlayerUnit, "holdposition")
    call TransmissionSound(udg_PlayerUnit, udg_PlayerName, "HAI! Take that you fatty!", "Hai!.mp3")
    call TransmissionSoundBuffer(udg_PlayerUnit, udg_PlayerName, "...they'll be after me....", "They'll be after me.mp3")
    call WaitBuffer()
    call TransmissionSoundBuffer(udg_PlayerUnit, udg_PlayerName, "...in force, too...", "In force, too.mp3")
    call WaitBuffer()
    call TransmissionSoundBuffer(udg_PlayerUnit, udg_PlayerName, "Maybe I should go talk to the people in that house over there; find out who's in charge.", "Maybe i should go talk.mp3")
    call WaitBuffer()
    call WaitConclude()
    call CinematicModeOff()

Another example, this time unskippable:

    call CinematicModeOn()
    call TransmissionAndBuffer(udg_PlayerUnit, udg_PlayerName, "...new day, new worries.")
    call PolledWait(4.)
    call TransmissionClearBuffer()
    call CinematicModeOff()
__________________
Quote:
[20-00-13] MasterHaosis: Because I am retarded douchebag
[20-15-23] MasterHaosis: I am faggot, retard and such..
[20-21-22] MasterHaosis: because I am chat moderator. And you dont have right to speak against me
~Void~: Knock it off, for fuck's sake. Get that bullshit out of your signature and stop being so immature. Let it die out.

Last edited by Captain Griffen; 03-21-2008 at 06:03 PM..
Captain Griffen is offline  
Old 03-21-2008, 06:09 PM   #2 (permalink)
 
HINDYhat's Avatar

WRONG HOLE!
 
Join Date: Apr 2007
Posts: 1,022

HINDYhat is a glorious beacon of light (587)HINDYhat is a glorious beacon of light (587)HINDYhat is a glorious beacon of light (587)HINDYhat is a glorious beacon of light (587)HINDYhat is a glorious beacon of light (587)HINDYhat is a glorious beacon of light (587)HINDYhat is a glorious beacon of light (587)

Super Donor: This user has donated at least $100 to The Hive. 

Looks good. After a couple of bug fixed, I think this is ready for approval!


~Approved~

__________________
HINDYhat is offline  
Old 03-21-2008, 11:22 PM   #3 (permalink)
 
Herman's Avatar

Me in a few words???
 
Join Date: Aug 2007
Posts: 949

Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)


Questions

1. Are the texts supposed to have sound to them?
2. When are you going to make the next episode because I enjoyed it.

If it's supposed to have sound, for some reason your RPG does not have the voiced commands
__________________
77% of all people are neurotic
Herman is offline  
Old 03-22-2008, 08:36 AM   #4 (permalink)
 
Captain Griffen's Avatar

******
 
Join Date: Nov 2005
Posts: 747

Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)


Quote:
Originally Posted by Herman View Post
1. Are the texts supposed to have sound to them?
2. When are you going to make the next episode because I enjoyed it.

If it's supposed to have sound, for some reason your RPG does not have the voiced commands
The current release candidate for the first episode is being voiced. It hasn't been released yet. I can't really guarentee when I'll release the second episode, but don't hold your breath, I have exams coming up.
__________________
Quote:
[20-00-13] MasterHaosis: Because I am retarded douchebag
[20-15-23] MasterHaosis: I am faggot, retard and such..
[20-21-22] MasterHaosis: because I am chat moderator. And you dont have right to speak against me
~Void~: Knock it off, for fuck's sake. Get that bullshit out of your signature and stop being so immature. Let it die out.
Captain Griffen is offline  
Old 03-22-2008, 04:23 PM   #5 (permalink)
 
Herman's Avatar

Me in a few words???
 
Join Date: Aug 2007
Posts: 949

Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)Herman has little to show at this moment (40)


Dang

Well, good luck on your tests and I hope you can get around to the next episode sooner or later, that was actually a really fun rpg
__________________
77% of all people are neurotic
Herman is offline  
Old 04-05-2008, 01:54 PM   #6 (permalink)

User
 
Join Date: Mar 2005
Posts: 230

DiscipleOfLife is on a distinguished road (71)DiscipleOfLife is on a distinguished road (71)


not <boolean> is faster than <boolean> == false
__________________
DiscipleOfLife is offline  
Old 04-05-2008, 05:14 PM   #7 (permalink)
 
Captain Griffen's Avatar

******
 
Join Date: Nov 2005
Posts: 747

Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)


I didn't use == false. Although I do have three totally pointless == trues in there.
__________________
Quote:
[20-00-13] MasterHaosis: Because I am retarded douchebag
[20-15-23] MasterHaosis: I am faggot, retard and such..
[20-21-22] MasterHaosis: because I am chat moderator. And you dont have right to speak against me
~Void~: Knock it off, for fuck's sake. Get that bullshit out of your signature and stop being so immature. Let it die out.
Captain Griffen is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[vJass]VoteKick System Venks "Graveyard" 2 08-08-2008 08:37 AM
[vjass] ORTS - Orc_Tamer's Recipe System 2.0 Orc_Tamer "Graveyard" 7 08-01-2008 07:09 AM
[Solved] Problem with voice transmission The Mystic Cow World Editor Help Zone 3 04-26-2008 08:42 PM
[vJASS] CG's Music System Captain Griffen JASS Functions 2 03-22-2008 10:57 PM
How to disable transmission skipping? Volty World Editor Help Zone 14 10-29-2007 11:49 PM

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






Your link here 
Bankruptcy Certification | Bad Credit Mortgages | Bankruptcy Certification | Loans | Advertising
Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Copyright©Ralle