Page 1 of 1
Ahem... Script points.
Posted: Tue Jan 01, 2008 7:17 pm
by fps
I have never used path points successfuly before.
I want to have pathpoints in my level that represent; patroll paths, cover points, and attack paths (run backwards for retreat paths).
patroll paths are just followed while unalert.
cover points are run to when certain conditions in the script are true and before certain attack orders.
Attack paths are used to keep the pawn from running straight into oncoming fire.
On a retreat order the pawn turns around and looks for the last number in an attack path and follows it backwards untill it runs out. thenit turns and fights again.
I want my survival ai to play a bit like the origional halflife, nothing too fancy.
I have a lot of the orders set up already (suggestions would be nice), i just dont know how to get them to work.
How should i set up my script and such?
Im working on it now. ill let you guys know if i get anywere.
EDIT;;
for now what i want to do is add a command to the idle script
Code: Select all
if no patroll points visible, then go to idle
how should i set that up?
Posted: Wed Jan 02, 2008 12:52 pm
by Juutis
First of all, the paths for pawns are done with ScriptPoints, not PathPoints. PathPoints are a completely different thing. Maybe that's why you haven't used them succesfully?
Anyway, I guess the hardest part of this is to aquire the closest ScriptPoint of the right type. There is a command called:
bool NearestPoint(float MinDistance, float MaxDistance );
Search for the nearest visible ScriptPoint within the range MinDistance - MaxDistance and if one is found, make it the current ScriptPoint (success is indicated by the return value).
But it might return a ScriptPoint belonging to a patrol path when you want to get a cover point. All ScriptPoints are alike to this command. However, there are some little tricks that can be done. You could name all your patrol points something like
patrol1,
patrol2,
patrol3 etc. The attack path would be similar:
attack1,
attack2 etc. And cover points:
cover1,
cover2 etc.
Then, for example if you have 20 patrol points in the level and you want to check which one is closest, you can use this piece of script:
Code: Select all
nearestpatrolpoint_distance = 100000;
nearestpatrolpoint = 0;
for i = 1 to 20 // cycle through all 20 points
{
if(GetDistanceTo("patrol"#i) < nearestpatrolpoint_distance) // if this point is nearer than any of the previous ones
{
nearestpatrolpoint_distance = GetDistanceTo("patrol"#i);
nearestpatrolpoint = i;
}
}
NewPoint("patrol"#nearestpatrolpoint); //set the new scriptpoint
nearestpatrolpoint_distance and
nearestpatrolpoint are variables that you have to define in the start of the script.
You can replace "patrol" with "attack" or "cover" to get the nearest point of the other types.
You can then use the command:
NextPoint();
Get the NextPoint entry from the current ScriptPoint and make it the current ScriptPoint. If no entry exists then the current ScriptPoint will be invalid and references to it will be ignored.
To make the pawn follow the current path.
I hope this gets you started. I know, it may be hard to understand, but I'm in a sort of a hurry so I can't write a more detailed tutorial.
Posted: Thu Jan 03, 2008 4:43 am
by fps
thank you, i will what i can do with this tomorrow after i feed the horses, goats, quail, dogs, quail dogs, ect...
uhh... living on a farm can really suck.
Posted: Thu Jan 03, 2008 5:40 am
by darksmaster923
fps wrote:thank you, i will what i can do with this tomorrow after i feed the horses, goats, quail, dogs, quail dogs, ect...
uhh... living on a farm can really suck.
you live on a farm? with a computer?
gawd, you southerners are reeeealy advanced! what next, flyin machines?
lol, sorry i just had to
Posted: Thu Jan 03, 2008 11:38 am
by vrageprogrammer
Maybe he just went there for the hols...
Posted: Fri Jan 04, 2008 2:57 am
by fps
I can't believe you guys would rip on a guy for living in the country.
ok guys, I realize you apologized but I still need to ream you a new one.
First.
I'm from Pennsylvania, that’s pretty damn north if you ask me.
Second.
Since when were all the farms in the south.
Third.
(don't really know if that’s actually insulting

)
what the hell is a hols.
Fourth.
The best programmer in my college class is from a farm in the deep south.
Fifth.
My best friend from high school is a pilot.
Sixth.
Its not a functional conventional farm, and it hasn’t been for years. it’s a gentleman’s farm that my father owns. I just harvest hay for college money and run the skeet shooting club during the summer, and also I live there, somewhat.
I only have to feed the animals when everyone else works.
Seventh.
Shut up or I will spear you with my pitch fork and hit your dog with mah truck just to make you sad. GRrrRRrRRrRRrAAaaaAAAAaAaa!!!!
Posted: Fri Jan 04, 2008 7:17 am
by vrageprogrammer
fps wrote:
(don't really know if that’s actually insulting

)
what the hell is a hols.
Hols-HOLIDAYS!!
LOL!
Posted: Fri Jan 04, 2008 11:50 am
by Jay
darksmaster, you could really stay a bit more on the topic and not just write everything that comes to your mind, i was going to post something like this already in Spyre's game thread where out of nowhere came 'HE'S A ZOMBIE'. Well that's close to spamming. 'You live on a farm?' was ok, but the rest was not very appropriate.
Posted: Fri Jan 04, 2008 5:39 pm
by darksmaster923
ok ok im sorry
Posted: Fri Jan 04, 2008 6:22 pm
by fps
That's ok, i think i might of overreacted.
Right after i posted that i spent the rest of the night puking my guts out, i get delirious when i get sick.
and as for vrageprogrammer, i posted on your forum because i thought it might have been some crack on me being some kind of "horse lover"

(which i'm not) . hols - horse, hey it could happen.
Oh well, excuse me i need to go and finish throwing my brains up.
Bye, enjoy your illness free sanity.
Posted: Fri Jan 04, 2008 6:35 pm
by vrageprogrammer
fps wrote:That's ok, i think i might of overreacted.
Right after i posted that i spent the rest of the night puking my guts out, i get delirious when i get sick.
and as for vrageprogrammer, i posted on your forum because i thought it might have been some **** on me being some kind of "horse lover"

(which i'm not) . hols - horse, hey it could happen.
Oh well, excuse me i need to go and finish throwing my brains up.
Bye, enjoy your illness free sanity.
fps=nuts?
anyway, back on topic...Er...what was the topic?
Posted: Fri Jan 04, 2008 11:22 pm
by fps
fps=nuts?
uhhh yea. actually.
anyways.
the topic was effectivly using script points for pawn navigation.
i have two further questions.
can you have 2 sets of script points named the same thing?
what are path points for?