Home   Help Search Login Register  

Author Topic: Base Spawning  (Read 1196 times)

0 Members and 1 Guest are viewing this topic.

DeKiller

  • Guest
Base Spawning
« on: 09 Aug 2005, 05:55:24 »
IN a MP mission im making i am trying to make it so:

get on the island at a drop off. once they have hit the ground with the chopper that tanks and ammo creates etc spawn. How would i go about that?

-DeKiller

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Base Spawning
« Reply #1 on: 10 Aug 2005, 16:53:54 »
first of all the most efficient way (not causing framerate lag during the createvehicle process) is to create these objects in the missi0on editor in a safe non playing area and name them rather than using createunit etc in a script

then initiating a script, either via an addaction on the helo or to a player, or even a trigger

something like the following placed in the init field of the helicopter

tx_1=this addaction ["Unload helo","unload.sqs"]

Place the following in the INIT.sqs

INIT.sqs
tx_base = [obj1,obj2,obj3,obj4,obj5,obj6]

;;obj1 etc, being the names of the individual objects

and then have the following script

Unload.sqs
Quote
#INIT
_veh = _this select 0
_action = _this select 2
_count = count tx_base
_pos = getpos _veh
_a = getpos _veh select 0
_b = getpos _veh select 1
_element = 0
_veh removeaction _action

#START
_2
_a = _a + 5
_b = _b + 5
tx_base select _element setpos [a,b]
_element = _element + 1
if(_element > (_count -1))then{exit}else{goto "START"}

the above system counts to see how many objects you need setpossing, eg the contents of the tx_base array
and then it loops, selecting each object in turn and then setpossing them in a slightly different position in relation to the helicopter each time, until they have all been setpoosed

You can test using different spacings

eg
_a= _a + 7
_a = _a - 6


you can keep the _b value constant, therefore spawning them in a straight line with a spacing of 5 between each object

or you can do some fancy maths

the following line setposses 1 object to the rear of a vehicle
maybe you can mess with these settings a bit

_dir = getDir _veh
 _pos = [(getPos _veh select 0) + (5 * sin(_dir - 180)),(getPos _veh select 1) + (5 * cos(_dir - 180)),0]
b
« Last Edit: 11 Aug 2005, 15:43:28 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

DeKiller

  • Guest
Re:Base Spawning
« Reply #2 on: 11 Aug 2005, 14:10:46 »
thankyou for this help mate! :) cheers :) i will reply again if it does not work. thanks.