Home   Help Search Login Register  

Author Topic: Randomly Teleporting Objects/units?  (Read 533 times)

0 Members and 1 Guest are viewing this topic.

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Randomly Teleporting Objects/units?
« on: 08 Sep 2005, 17:24:36 »
Hi if anyone wishes to answer this question or has a direct link, please provide. OTher if you post please post the necceassary steps of completing the procss. Such as first step to last step.

QUESTION:

!) How do I get a unit/object to teleport anywhere I want to, when the mission starts or if I want to via trigger/waypoint?

2) ALso how do I get an object/unit to teleport to 3 or more different locations when you start the mission to give a difficulty level for players?

Thanks for your time...
Who's hyped for Arma4, long live Arma!

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Randomly Teleporting Objects/units?
« Reply #1 on: 08 Sep 2005, 18:39:30 »
1. take a look at the setpos command.

2. either - create 3 markers and group them to the unit you wish to place randomly

or

create three markers, empty markers are best.

copy/paste the following into a script -

Code: [Select]
_r = random 3
_r = _r - (_r mod 1)

?_r == 1 : unit_name setpos getmarkerpos "marker_1"
?_r == 2 : unit_name setpos getmarkerpos "marker_2"
?_r == 3 : unit_name setpos getmarkerpos "marker_3"

exit

save it as 'choose_position.sqs' and run it from the init line of a unit.
« Last Edit: 08 Sep 2005, 18:40:27 by bedges »

Offline Blanco

  • Former Staff
  • ****
Re:Randomly Teleporting Objects/units?
« Reply #2 on: 08 Sep 2005, 18:53:25 »
You can also do this without any script :
Lets say you need 10 random positions

1- Place your group or unit on the map
2- Place 9 markers (F6) next to them (the current position of your unit /group is the 10th position, so you 'll need 9 markers instead of 10)
3- Group (F2) every marker with that group or unit (when it's a group, you only have to group the marker with the leader)
4- Drag every marker to the place you want them to start.
5- Change all 9 markers to the "empty" type

When you preview the mission the group or unit will randomly start on one of those markerpositions.
Groups will start together btw and it works in MP.
That's all.  :)


« Last Edit: 08 Sep 2005, 19:29:34 by Blanco »
Search or search or search before you ask.

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:Randomly Teleporting Objects/units?
« Reply #3 on: 09 Sep 2005, 03:28:07 »
Or to make it REALLY random, SO random it will virtually never be in the same place twice!!! You can just put this in the units init field:

Code: [Select]
this setpos [(getpos this select 0)+(random 500)-250,(getpos this select 0)+(random 500)-250,0]
The first time you do this its so random you might even think the game messed up and deleted the object! also if thats TOO random you may want to take the numbers down, like to 100-50 or something.
I like your approach, lets see your departure.
Download the New Flashlight Script!

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Re:Randomly Teleporting Objects/units?
« Reply #4 on: 09 Sep 2005, 03:33:36 »
Thanks a lot guys, I solved my question. I used "blanco" idea. Thanks for your idea to everyone else i didn't mention. You may add this to the FAQ if it's not already there OFPEC.  ;D

 :cheers:
Who's hyped for Arma4, long live Arma!