Home   Help Search Login Register  

Author Topic: Random MP Unit/Base Spawning?  (Read 1610 times)

0 Members and 1 Guest are viewing this topic.

Offline LLeGGo

  • Members
  • *
Random MP Unit/Base Spawning?
« on: 01 Jul 2009, 05:29:15 »
Say at the beginning of a mission (MP) I want OPFOR to spawn at different locales. Meaning ALL of the OPFOR side at the same place. One mission they may spawn at base #1 the next maybe base #5. How exactly would I go about this. I imagine a script set to randomly call up hidden markers at the bases but I have the slightest idea as how to go about it. Sorry, I haven't touched this editor or scripts since OFP, so sorry if this is really vague.

Also, is it possible to do with the base itself if it was pre-made at one location and just moved to the same location as the units?

BTW this is for playable units, not AI if that makes a difference.

Edit:

Ok so i kind of answered my own question. I found this script.

init.sqs
Code: [Select]
;;; array containing all names of gamelogics
tx_spawnpos = [logic1,logic2,logic3]
?(local Player):[] exec "randomspawn.sqs"

randomspawn.sqs
Code: [Select]
~0.5
#INIT
;; following line auto counts the number of locations (gamelogics) that you can setpos too
_countpos = count tx_spawnpos

#START
~0.1
;; selects one of the gamelogics at random
_pos = random _countpos
_pos = (_pos - _pos mod 1)
_position = getpos (tx_spawnpos select _pos)
Player setpos _position
exit

My question now is. How can I make this for every player on the OPFOR side of the server, and ALSO for all vehicles and buildings with them. Not just bring the vehicles/buildings with them, but have them spawn in the same way they were created? I imagine they will do that regardless, but I have yet to figure out how to get them to go anyways. Any help is much appreciated.

Edit2:How can I make this so only one side, OPFOR, does this random spawning? I want the BLUFOR to spawn in one static position.
« Last Edit: 01 Jul 2009, 08:22:42 by LLeGGo »