• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Cinematic Transmission System

Status
Not open for further replies.
Level 19
Joined
Oct 12, 2007
Messages
1,821
Hey there.

I'm making an ORPG and use various complicated JASS systems in it.
I usually never make the systems for the ORPG because RaiN is making them for me and he's doing it really great however... He's pretty busy with alot of spells, abilities and more more more so I didn't want to bug him with this request again.

You see. I'm making the quests for the ORPG. So far I made them GUI with alot of leaks and waits just to try it out. Now at this time I think the concept is "done" so I started trying to make a system to make it leakless in JASS.

On that last part I probably failed because my head can't take it anymore. My JASS knowledge isn't good enough to finish this so I'd like to ask people here if this is actually possible and if so, could you finish it for me?

This is what I want:

I want to be able to add multiple camera objects to a certain 'camera queue' so if one of them is done it automatically jumps to the other camera. This while at the SAME TIME unit transmissions are being queued in the same trigger and display while the camera's are panning.
This is how it looks like (with leaks): http://www.youtube.com/watch?v=fT-T2mQg_C0


This is the camera part of the "system" I came up with. I used some variables but those are supposed to become globals after I figure out how to make globals.:p

JASS:
library CameraPanning

function QueueCamera takes integer order, player p, camerasetup camera, real moveduration, real totalduration, boolean last returns nothing
    
    local integer id = GetPlayerId(p)
    local boolean keeponlooping = true
    local boolean keeponlooping2 = true
    local boolean keeponlooping3 = true
    local integer i
    
    if udg_CameraNumber[id] == 0 then
    set udg_CameraNumber[id] = 1
    endif
    
    loop
    exitwhen keeponlooping3 == false
    if udg_CameraNumber[id] == order then
        set keeponlooping3 = false
        
            loop 
            exitwhen keeponlooping == false
            if udg_CameraWait[id] == 0.00 then
                set udg_CameraNumber[id] = udg_CameraNumber[id] + 1
                set keeponlooping = false
                set udg_CameraWait[id] = totalduration
                set udg_Cinematic[id] = true
                call CameraSetupApplyForPlayer(true, camera, p, moveduration)
            
            if last == true then
                loop
                exitwhen keeponlooping2 == false
                if udg_CameraWait[id] > 0.00 then
                    call TriggerSleepAction(0.5)
                    set udg_CameraWait[id] = ( udg_CameraWait[id] - 0.5)
                else
                    set keeponlooping2 = false
                    set udg_Cinematic[id] = false
                endif
                endloop
            endif
            
            else
                call TriggerSleepAction(0.5)
                set udg_CameraWait[id] = ( udg_CameraWait[id] - 0.5)
            endif
            endloop
        
    else
        call TriggerSleepAction(0.5)
    endif
    endloop

endfunction

endlibrary

  • Camtest
    • Events
      • Player - Player 1 (Red) types a chat message containing testcamera as An exact match
    • Conditions
    • Actions
      • Custom script: local player p = GetTriggerPlayer()
      • Custom script: call UnlockCamera(p)
      • Cinematic - Turn on letterbox mode (hide interface) for (All players matching ((Triggering player) Equal to (==) (Matching player))): fade out over 9.00 seconds
      • Cinematic - Turn cinematic mode On for (All players matching (Player 1 (Red) Equal to (==) (Matching player))) over 0.20 seconds
      • Custom script: call QueueCamera(1, p, gg_cam_Camera1, 2., 3., false)
      • Custom script: call QueueCamera(2, p, gg_cam_Camera2, 2., 3., false)
      • Custom script: call QueueCamera(3, p, gg_cam_Camera3, 2., 3., true)
      • Custom script: call LockCameraUnit(p,PlayerHero[GetPlayerId(p)])
      • Cinematic - Turn cinematic mode Off for (All players matching (Player 1 (Red) Equal to (==) (Matching player))) over 0.20 seconds
      • Custom script: set p = null
This GUI trigger is what I did to test it. It worked.. but not how I wanted...



The thing I want is that if I write this...

call QueueCamera(...)
call QueueCamera(...)
call QueueTransmission(...)
call QueueTransmission(...)

