Hi all,

Sorry for the late response to all who've entered this competition. I didn't have access to my computer for the past few days so I couldn't post the results. I know I should have thought of that before starting a contest but, oh well.

I received 5 total entries, 2 of them were correct. That's Quadraxas and upsidedownman. Quadraxas however PMed me first which means he wins. Here's the correct answers:

Originally Posted By: Quadraxas
first i would change the *Value of Goal_FollowJack to 21.

and then, in patrol Goal, if would check if the sID is "Jack" or "Bill", *Value remains 20.
----------------- this all i would change in code.



Originally Posted By: upsidedownman
Would you change the lines in the patrol function like this

if(str_cmpi(sMyid,"Jack")) || ( str_cmpi(sMyid,"Bill"))
*Value = 19;
else *Value = 0;



Quadraxas, please PM me your e-mail address to send you your license information (I have a feeling the one you have in your profile is fake smirk ). And, well done! To be honest, I'll be very happy to have you in our little community, if you do get to use my software. I've read many of your posts here and I like the way you think and work.

upsidedownman, I can see you're new to GS so you should be quite proud since you answered a question right that the majority of entries didn't. A very well done to you..


While at it, I decided to correct the entries that got it wrong, in case you give a hoot.. Here goes:


Originally Posted By: basharsj
void Action_FollowJack(par1,par2,par3,par4)
{
ix_skill(my,is_bActionInProgress)=IS_TRUE;
/////////

if (id_to_ptr(par1) !=NULL ||eToFollow != NULL )
{
is_Action_Run_To_X_Neutral(0,0,0,id_to_ptr(par1));
while(is_IsActionRunning(is_cAction_MoveTo)) wait(1);
}
else
{
is_Action_Run_To_X_Neutral(550,390,110,NULL);
while(is_IsActionRunning(is_cAction_MoveTo)) wait(1);

is_Action_Run_To_X_Neutral(-650,50,110,NULL);
while(is_IsActionRunning(is_cAction_MoveTo)) wait(1);

is_Action_Run_To_X_Neutral(250,-530,110,NULL);
while(is_IsActionRunning(is_cAction_MoveTo)) wait(1);

}

/////////
ix_skill(my,is_bActionInProgress)=IS_FALSE;

}



A couple of errors here. Action_FollowJack would never get activated at all if Jack==NULL since in Goal_FollowJack it makes sure to set its value to 0 when that happens. Also, you don't have access to the eToFollow pointer from Action_FollowJack and finally, putting everything inside the FollowJack goal kinda ruins the whole 'Goal Oriented code' idea..


Originally Posted By: Gorverius
we need to add this code in to the Goal_Patrol function.

ENTITY* ejack;
STRING* sjack = str_create("Jack");
eJack = sId_to_ptr(sjack);
if(str_cmpi(sMyid, "Bill") && ix_skill(ejack, ix_health)<=0; )
{
*value = 20;
}
else
{
*value = 0;
}



You were very very close. But if we were adding that code, then the *value would be replaced later in that function by this line: [i]if(str_cmpi(sMyid,"Jack")) *Value=20; else *Value=0;[i], so instead you should have moved that line in your last else clause to make sure that Goal_Patrol calculates value correctly for both Jack and Bill. Also, if both Goal_Patrol and Goal_FollowJack have the same value (20) and since now both goals are available for Bill, one of the two would be randomly chosen and we don't want that..



Originally Posted By: GamerX
So i would either go to the goal patrol function and add another if statment like this
if(str_cmpi(sMyid,"Bill")) *Value = 15;
else *Value = 0;
If that didn't work i would try and add an or statement into the original Jack line like so,
if(str_cmpi(sMyid,"Jack") || str_cmpi(sMyid,"Bill"))
*Value = 20;
else *Value = 0;

But i am not so sure what will happen if two goals are at 20.



You were even closer.. All you had to do is change *Value to 19 instead of 20 like you pondered correctly at the end.. Don't beat yourself up though, Quadraxas would still win because he PMed me first.


Thanks to everyone who've watched my video and btw happy new years to everyone,

Cheers,
Aris

PS: I've now added a Hi-res and a downloadable version of the tutorial. Check it out.


INTENSE AI: Use the Best AI around for your games!
Join our Forums now! | Get Intense Pathfinding 3 Free!