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

My custom error message apears for some reason and I don't know how to solve it

Status
Not open for further replies.
Level 24
Joined
Jun 26, 2020
Messages
1,928
This is hard explain so I will try to explain detaily
-I created a system to replace the normal transmission unit functions.
-There are two structs used and they are Transmission (the entire movie script) and TransmissionElements (the used elements in the transmission).
-The TransmissionElements could be or a line (unit transmission) or an action (between the transmissions) I called those "steps", to differentiate them they have to boolean .isline.
-Each of them have their own elements and when you called an incorrect element (exm you called a line element when is an action it means .isline is false) it displays an error message with the name of the function.
-This function:
vJASS:
method operator Delay takes nothing returns real
    if this.isline then
        debug call BJDebugMsg("This is a line |cffff0000Delay|r")
        return 0.00
    endif
    return this.duration
endmethod
Display the message when this function is called
vJASS:
call BJDebugMsg(I2S(Transmission.instance.NextLineNumber))
But I don't know why because this is the function:
vJASS:
method operator NextLineNumber takes nothing returns integer
    call this.Invalid("NextLineNumber")
    set What=this.next[this.elements]
    loop
        exitwhen What.isline or What==0
        set What=this.next[What]
    endloop
    if What==0 then
        debug call BJDebugMsg("Failed to detect a line |cffff0000NextLineNumber|r")
        return 0
    endif
    return What.NumberLine
endmethod
And the instance is assigned in this moment:
vJASS:
private method cinematic_actions takes nothing returns nothing
     set What=this.elements
    
     if What.GetActions()!=null then
         set thistype.instance=this
         call TriggerExecute(What.GetActions())
         set thistype.instance=0
     endif
    
     if this.scene!=null then
        set thistype.instance=this
        call TriggerExecute(this.scene)
        set thistype.instance=0
    endif
    
    set this.elements=this.next[this.elements]
    
    if What.Delay>0.00 then
        call TimerStart(this.t,What.Delay,false,function thistype.callback)
    else
        call this.what_call()
    endif
    
endmethod
And this is the complete example:
vJASS:
function Trig_Test_Paladin_CINEMATIC_Conditions takes nothing returns boolean
    if ( not ( GetTriggerUnit() == gg_unit_Hmkg_0002 ) ) then
        return false
    endif
    return true
endfunction

function End takes nothing returns nothing
    call ResetToGameCameraForPlayer(Player(0),0)
    call CinematicModeBJ(false,Force(Player(0)))
    call EnableTrigger(gg_trg_Test_Paladin_CINEMATIC_way_3)
endfunction

function PanMK takes nothing returns nothing
    call BJDebugMsg(I2S(Transmission.instance.NextLineNumber))
    call SetCameraFieldForPlayer(Player(0),CAMERA_FIELD_TARGET_DISTANCE,1500.00,0)
    call SetCameraFieldForPlayer(Player(0),CAMERA_FIELD_ROTATION,340.00,0)
    call SetCameraFieldForPlayer(Player(0),CAMERA_FIELD_ANGLE_OF_ATTACK,340.00,0)
    call PanCameraToTimedForPlayer(Player(0),GetUnitX(gg_unit_Hmkg_0002),GetUnitY(gg_unit_Hmkg_0002),0)
endfunction

function PanPala takes nothing returns nothing
    call BJDebugMsg(I2S(Transmission.instance.NextLineNumber))
    call SetCameraFieldForPlayer(Player(0),CAMERA_FIELD_TARGET_DISTANCE,1500.00,0)
    call SetCameraFieldForPlayer(Player(0),CAMERA_FIELD_ROTATION,90.00,0)
    call SetCameraFieldForPlayer(Player(0),CAMERA_FIELD_ANGLE_OF_ATTACK,340.00,0)
    call PanCameraToTimedForPlayer(Player(0),GetUnitX(gg_unit_Hpal_0003),GetUnitY(gg_unit_Hpal_0003),0)
endfunction

function Trig_Test_Paladin_CINEMATIC_Actions takes nothing returns nothing
    local force f=Force(Player(0))
    local Transmission curr=Transmission.create()
    local TransmissionElements what
    call curr.SetTargetForce(f)
    set curr.DefColor=PLAYER_COLOR_RED
    set curr.DefWillWait=true
    set curr.DefTimeType=Transmission.ADD //Or bj_TIMETYPE_ADD
    //Step 1
    set what=curr.AddStep("action")
    set what.Delay=2.00
    //Step 2
    set what=curr.AddStep("action")
    call what.SetActions(function PanMK)
    //Step 3
    set what=curr.AddStep("line")
    set what.Unit=gg_unit_Hmkg_0002
    set what.UnitType='Hmkg'
    set what.Name="Barbarian"
    set what.Sound=gg_snd_H06Arthas01
    set what.Message="Greetings captain."
    //Step 4
    set what=curr.AddStep("action")
    call what.SetActions(function PanPala)
    //Step 5
    set what=curr.AddStep("line")
    set what.Unit=gg_unit_Hpal_0003
    set what.UnitType='Hpal'
    set what.Name="Paladin"
    set what.Sound=gg_snd_H06Uther02
    set what.Message="Greetings."
    //Step 6
    set what=curr.AddStep("line")
    set what.Unit=gg_unit_Hpal_0003
    set what.UnitType='Hpal'
    set what.Name="Paladin"
    set what.Sound=gg_snd_H01Uther07
    set what.Message="Any new information?"
    //Step 7
    set what=curr.AddStep("action")
    call what.SetActions(function PanMK)
    //Step 8
    set what=curr.AddStep("line")
    set what.Unit=gg_unit_Hmkg_0002
    set what.UnitType='Hmkg'
    set what.Name="Barbarian"
    set what.Sound=gg_snd_H06Arthas03
    set what.Message="No Sir."
    //Step 9
    set what=curr.AddStep("action")
    call what.SetActions(function PanPala)
    //Step 10
    set what=curr.AddStep("line")
    set what.Unit=gg_unit_Hpal_0003
    set what.UnitType='Hpal'
    set what.Name="Paladin"
    set what.Sound=gg_snd_H06Uther05
    set what.Message="Well, you can back out."
    //Step 11
    set what=curr.AddStep("action")
    set what.Delay=2.00
    //Step 12
    set what=curr.AddStep("action")
    call what.SetActions(function PanMK)
    //Step 13
    set what=curr.AddStep("line")
    set what.Unit=gg_unit_Hmkg_0002
    set what.UnitType='Hmkg'
    set what.Name="Barbarian"
    set what.Sound=gg_snd_H06Arthas06
    set what.Message="No Sir."
    //End
    call curr.AddEnd(function End)
    call curr.Start()
    call CinematicModeBJ(true,f)
    call DisableTrigger(gg_trg_Test_Paladin_CINEMATIC_way_3)
    set f=null
endfunction

//===========================================================================
function InitTrig_Test_Paladin_CINEMATIC_way_3 takes nothing returns nothing
    set gg_trg_Test_Paladin_CINEMATIC_way_3 = CreateTrigger(  )
    call TriggerRegisterEnterRectSimple( gg_trg_Test_Paladin_CINEMATIC_way_3, gg_rct_Regi__n_001 )
    call TriggerAddCondition( gg_trg_Test_Paladin_CINEMATIC_way_3, Condition( function Trig_Test_Paladin_CINEMATIC_Conditions ) )
    call TriggerAddAction( gg_trg_Test_Paladin_CINEMATIC_way_3, function Trig_Test_Paladin_CINEMATIC_Actions )
endfunction

And I really don't find the reason it displays that error message, specially because the transmission runs normally, can you help me?

This is the map:
 

Attachments

  • Transmission.w3x
    219.3 KB · Views: 12
Level 24
Joined
Jun 26, 2020
Messages
1,928
I found the reason, I used a global variable "What" to not create local variables in all the functions, but I didn't think that in the functions that have a "TriggerExecute" the executed trigger can have functions those also use that "What" variable so they can overwrite it, so in that functions I changed it to a local variable instead.
 
Status
Not open for further replies.
Top