• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Cinematic Issue

Status
Not open for further replies.
Level 13
Joined
Jul 26, 2008
Messages
1,009
So I'm relatively new to cinematics, and I was using this to try to pull off a simple cinematic. Unfortunately, it freezes and doesn't end. Why?

JASS:
 local integer id = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
      //A few if statements later, then this
            call CinematicModeExBJ( true, bj_FORCE_PLAYER[id], 0.8 )
            call TransmissionFromUnitWithNameBJ( bj_FORCE_PLAYER[id], Bishop, "|cffaca899BISHOP|r", null, "You have cut off the network that moves them, and sealed them above the surface. Because of that they will grow weaker, but stopping them there is only the beginning. We must perservere in deterring their movements; Never give up.", bj_TIMETYPE_SET, 15.00, true )
            //Freezes and doesn't go past here
            call CinematicModeExBJ( false, bj_FORCE_PLAYER[id], 0.8 )
 
Transmissions use TriggerSleepAction to work afaik. Post the entire code. If you have it in something like a timer callback or a forgroup callback or in a condition, then that is causing the problem. Try putting that code in a separate function and execute it by making a trigger and adding it as an action then calling TriggerExecute or just using the func.execute jasshelper feature.
 
Level 13
Joined
Jul 26, 2008
Messages
1,009
I'll look into what you're saying purge. For now here's the full code.

JASS:
scope SubwayQuest initializer init

globals
    public trigger array Quest
    public boolean array Started
    public boolean array Finished
endglobals

private function PingIt takes nothing returns boolean
    if GetDestructableTypeId(GetFilterDestructable()) == 'DTlv' then
        call PingMinimapForPlayer( GetOwningPlayer(TEMP), GetDestructableX(GetFilterDestructable()), GetDestructableY(GetFilterDestructable()), 10 )
    endif
 return false
endfunction

function AreHavensUnlocked takes nothing returns boolean
    return IsTriggerEnabled(TPHaven4th_Trigger[0]) and IsTriggerEnabled(TPHaven5th_Trigger[0]) and IsTriggerEnabled(TPHaven8th_Trigger[0]) and IsTriggerEnabled(TPHaven12th_Trigger[0]) and IsTriggerEnabled(TPHaven14th_Trigger[0])
endfunction

private function Actions2 takes nothing returns boolean
 local integer id = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
    if RectContainsUnit(gg_rct_BishopHome, Bishop) and GetTriggerUnit() == Slayer[id] and Started[id] and not(IsUnitType(Bishop, UNIT_TYPE_DEAD) or Finished[id] or AreHavensUnlocked()) then
        set Finished[id] = true
        call ClearScreenForce(bj_FORCE_PLAYER[3])
        if not(IsUnitInGroup(Bishop, inBattle) or IsUnitInGroup(Slayer[id], inBattle))then
            call CinematicModeExBJ( true, bj_FORCE_PLAYER[id], 0.8 )
            call TransmissionFromUnitWithNameBJ( bj_FORCE_PLAYER[id], Bishop, "|cffaca899BISHOP|r", null, "You have cut off the network that moves them, and sealed them above the surface. Because of that they will grow weaker, but stopping them there is only the beginning. We must perservere in deterring their movements; Never give up.", bj_TIMETYPE_SET, 15.00, true )
            call CinematicModeExBJ( false, bj_FORCE_PLAYER[id], 0.8 )
        endif
        call DisplayTextToPlayer( Player(3), 0, 0, "|cffaca899BISHOP|r: You have cut off the network that moves them, and sealed them above the surface. Because of that they will grow weaker, but stopping them there is only the beginning. We must perservere in deterring their movements; Never give up." )
        call SetPlayerState(Player(id), PLAYER_STATE_RESOURCE_LUMBER, GetPlayerState(Player(id), PLAYER_STATE_RESOURCE_LUMBER) + 15 )
        call DisplayColoredTagTarget(GetTriggerUnit(), "+15")
    endif
 return false
endfunction

private function Actions1 takes nothing returns boolean
 local integer id = GetPlayerId(GetTriggerPlayer())
    if RectContainsUnit(gg_rct_BishopHome, Slayer[id]) and not(IsUnitType(Bishop, UNIT_TYPE_DEAD) or Started[id])then
        if GetHeroLevel(Lieutenant) > 4 then
            set Started[id] = true
            call ClearScreenForce(bj_FORCE_PLAYER[id])
            if not(IsUnitInGroup(Bishop, inBattle) or IsUnitInGroup(Slayer[id], inBattle))then
                call CinematicModeExBJ( true, bj_FORCE_PLAYER[id], 0.8 )
                call TransmissionFromUnitWithNameBJ( bj_FORCE_PLAYER[id], Bishop, "|cffaca899BISHOP|r", null, "The underground tunnels that connect the city were forged with the coal powered locomotive in mind. It's quite the ingenious device. Still the tunnels have given rise to the underground havens, where the vampires hide from the sun while moving around the city. Close off every haven and return to me with them all closed. Cut off their network and you wil effectively leave them hindred.", bj_TIMETYPE_SET, 15.00, true )
                call CinematicModeExBJ( false, bj_FORCE_PLAYER[id], 0.8 )
            endif
            set TEMP = Slayer[id]
            call EnumDestructablesInRect( bj_mapInitialPlayableArea, function PingIt, null )
            call DisplayTextToPlayer(Player(id), 0, 0, "|cffaca899BISHOP|r: The underground tunnels that connect the city were forged with the coal powered locomotive in mind. It's quite the ingenious device. Still the tunnels have given rise to the underground havens, where the vampires hide from the sun while moving around the city. Close off every haven and return to me with them all closed. Cut off their network and you wil effectively leave them hindred." )
            if Quest[2] == null then
                set Quest[2] = CreateTrigger()
                    call TriggerRegisterEnterRectSimple( Quest[2], gg_rct_BishopHome )
                    call TriggerAddCondition( Quest[2], function Actions2 )
            endif
        else
            call DisplayTextToPlayer(Player(id), 0, 0, "|cffaca899BISHOP|r: Your heart is willing, but your body is weak. Ask again when you've reached level 5." )
        endif
    endif
 return false
endfunction

//===========================================================================
public function init takes nothing returns nothing
 local integer i = 0
 set Quest[1] = CreateTrigger()
    loop
     exitwhen i > 11
        call TriggerRegisterPlayerChatEvent( Quest[1], Player(i), "-subway", true )
        set i = i + 1
    endloop
    call TriggerAddAction( Quest[1], function Actions1 )
endfunction

endscope
 
Well, apparently actions leak. But that only really matters when you have dynamic triggers (or triggers that you destroy). There is a bit of a speed difference (100% negligible) between actions and conditions but it is minor, at least according to benchmarks.

But the list goes on and on when it comes to actions vs conditions. However, in this case you might as well use actions, unless you are willing to use timers for all your waits, which is a bit annoying at times.
 
Status
Not open for further replies.
Top