[Solved] Event Table woes

So @pascal76680 pointed out in Help Events Table for one mission [Or other things] that Event Tables are stricter in HWRM, but this one is baffling me:

I got so frustrated that I copied the entire tutorial level and lua files and started to modify them. I stripped it back to the simplest event I can find, which I have not touched:

Events.speechevent_bl =
{
    {
        { "Sound_EnterIntelEvent()","" },
    },
    {
        HW2_SubTitleEvent( Actor_FleetCommand, "$50555", 5 ),
    },
    {
        { "Sound_ExitIntelEvent()","" },
    },
} 

I found the function that called this event:

function checkspcl()
    if ( gb == 1 ) and  ( gi == 1 ) and  ( gl == 2 ) and  ( gy == 1 )  then
        Event_Start( "speechevent_bl" )
        gb = 0
        gi = 0
        gl = 0
        gy = 0
    end
end

I changed it to:

function checkspcl()
    Event_Start( "speechevent_bl" )
end

Predictably enough, this function plays the event continually. So, to make it play only once, I changed it to:

function checkspcl()
    Event_Start( "speechevent_bl" )
    Rule_Remove("checkspl")
end

Result: nothing happens.

Another test:

function checkspcl()
    Event_Start( "speechevent_bl" )
    if (Event_IsDone("speechevent_bl")) then
        Rule_Remove("checkspcl")
        Player_SetRU(0, 5000)
    end
end

Result: event is not played, but the player’s RUs are set to 5000. In HW2 you could have a rule that called an event. For some reason this does not seem to work in HWRM. Any ideas what is going on here?

I remeber there being some headaches related to this, but not the ins and outs. What happens if you have a rule call another function that calls the event?

No joy. I am now trying:

function Rule_intermediate()
    Rule_Add( "checkspcl" )
    Rule_Remove( "Rule_intermediate" )
end

function checkspcl()
    Event_Start( "testevent" )
    --if (Event_IsRunning("speechevent_bl")) then
    --    Player_SetRU(0, 5000)
    --end
    if (Event_IsDone("testevent")) then
        Rule_Remove("checkspcl")
    end
end

Changing the event to this:

Events.testevent =
{
    {
        { "Sound_EnterIntelEvent()","" },
        HW2_Letterbox ( 1 ),
    },
    {
        HW2_Wait(3),
        HW2_SubTitleEvent( Actor_FleetCommand, "$50555", 5 ),
    },
    {
        HW2_Wait(2),
        {"Player_SetRU(0, 9000)", ""},
    },
    {
        { "Sound_ExitIntelEvent()","" },
        HW2_Letterbox ( 0 ),
    },
}

Result: Sound plays, letterbox comes, Karen’s voice plays (picked up from the string "$50555"), the letterbox immediately opens, without waiting or showing the subtitle. Player RUs set to 9000. The second block appears to be completely ignored, except that it picks up the voice sound track corresponding to the subtitle. I have tried replacing the subtitle with my own text - same result, but no voice this time, as it can’t pick up the track.

I just don’t understand, especially since the same tutorial lua file has:

function Rule_Harvest()
    Event_Start("intelevent_intro")
    Rule_Remove("Rule_Harvest")        
end

Which seems to me to be exactly what I am doing!

I may be getting somewhere! If I take out the Rule_Remove() part, it plays continuously, with the subtitles showing, but on the very first time, the subtitle is not showing… No idea why, or how to use that to solve the problem, but it feels like progress. Maybe it is something to do with having an event called as soon as the mission starts.

Solved!

Rule_AddInterval( "Rule_intermediate", 20 )

For some reason an interval is required before playing the first event.

maybe that’s the real answer to the camera issues I’ve had…