News:

Rings of Reznor!

Main Menu

win/lose secondary mission

Started by bearded, November 05, 2014, 02:33:07 PM

Previous topic - Next topic

bearded

I have this:

addMoveGoal('turtle', 'oconnor_run1', ai.goal.PRI_MED, 'OnTurtleWin', 0, "move", 2)
def OnTurtleWin(event):
Objective_Fail('race_turtle')
speak('turtle', 'SPEECH_TB_FLY_01')
def OnPostInit():
Objective_Register ('race_turtle', 'race_turtle_01', 1, 750)
def OnFlashWin():
Objective_Complete('race_turtle')
addKillAllGoal('turtle',OC_CONTROLLABLE, ai.goal.PRI_HI, replace = 1)


It works mostly. If the turtle gets to the mark first, you lose the secondary mission. If flash gets there first, flash wins the objective. The problem is if flash wins, then the turtle gets within the proper range of the mark, it still then registers as a loss.  What is the best way to fix that? Should I find a way to make the objective complete, or should I simply delete the mark?

stumpy

Maybe just add a check in the fail code so that it doesn't register the fail if the objective is already complete? Something like

addMoveGoal('turtle', 'oconnor_run1', ai.goal.PRI_MED, 'OnTurtleWin', 0, "move", 2)
def OnTurtleWin(event):
if Objective_IsComplete('race_turtle'):
return
Objective_Fail('race_turtle')
speak('turtle', 'SPEECH_TB_FLY_01')
def OnPostInit():
Objective_Register ('race_turtle', 'race_turtle_01', 1, 750)
def OnFlashWin():
Objective_Complete('race_turtle')
addKillAllGoal('turtle',OC_CONTROLLABLE, ai.goal.PRI_HI, replace = 1)
Courage is knowing it might hurt, and doing it anyway. Stupidity is the same. And that's why life is hard. - Jeremy Goldberg

bearded

ah, the mysterious "return", that is what I was looking for, thank you.