Skip to content

TriggerEvaluate - If a returns nothing condition function contains both return and a boolean function call,TriggerEvaluate wrongly passes. #223

Description

@MoZhaoYun

When the condition function "returns nothing" and employs "return", and if the function contains a function that returns a boolean value,whether it is called directly or used for judgment in an if statement,this will cause the TriggerEvaluate function to pass.

// condition
function Trig_UnnameTrigger_001Conditions takes nothing returns nothing // Note that it is "nothiing" here.
    call BJDebugMsg("run condition")
    
    // call IsPlayerAlly(Player(0),Player(0)) Replaceing the if statement with this will also cause TriggerEvaluate to pass.
    
    if IsPlayerAlly(Player(0),Player(0)) then
    endif
    
	return
endfunction

// action
function Trig_UnnameTrigger_001Actions takes nothing returns nothing
    call BJDebugMsg("run action")
endfunction

// init
function InitTrig_UnnameTrigger_001 takes nothing returns nothing
	set gg_trg_UnnameTrigger_001 = CreateTrigger()
    call TriggerAddCondition(gg_trg_UnnameTrigger_001, Condition(function Trig_UnnameTrigger_001Conditions))
    call TriggerAddAction(gg_trg_UnnameTrigger_001, function Trig_UnnameTrigger_001Actions)
    call ConditionalTriggerExecute(gg_trg_UnnameTrigger_001)
endfunction

In-game output(game version 1.27):
run condition
run action

if the condition function does not use "return" or does not use a statement that returns "boolean",the trigger action will not be excuted.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions