 |   |  |  |
JASS Functions Approved JASS functions will be located here.
Remember to submit your own resources to the submission forum. |
 |
03-21-2008, 11:13 AM
|
#1 (permalink)
|
******
Join Date: Nov 2005
Posts: 747
|
[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 )endfunctionfunction CinematicModeOff takes nothing returns nothing set InCinematic = false call CinematicModeBJ (false, bj_FORCE_ALL_PLAYERS )endfunctionprivate 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 endifendfunctionprivate 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 endfunctionprivate function SoundOver takes nothing returns nothing if soundTimer == GetExpiredTimer () and soundTimerString == currentSoundString then call Interruption.execute () endif call DestroyTimer (GetExpiredTimer ())endfunctionfunction DisplayText takes string data returns nothing call DisplayTextToPlayer (GetLocalPlayer (), 0., 0., data )endfunctionfunction 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 )endfunctionfunction 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. endifendfunctionfunction 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 endfunctionfunction 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 endfunctionfunction 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 )endfunctionfunction TransmissionBufferDisplay takes nothing returns nothing call TransmissionFromUnitWithNameBJ ( bj_FORCE_ALL_PLAYERS, bufferUnit, bufferName, null, bufferMessage, bj_TIMETYPE_ADD, 9999., false )endfunctionfunction TransmissionBuffer takes unit talker, string name, string message returns nothing set bufferUnit = talker set bufferName = name set bufferMessage = message endfunctionfunction TransmissionSoundBuffer takes unit talker, string name, string message, string snd returns nothing set bufferUnit = talker set bufferName = name set bufferMessage = message set bufferSound = snd endfunctionfunction TransmissionClearBuffer takes nothing returns nothing set bufferUnit = null set bufferName = null set bufferMessage = null set bufferSound = nullendfunction// This waits for escape, and does nothing elsefunction WaitEscape takes nothing returns nothing set EscapeInterrupt = false loop exitwhen EscapeInterrupt == true call TriggerSleepAction (0. ) endloop set EscapeInterrupt = falseendfunction// 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 = falseendfunction// 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 = falseendfunctionprivate 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 ())endfunctionprivate function Init takes nothing returns nothing local trigger t = CreateTrigger ( ) call TriggerRegisterPlayerEventEndCinematic ( t, GetLocalPlayer () ) call TriggerAddAction ( t, function Interruption ) set interEx = function InterruptionEx endfunctionendlibrary
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..
|
|
|
03-21-2008, 06:09 PM
|
#2 (permalink)
|
WRONG HOLE!
Join Date: Apr 2007
Posts: 1,022
|
Looks good. After a couple of bug fixed, I think this is ready for approval!
~Approved~
|
|
|
03-21-2008, 11:22 PM
|
#3 (permalink)
|
Me in a few words???
Join Date: Aug 2007
Posts: 949
|
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
|
|
|
03-22-2008, 08:36 AM
|
#4 (permalink)
|
******
Join Date: Nov 2005
Posts: 747
|
Quote:
Originally Posted by Herman
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. | |
|
|
|
03-22-2008, 04:23 PM
|
#5 (permalink)
|
Me in a few words???
Join Date: Aug 2007
Posts: 949
|
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
|
|
|
04-05-2008, 01:54 PM
|
#6 (permalink)
|
User
Join Date: Mar 2005
Posts: 230
|
not <boolean> is faster than <boolean> == false
|
|
|
04-05-2008, 05:14 PM
|
#7 (permalink)
|
******
Join Date: Nov 2005
Posts: 747
|
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. | |
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
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
|
|
|
|  |  |  |  |   |  |
|