HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Problems with cinematic system

05-09-2007, 07:38 PM#1
Silvenon
I set everything up, read the tutorial carefully, but I still have a problem:

When I fade out on map initialization (black mask), it won't fade in, I don't know why, here's the initialization of cinematic system:

Collapse JASS:
function Trig_Map_Initialization_Actions takes nothing returns nothing
    call InitCinematicSystem()
    call CinematicModeBJ(true, bj_FORCE_ALL_PLAYERS)
    call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0.00, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
    call ActorAssign(gg_unit_U001_0000, 1) //a unit that is already on the map
    call ActorAssign(gg_unit_h005_0007, 2) //same
    set udg_cinS_camera[1] = gg_cam_Camera_001
    set udg_cinS_camera[2] = gg_cam_Camera_002
    set udg_cinS_camera[3] = gg_cam_Camera_003
endfunction

And here's the Scene 1 (runs on map initialization):

Collapse JASS:
function Trig_Init_Scene_1_Actions takes nothing returns nothing
    call WriteToScene(1)
    call ScriptActColour(0, 1, 255, 255, 255, 0, 0)
    call ScriptActAnimPlay(0, 1, 1, 0)
    call ScriptActAnimPlay(0, 2, 1, 0)
    call ScriptCamera(0, 1, 0, 1)
    call ScriptExternalFunc(0, "Trig_Corpses_Setup_Actions")
    call ScriptExternalFunc(0, "Trig_Fade_In_Actions")
    call ScriptExternalFunc(1, "Trig_Spawn_Crows_Actions")
    call ScriptCamera(4.5, 2, 3, 4)
    call ScriptExternalFunc(5.5, "Trig_End_Scene_1_Actions")
endfunction

I started the scene 1 with the action PlayScene(1) in a trigger fires when elapsed time is 3 seconds.

And if you want to see the functions that are called, here they are:

Corpses Setup:

Collapse JASS:
function Trig_Corpses_Setup_Actions takes nothing returns nothing
    local integer i = 1
    local real x1 = CameraSetupGetDestPositionX(gg_cam_Camera_001)
    local real y1 = CameraSetupGetDestPositionY(gg_cam_Camera_001)
    local real x2
    local real y2
    local real r
    local real a
    loop
        exitwhen i > 10
        set r = GetRandomReal(0, 500)
        set a = GetRandomReal(0, 360) * bj_DEGTORAD
        set x2 = x1 + r * Cos(a)
        set y2 = y1 + r * Sin(a)
        call CreateCorpse(Player(PLAYER_NEUTRAL_AGGRESSIVE), 'hfoo', x2, y2, GetRandomReal(0, 360))
        set i = i + 1
    endloop
endfunction

Fade In:

Collapse JASS:
function Trig_Fade_In_Actions takes nothing returns nothing
    call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 1, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
endfunction

Spawn Crows:

Collapse JASS:
constant function SpawnCrows_CrowId takes nothing returns integer
    return 'n001'
endfunction

//===========================================================================

function SpawnCrowsRandom takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local integer i = GetAttachedInt(t, "i")
    local real x = GetAttachedReal(t, "x")
    local real y = GetAttachedReal(t, "y")
    local real r = GetRandomReal(0, 600)
    local real a = GetRandomReal(0, 360) * bj_DEGTORAD
    local real d = 200
    local real x1 = x + r * Cos(a)
    local real y1 = y + r * Sin(a)
    local real x2 = x + d * Cos(a)
    local real y2 = y + d * Sin(a)
    local unit u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), SpawnCrows_CrowId(), x1, y1, 0)
    call IssuePointOrder(u, "move", x2, y2)
    call SetUnitFlyHeight(u, 30, 400)
    set i = i + 1
    call AttachInt(t, "i", i)
    if i == 15 then
        call CleanAttachedVars(t)
        call ReleaseTimer(t)
    else
        set t = null
    endif
    set u = null
endfunction

function Trig_Spawn_Crows_Actions takes nothing returns nothing
    local timer t = NewTimer()
    local integer i = 1
    local real x = CameraSetupGetDestPositionX(gg_cam_Camera_001)
    local real y = CameraSetupGetDestPositionY(gg_cam_Camera_001)
    call AttachReal(t, "x", x)
    call AttachReal(t, "y", y)
    call AttachInt(t, "i", i)
    call TimerStart(t, 0.1, true, function SpawnCrowsRandom)
endfunction

End Scene 1:

Collapse JASS:
function Trig_End_Scene_1_Actions takes nothing returns nothing
    call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 1, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
    call TriggerSleepAction(2)
    call CinematicModeBJ(false, bj_FORCE_ALL_PLAYERS)
    call CameraSetupApply(gg_cam_Camera_003, true, true)
    call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 2, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
    call CinematicCameraDisable()
endfunction

Probably nobody will want to read through this gigantic code, but I'm just optimistic :)

Thanks in advance
05-09-2007, 07:46 PM#2
Anitarf
You need to script a fog, everything is black because the default values for the fog are 0 and that means black fog with 0 distance to camera. Set it to something else with the corresponding actions.
05-10-2007, 07:11 AM#3
Silvenon
Thanks a lot :)

EDIT: I have another problem, but I don't want to open a new thread

I created actors with ActorCreate, and set their position with SetUnitX/SetUnitY somewhere in the forest (they have locust ability(, but for some reason, the go out of the forest and the continue walking in a direction, any idea?
05-10-2007, 01:16 PM#4
Anitarf
What direction are they walking in? Do they ever stop, and where do they stop? In the centre of the map maybe? Is the unit computer controled or player controled? If it's controled by a computer, try the same with a player controled unit.
05-10-2007, 07:17 PM#5
Silvenon
I can't test it right now, but I think they were walking to the centre of the map. They were owned by neutral passive

But I used another method (before I've read yours), to create a unit and then use ActorAssign, would that work? I'm asking because I haven't used them as actors yet, so I don't know if it really works

As soon as I test it, I'll tell you exactly how they move
05-10-2007, 07:34 PM#6
Anitarf
You might be having issues with the unit's guard positions, the solution for that is to use the AI - ignore unit guard position trigger action, however that only works for players 1-12, not neutral ones.
05-12-2007, 09:44 AM#7
Silvenon
Thanks for help :)
05-12-2007, 11:11 AM#8
iNfraNe
just dont use neutral players in cinematic, they are annoying. You can just place a playercontrolled and change its teamcolor to black.