Ahem... Script points.

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
fps
Posts: 504
Joined: Mon Sep 26, 2005 9:54 pm
Location: in a magical land devoid of hope, happiness, and sanity.

Ahem... Script points.

Post 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?
Last edited by fps on Thu Jan 03, 2008 4:41 am, edited 1 time in total.
1 wrote:
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.

2 wrote:
You say that like it's a bad thing.

1 wrote:
You are a bad thing.
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post 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.
Pain is only psychological.
User avatar
fps
Posts: 504
Joined: Mon Sep 26, 2005 9:54 pm
Location: in a magical land devoid of hope, happiness, and sanity.

Post 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.
1 wrote:
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.

2 wrote:
You say that like it's a bad thing.

1 wrote:
You are a bad thing.
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Post 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
Herp derp.
User avatar
vrageprogrammer
Posts: 566
Joined: Wed Oct 31, 2007 2:59 pm
Location: On top of a tree
Contact:

Post by vrageprogrammer »

Maybe he just went there for the hols...
It was not Possible to determine the dimensions of the image....
User avatar
fps
Posts: 504
Joined: Mon Sep 26, 2005 9:54 pm
Location: in a magical land devoid of hope, happiness, and sanity.

Post 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!!!!
1 wrote:
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.

2 wrote:
You say that like it's a bad thing.

1 wrote:
You are a bad thing.
User avatar
vrageprogrammer
Posts: 566
Joined: Wed Oct 31, 2007 2:59 pm
Location: On top of a tree
Contact:

Post by vrageprogrammer »

fps wrote: (don't really know if that’s actually insulting :? )
what the hell is a hols.
Hols-HOLIDAYS!!
LOL!
It was not Possible to determine the dimensions of the image....
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Post 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.
Everyone can see the difficult, but only the wise can see the simple.
-----
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Post by darksmaster923 »

ok ok im sorry
Herp derp.
User avatar
fps
Posts: 504
Joined: Mon Sep 26, 2005 9:54 pm
Location: in a magical land devoid of hope, happiness, and sanity.

Post 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" :shock: (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.
1 wrote:
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.

2 wrote:
You say that like it's a bad thing.

1 wrote:
You are a bad thing.
User avatar
vrageprogrammer
Posts: 566
Joined: Wed Oct 31, 2007 2:59 pm
Location: On top of a tree
Contact:

Post 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" :shock: (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?
It was not Possible to determine the dimensions of the image....
User avatar
fps
Posts: 504
Joined: Mon Sep 26, 2005 9:54 pm
Location: in a magical land devoid of hope, happiness, and sanity.

Post 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?
1 wrote:
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.

2 wrote:
You say that like it's a bad thing.

1 wrote:
You are a bad thing.
Post Reply