...the first queued camera and first queued transmission start at the same time. So far from what I made it works like this: The first camera starts moving then after its time is up the 2nd one moves. When the 2nd one's time is up the 1st transmission begins... I want it to start at the same time!!

But how???


[Thanks for reading this wall of text...]

P.S. Don't look at my weird way of looping and using udg_ stuff... I only wanted to make a basic version so my ORPG's coder only would have to change those weird things afterwards.
 
Erm, globals are used like this;

JASS:
globals
    vartype name = initialvalue
endglobals

As for your original question, just use parallel arrays.
I wrote this in the quick reply box but It's just meant to give you the idea.

JASS:
globals
    camerasetup array CAM
    string array MSG
    integer CAM_COUNT = 0
    integer MSG_COUNT = 0
endglobals

function QueCamera takes camerasetup cam.......
    set CAM[CAM_COUNT] = cam
    set CAM_COUNT = CAM_COUNT + 1
endfunction

function QueueTransmission takes string s.....
    set MSG[MSG_COUNT] = s
    set MSG_COUNT = MSG_COUNT + 1
endfunction

function StartCamQue takes nothing returns nothing
    local integer i = 0
    local integer end
    if MSG_COUNT > CAM_COUNT then
        set end = MSG_COUNT
    else
        set end = CAM_COUNT
    endif
    loop
        exitwhen i > end
        call ApplyCamera(CAM[i]) // not real functions
        call TransmissionBlah(MSG[i]) // but you get the point
        set i = i + 1
    endloop
endfunction
 
Level 19
Joined
Oct 12, 2007
Messages
1,821
Erm, globals are used like this;

JASS:
globals
    vartype name = initialvalue
endglobals

As for your original question, just use parallel arrays.
I wrote this in the quick reply box but It's just meant to give you the idea.

JASS:
globals
    camerasetup array CAM
    string array MSG
    integer CAM_COUNT = 0
    integer MSG_COUNT = 0
endglobals

function QueCamera takes camerasetup cam.......
    set CAM[CAM_COUNT] = cam
    set CAM_COUNT = CAM_COUNT + 1
endfunction

function QueueTransmission takes string s.....
    set MSG[MSG_COUNT] = s
    set MSG_COUNT = MSG_COUNT + 1
endfunction

function StartCamQue takes nothing returns nothing
    local integer i = 0
    local integer end
    if MSG_COUNT > CAM_COUNT then
        set end = MSG_COUNT
    else
        set end = CAM_COUNT
    endif
    loop
        exitwhen i > end
        call ApplyCamera(CAM[i]) // not real functions
        call TransmissionBlah(MSG[i]) // but you get the point
        set i = i + 1
    endloop
endfunction

Ahh yeah I see. That makes much more sence!
I'm going to try out your way tomorrow and update this when I find problems.
Tbh... JASS is pretty cool if you get to know it:D Hell no that I'm going to ask RaiN to finish this tirgger! It's mine!:p

oh and thanks btw:D:D
 
Level 19
Joined
Oct 12, 2007
Messages
1,821
Works now. And this is what I came up with.
Only thing left to do is to remove the BJ.

JASS:
library CameraPanning

globals
    camerasetup array CameraObject[8][99]
    real array CameraMoveDuration[8][99]
    real array CameraTotalDuration[8][99]
    integer array CameraCount[8]
    
    force array TransmissionReceiver[8][99]
    unit array TransmissionSpeaker[8][99]
    string array TransmissionName[8][99]
    string array TransmissionText[8][99]
    real array TransmissionDuration[8][99]
    integer array TransmissionCount[8]
    
    real array CamTimeLeft[8]
    real array TransTimeLeft[8]
endglobals

function QueueCamera takes player p, camerasetup camera, real moveduration, real totalduration returns nothing
    local integer id = GetPlayerId(p)
    local integer id2 = CameraCount[id]

    set CameraObject[id][id2] = camera
    set CameraMoveDuration[id][id2] = moveduration
    set CameraTotalDuration[id][id2] = totalduration
    set CameraCount[id] = CameraCount[id] + 1
endfunction

