Page 1 of 1

Player Function

PostPosted: Thu Apr 12, 12 12:29 pm
by SimonDenton
Hey guys,

Nice and simple problem today. We have the function in DeusExPlayer:
exec function GoalAdd( Name goalName, String goalText, optional bool bPrimaryGoal ).

When I put in something like Player.GoalAdd('KitchenGoal', "Get me a sandwich", True); there is an error that says bad or missing parameter 1.

I tried something different:

Code: Select all
function Timer()
{

local DeusExGoal goal;
local Name goalName;
local string goalText;

if(Flags.GetBool('Ready'))
{
goalName = 'KitchenGoal';
goalText = "Get me a sandwich";
goal = Player.AddGoal(goalName, True);
goal.SetText(goalText);
}
}


But walking into a flag that set 'Ready' in a test level didn't get the goal up.

How is the goal function not working?

PostPosted: Thu Apr 12, 12 12:38 pm
by Alex
Try debugging a bit: Does your code actually pass the if clause? (So was the bool/flag properly set?)

Also, did you activate the Timer() function? (by SetTimer)

Code: Select all
function Timer()
{
local DeusExGoal goal;
local Name goalName;
local string goalText;

if(Flags.GetBool('Ready'))
{
Log("Ready!", 'DEBUG');
goalName = 'KitchenGoal';
goalText = "Get me a sandwich";
goal = Player.AddGoal(goalName, True);
goal.SetText(goalText);
Log("GOAL DEBUG:"@goal, 'DEBUG');
}
}

PostPosted: Thu Apr 12, 12 1:03 pm
by SimonDenton
Thanks for the prompt reply Alex!

I actually simply forgot to put in Super.Timer(); after the variables. It works!

Thanks for your help Alex! But still, what is wrong with the Player.GoalAdd function?

PostPosted: Thu Apr 12, 12 1:31 pm
by Alex
GoalAdd is a 'cheat', so to say. So you have to enable cheats in order to use it.
Code: Select all
exec function GoalAdd( Name goalName, String goalText, optional bool bPrimaryGoal )
{
   local DeusExGoal newGoal;

   if (!bCheatsEnabled)
      return;

   newGoal = AddGoal( goalName, bPrimaryGoal );
   newGoal.SetText( goalText );
}

PostPosted: Thu Apr 12, 12 2:13 pm
by SimonDenton
Weird...AddGoal() doesn't work either. I thought burden's Goal Add Trigger used those functions.

PostPosted: Thu Apr 12, 12 5:32 pm
by Alex
Have you debugged it though? Did that give you any information on where it stops?

PostPosted: Wed Apr 18, 12 6:28 am
by SimonDenton
Yeah it doesn't seem to work but my current mission script method will do.

Thanks for the assistance!