Jump to content
Sign in to follow this  
Duke101

Random waypoint postion for ending?

Recommended Posts

Hi,

Hoping someone can point in the right direction (so to speak!).

I want to create for fun a PvP type mission for my group, where you have a hunter force (augmented by ai) and an "escape" group. But what I would like are some random points (5 or 6 whatever) as an objective (where the escape group win if they make it). Just so there's some replay ability and no doubt people will try both groups and obviously don't want the players to know the location where the escape group are heading for, etc.

I know you can have random starts, but I want a random end, if you see what I mean ? I'm pretty new scripting.

Could someone help out or at least get me started please.

Many thanks.

Share this post


Link to post
Share on other sites

Ok, for example this. Place let´s say 3 markes in 3 directions opposite of the starting one: for example if the start is on western Stratis, place those markers in south, east and north stratis.

Name them, let's say "Marker1", "Marker2" and "Marker3"

Now, in the script on which you are putting waypoints for the escaping group, creating the last one let's do this.

_marker = ["Marker1", "Marker2", "Marker3"] call BIS_Fnc_selectRandom;

_pos = getMarkerPos _marker;

Now you have the position of one of these, randomly selected.

Let's give it another randomization dosis:

_posfinal = [_pos, 200, random 360] call BIS_Fnc_relPos;

Now as _posfinal you've got a position on which put the last waypoint- Every replay, positions will be different.

If you lack of knowledge about creating waypoints in script: some practice and comef are your friends :)

Share this post


Link to post
Share on other sites
Ok, for example this. Place let´s say 3 markes in 3 directions opposite of the starting one: for example if the start is on western Stratis, place those markers in south, east and north stratis.

Name them, let's say "Marker1", "Marker2" and "Marker3"

Now, in the script on which you are putting waypoints for the escaping group, creating the last one let's do this.

_marker = ["Marker1", "Marker2", "Marker3"] call BIS_Fnc_selectRandom;

_pos = getMarkerPos _marker;

Now you have the position of one of these, randomly selected.

Let's give it another randomization dosis:

_posfinal = [_pos, 200, random 360] call BIS_Fnc_relPos;

Now as _posfinal you've got a position on which put the last waypoint- Every replay, positions will be different.

If you lack of knowledge about creating waypoints in script: some practice and comef are your friends :)

Thanks Barboloni! :) I really appreciate your help and suggestions. I think I get what you're saying here. Yeah, I have no experience in making a waypoint script, as I've only made coop missions- there is only one waypoint needed though ;) in this PvP, that is where the players need to get to for extraction/safety, whatever. I will try and work it out, but at least I have a start.

Thank you.

Share this post


Link to post
Share on other sites

Only one WP? Then it's easy to mix to what I said. Let's do it without extarnal scripting. Tacky but effective.

Remember we've got a variable _posfinal which is a random position taken 200 mts distance from one marker picked up ramdomly too?

Now, name the group of the "escapers". Put on the leader's init field: evaders = group this; Put the markers as I said.

Now place a trigger, condition "true" so it will fire, once, and on act box:

marker = ["Marker1", "Marker2", "Marker3"] call BIS_Fnc_selectRandom;

pos = getMarkerPos marker;

posfinal = [pos, 200, random 360] call BIS_Fnc_relPos;

(remember those markers cannot be closer than 200 mts from the sea, if not, posfinal may be a water position and you will make the people swim, which is boring and cold)

wp0 = evaders addWaypoint [posfinal,0];

wp0 setWaypointType "MOVE";

DONE!!!

Share this post


Link to post
Share on other sites
Only one WP? Then it's easy to mix to what I said. Let's do it without extarnal scripting. Tacky but effective.

Remember we've got a variable _posfinal which is a random position taken 200 mts distance from one marker picked up ramdomly too?

Now, name the group of the "escapers". Put on the leader's init field: evaders = group this; Put the markers as I said.

Now place a trigger, condition "true" so it will fire, once, and on act box:

marker = ["Marker1", "Marker2", "Marker3"] call BIS_Fnc_selectRandom;

pos = getMarkerPos marker;

posfinal = [pos, 200, random 360] call BIS_Fnc_relPos;

(remember those markers cannot be closer than 200 mts from the sea, if not, posfinal may be a water position and you will make the people swim, which is boring and cold)

wp0 = evaders addWaypoint [posfinal,0];

wp0 setWaypointType "MOVE";

DONE!!!

Thanks so much! That works perfectly. :yay: I also created a random start position for the "evaders" as well- so overall this should work well now. Thanks again, appreciated.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×