Editors Depot - Mission Editing and Scripting > Arma2 - Editing/Scripting Multiplayer

Random MP Unit/Base Spawning?

(1/1)

LLeGGo:
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: ---;;; array containing all names of gamelogics
tx_spawnpos = [logic1,logic2,logic3]
?(local Player):[] exec "randomspawn.sqs"
--- End code ---

randomspawn.sqs

--- Code: ---~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
--- End code ---

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.

Navigation

[0] Message Index

Go to full version