Home   Help Search Login Register  

Author Topic: Respawn planes  (Read 1410 times)

0 Members and 1 Guest are viewing this topic.

CptBravo

  • Guest
Respawn planes
« on: 26 Nov 2005, 19:14:15 »
Hey everyone,

I have searched for a script that spawns/respawns "flying" planes but could not find any. I have spawn scripts for tanks and soldeirs.

Any scripts out there that can respawn planes in air once its destropyed??

Thanks for the help.


CptBravo

  • Guest
Re:Respawn planes
« Reply #1 on: 28 Nov 2005, 18:26:35 »
Anyone out there??  ???

Any help is highly appreciated!  :)

chupchup

  • Guest
Re:Respawn planes
« Reply #2 on: 28 Nov 2005, 19:18:25 »
Try this out:-

>>>>>cut>>>>>>
goto "init"
#loop
~20
? !alive _plane: _plane = "a10" createUnit [_pos,grpplane1,"",1.0,"captain"]; _plane setdir 0; _plane setvelocity [0,300,0];_plane flyinheight 100
goto "loop"
#init
_plane = _this select 0
_obj = _this select 1
_pos = [getpos _obj select 0, getpos _obj select 1, 300]
goto "loop"
>>>>>cut>>>>>>

name the above script "planespawn.sqs" and save it into the mission folder.
change the "a10" to the class name of whatever plane you want (retaining the brackets).
enter the following in the init line of the starting plane in the editor:

>>>>>cut>>>>>>
grpplane1 = group this; [this, planespawn] exec "planespawn.sqs"
>>>>>cut>>>>>>

place an object on the map where you want the planes to spawn at and name it:-
planespawn
The planes will spawn 300m above this point with an initial velocity of 300km/h in a northerly direction.

You can test the script by standing near the planespawn object and getting your original plane to fly into a trigger set to detect all with:-
this setdammage 1
in the init field. (don't move into the trigger area and set it so your original plane doesn't start in it either). You should get a new plane within 20 seconds of the demise of the first.

see how this goes.

chupchup

  • Guest
Re:Respawn planes
« Reply #3 on: 28 Nov 2005, 20:13:49 »
I only just noticed that this is the "Multiplayer Scripting" thread, oops. It is late here (or early depending on how you want to look at it) :).

In the script under:
#init
add the line:
>>>>>>cut>>>>>>
?!(local Server): exit
>>>>>>cut>>>>>>

create a game logic in the mission editor and name it:
server

This will ensure that the script only runs on the server and not on all the clients.