OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Mad Pup on 08 Feb 2012, 21:32:13

Title: [SOLVED]Set Waypoint?/Driving?
Post by: Mad Pup on 08 Feb 2012, 21:32:13
I used to play an MP mission that had vehicles driving around, rotating between game logics. Would that be a setWayPoint script?
This mission also had you pick up a "package" from one store, and deliver it to another store. But there were multiple stores, and it was selected randomly.
Now how do I get it to select one game logic position randomly, and set a waypoint for the player to that game logic?
Thanks in advance!
 
-MadPup  :D
Title: Re: Set Waypoint?/Driving?
Post by: Gruntage on 08 Feb 2012, 21:42:22
The 'setwppos' command should prove useful here:

Code: [Select]
[player, 1] setwppos getpos logic1
'setwppos' is set out like this:

Code: [Select]
[nameofunit, waypoint index (1 for 1st wp, 2 for 2nd etc)] setwppos whereyouwant
So you say you want the player's waypoint location to be random each time? Well, you'll want to do something like this:

Code: [Select]

_NUMBERS = 5
_NUMB = random _NUMBERS

?(_numb < 1): [player, 1] setwppos getpos logic1
?( (_numb > 1)  and (_numb <= 2) ): [player, 1] setwppos getpos logic2
?( (_numb > 2)  and (_numb <= 3) ): [player, 1] setwppos getpos logic3
?( (_numb > 3)  and (_numb <= 4) ): [player, 1] setwppos getpos logic4
?( (_numb > 4)  and (_numb <= 5) ): [player, 1] setwppos getpos logic5


That code will place the player's first waypoint at one of 5 locations (each location is given by a gamelogic). You can increase the number of locations by changing 5 to whatever number you want, but you'll have to make conditions for it like I have done.

Hope this helps
Title: Re: Set Waypoint?/Driving?
Post by: Mad Pup on 08 Feb 2012, 22:01:55
OOHHHHH this makes sense.  :clap: Gruntage, thanks once again!

Another question (unfortunately I ask a lot): I've seen it before, and can't seem to find it in any scripts, but whats the command to skip to a certain time? From like 12:00 pm to 8:30 pm.

-Mad Pup
Title: Re: Set Waypoint?/Driving?
Post by: Gruntage on 08 Feb 2012, 22:04:17
It's:

Code: [Select]
skiptime numberofhours
So if you want to skip 8 hours, you use it like this:

Code: [Select]
skiptime 8
If you want it to skip something more precise, like 12 hours 30 minutes you would do this:

Code: [Select]
skiptime 12.5
That should do it  :good:
Title: Re: Set Waypoint?/Driving?
Post by: Mad Pup on 08 Feb 2012, 22:22:26
Thats it!
Thank you Gruntage!  :clap: :clap:

-MadPup