function QueueTransmission takes player p, force players, unit speaker, string named, string text, real duration returns nothing
    local integer id = GetPlayerId(p)
    local integer id2 = TransmissionCount[id]

    set TransmissionReceiver[id][id2] = players
    set TransmissionSpeaker[id][id2] = speaker
    set TransmissionName[id][id2] = named
    set TransmissionText[id][id2] = text
    set TransmissionDuration[id][id2] = duration
    set TransmissionCount[id] = TransmissionCount[id] + 1
endfunction

function StartCameraQueue takes player p returns nothing
    local integer cam_i = 0
    local integer trans_i = 0
    local integer id = GetPlayerId(p)
    local integer end = CameraCount[id] + TransmissionCount[id]
    local integer repeater = 0
    
    loop
    exitwhen repeater > end
    if cam_i == 0 and trans_i == 0 then
    call CameraSetupApplyForPlayer(true, CameraObject[id][cam_i], p, CameraMoveDuration[id][cam_i])
    set CamTimeLeft[id] = CameraTotalDuration[id][cam_i]
    set cam_i = cam_i + 1
    call TransmissionFromUnitWithNameBJ(TransmissionReceiver[id][trans_i], TransmissionSpeaker[id][trans_i], TransmissionName[id][trans_i], null, TransmissionText[id][trans_i], bj_TIMETYPE_SET, TransmissionDuration[id][trans_i], false)
    set TransTimeLeft[id] = TransmissionDuration[id][trans_i]
    set trans_i = trans_i + 1
    endif
    
    if CamTimeLeft[id] < TransTimeLeft[id] then
        loop
        exitwhen CamTimeLeft[id] < 0.50
        set CamTimeLeft[id] = CamTimeLeft[id] - 0.50
        set TransTimeLeft[id] = TransTimeLeft[id] - 0.50
        call TriggerSleepAction(0.50)
        endloop
        call CameraSetupApplyForPlayer(true, CameraObject[id][cam_i], p, CameraMoveDuration[id][cam_i])
        set CamTimeLeft[id] = CameraTotalDuration[id][cam_i]
        set cam_i = cam_i + 1
    elseif CamTimeLeft[id] > TransTimeLeft[id] then
        loop
        exitwhen TransTimeLeft[id] < 0.50
        set TransTimeLeft[id] = TransTimeLeft[id] - 0.50
        set CamTimeLeft[id] = CamTimeLeft[id] - 0.50
        call TriggerSleepAction(0.50)
        endloop
        call TransmissionFromUnitWithNameBJ(TransmissionReceiver[id][trans_i], TransmissionSpeaker[id][trans_i], TransmissionName[id][trans_i], null, TransmissionText[id][trans_i], bj_TIMETYPE_SET, TransmissionDuration[id][trans_i], false)
        set TransTimeLeft[id] = TransmissionDuration[id][trans_i]
        set trans_i = trans_i + 1
    elseif CamTimeLeft[id] == TransTimeLeft[id] then
        loop
        exitwhen TransTimeLeft[id] < 0.50
        set TransTimeLeft[id] = TransTimeLeft[id] - 0.50
        set CamTimeLeft[id] = CamTimeLeft[id] - 0.50
        call TriggerSleepAction(0.50)
        endloop
        call CameraSetupApplyForPlayer(true, CameraObject[id][cam_i], p, CameraMoveDuration[id][cam_i])
        set CamTimeLeft[id] = CameraTotalDuration[id][cam_i]
        set cam_i = cam_i + 1
        call TransmissionFromUnitWithNameBJ(TransmissionReceiver[id][trans_i], TransmissionSpeaker[id][trans_i], TransmissionName[id][trans_i], null, TransmissionText[id][trans_i], bj_TIMETYPE_SET, TransmissionDuration[id][trans_i], false)
        set TransTimeLeft[id] = TransmissionDuration[id][trans_i]
        set trans_i = trans_i + 1
    endif
    set repeater = repeater + 1
    endloop

    set CameraCount[id] = 0
    set TransmissionCount[id] = 0
endfunction
endlibrary
 
Status
Not open for further replies.
Top