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

RE: Camera Distance

Status
Not open for further replies.
Level 5
Joined
Jun 21, 2011
Messages
119
Hellow.
I'm writing this post again cause i'm still NOT UNDERSTAND this (Yaa, i'm total newbie in JASS atm)..

I've found a JASS camera system. It was any "spell" map from Hive. Ofc i've copied this trigger and removed map <F..F..FACEPALM>.

Kay.. I know it was lame... but now the question.
How i can set camera for more than one player? What i would add/delete/or change in this JASS trigger?


JASS:
function Trig_CameraForced_Actions takes nothing returns nothing
    local camerasetup c = GetCurrentCameraSetup()
    local player p = GetTriggerPlayer()
    local real Dist = CameraSetupGetField(c, CAMERA_FIELD_TARGET_DISTANCE ) + 200
    
    if (GetLocalPlayer() == p) then

        call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, Dist, 0.10)
        call SetCameraField(CAMERA_FIELD_FARZ, 5000., 0.10)
    endif
    
    set p = null
    set c = null
    set Dist = 0.00
endfunction


function InitTrig_CameraForced takes nothing returns nothing
    set gg_trg_CameraForced = CreateTrigger(  )
    call TriggerRegisterPlayerEvent(gg_trg_CameraForced, Player(0), EVENT_PLAYER_END_CINEMATIC)
    call TriggerAddAction( gg_trg_CameraForced, function Trig_CameraForced_Actions )
    set gg_trg_CameraForced = null
endfunction
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Hellow.
I'm writing this post again cause i'm still NOT UNDERSTAND this (Yaa, i'm total newbie in JASS atm)..

I've found a JASS camera system. It was any "spell" map from Hive. Ofc i've copied this trigger and removed map <F..F..FACEPALM>.

Kay.. I know it was lame... but now the question.
How i can set camera for more than one player? What i would add/delete/or change in this JASS trigger?


JASS:
function Trig_CameraForced_Actions takes nothing returns nothing
    local camerasetup c = GetCurrentCameraSetup()
    local player p = GetTriggerPlayer()
    local real Dist = CameraSetupGetField(c, CAMERA_FIELD_TARGET_DISTANCE ) + 200
    
    if (GetLocalPlayer() == p) then

        call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, Dist, 0.10)
        call SetCameraField(CAMERA_FIELD_FARZ, 5000., 0.10)
    endif
    
    set p = null
    set c = null
    set Dist = 0.00
endfunction


function InitTrig_CameraForced takes nothing returns nothing
    set gg_trg_CameraForced = CreateTrigger(  )
    call TriggerRegisterPlayerEvent(gg_trg_CameraForced, Player(0), EVENT_PLAYER_END_CINEMATIC)
    call TriggerAddAction( gg_trg_CameraForced, function Trig_CameraForced_Actions )
    set gg_trg_CameraForced = null
endfunction

It already does that, all you have to do is check this part of your code:
JASS:
call TriggerRegisterPlayerEvent(gg_trg_CameraForced, Player(0), EVENT_PLAYER_END_CINEMATIC)

Can you tell me which event this is and for which player it applies ;)?
Hints:
You might want to add more events...
In Jass indexes work as followed: 0 -> 1, 1 -> 2, 2 -> 3 etc...

If these hints are still to unclear (which I highly doubt) then I'll just post the answer...
 
Level 5
Joined
Jun 21, 2011
Messages
119
1. I think it's:
JASS:
Player(0)
, right?


2. Probly player one (red), cause with another colors not working (tested on my friend).



Well i can fix it adding integers?

JASS:
call TriggerRegisterPlayerEvent(gg_trg_CameraForced, Player(0, 1, 2, 3, 6, 8), EVENT_PLAYER_END_CINEMATIC
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
So... The trigger now has 1 event for player 1 which contains whenever player 1 ends a cinematic...

What would we need to do in order to make it work for all players?

EDIT: no, you can not add extra indexes, you can of course loop them and then use GetForLoopIndexA or... You can add extra lines of code for each player... Whatever you want ;)

also: try adding such events in GUI and convert them to Jass, see what happens ;)
Hint: add the events for each player, click on edit -> convert to custom text
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
That is one of the possibilities yes, try my last edit first ;)

EDIT: nevermind I'll just do it for you:

  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
      • Player - Player 2 (Blue) skips a cinematic sequence
      • Player - Player 3 (Teal) skips a cinematic sequence
      • Player - Player 4 (Purple) skips a cinematic sequence
    • Conditions
    • Actions

JASS:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Untitled_Trigger_001, Player(0) )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Untitled_Trigger_001, Player(1) )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Untitled_Trigger_001, Player(2) )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction

of course TriggerRegisterPlayerEventEndCinematic also works, but it's not advised. Use the one you have previously.
This was just to show you what I meant with converting to custom text, it looks rather similar doesn't it?
 
Level 5
Joined
Jun 21, 2011
Messages
119
You mean this (ofc it's example with player chats message)
JASS:
function Trig_q_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_q takes nothing returns nothing
    set gg_trg_q = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_q, Player(0), "qwe", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_q, Player(1), "qwe", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_q, Player(2), "qwe", true )
    call TriggerRegisterPlayerChatEvent( gg_trg_q, Player(3), "qwe", true )
    call TriggerAddAction( gg_trg_q, function Trig_q_Actions )
endfunction

Sorry, forgot to copy all code
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
B.t.w. here's an example of what I meant with loop the index:

JASS:
function InitTrig_CameraForced takes nothing returns nothing
    set gg_trg_CameraForced = CreateTrigger(  )
    local integer i = 0
    loop
        exitwhen i > 11
            call TriggerRegisterPlayerEvent(gg_trg_CameraForced, Player(i), EVENT_PLAYER_END_CINEMATIC)
        set i = i + 1
    endloop
    set i = null
    call TriggerAddAction( gg_trg_CameraForced, function Trig_CameraForced_Actions )
    set gg_trg_CameraForced = null
endfunction

This will call TriggerRegisterPlayerEvent 12 times, from 0 to 11 for each player.
When the loop is done I nullify the variable so that it's empty and does not take any memory.

EDIT: Now you can see what an advantage Jass can have over GUI. In GUI you won't be abled to use a loop to add extra events now can you :)?
Unless you do that from an external trigger ofcourse... But still, way easyer then adding all these lines one by one...

For example if your creating a maze where you have to create a trigger that works with regions: Whenever a unit enters region blah blah blah and you need a few hundred or thousands of these, in Jass you can simply index a variable to contain all these regions, then loop through the index to add the event to the trigger instead of manually having to add hundreds of events in GUI by clicking for hours...
 
Last edited:
Status
Not open for further replies.
Top