Home   Help Search Login Register  

Author Topic: Respawn into a vehicle  (Read 2629 times)

0 Members and 5 Guests are viewing this topic.

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Respawn into a vehicle
« on: 05 Aug 2006, 23:56:02 »
Hi
How would i make it so if a unit respawns, he respawns in a vehicle. This vehicle would have to be created and not already in the mission.

How would i do this?

Thanks

Offline Seven

  • Members
  • *
  • Am I a llama?
Re: Respawn into a vehicle
« Reply #1 on: 06 Aug 2006, 06:18:31 »
Have a "killed" eventhandler with a black in;
create vehicle & assign the unit as driver/cargo while black I'd try
Hope it works for you!

Greetz  8)

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re: Respawn into a vehicle
« Reply #2 on: 06 Aug 2006, 11:05:45 »
Hi
How would i make it so if a unit respawns, he respawns in a vehicle. This vehicle would have to be created and not already in the mission.

How would i do this?

Thanks


if this was a respawning AI, it requires a bit of complexity because the only way of tracking a respawning ai is by the unit name, as this is the only attribute that is common to the old "unit" and the newly respawned "unit" (this imo just about enters the advance scripting area)


if this is only meant to work on a Player unit, then it's fairly easy and utilising a killed event handler on the player as Seven indicated is by far the most efficient way to do this (this is fairly basic) unless the type of vehicle you want to respawn into differs from player to player




INIT.SQS
Quote
Tx_A =player addEventHandler ["killed", {_this exec "playerkilled.sqs"}]

playerkilled.sqs
Quote
_veh = "classname" createvehicle position
Player removeventhandler ["killed",Tx_A]

@ alive player
Tx_A =player addEventHandler ["killed", {_this exec "playerkilled.sqs"}]
@ ! isnull _veh
Player moveindriver _veh
exit

uou will have to add the 
classname
and
position

to the script yourself

Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Respawn into a vehicle
« Reply #3 on: 06 Aug 2006, 15:37:11 »
Thanks.

I try it now ;)

EDIT : The position. Would this be a game logic? or would it be a coordinate?

Also would this work for 1 player, or multiple players.

I want this for a DM, but looking at the script player is global, so it wouldnt work ?
« Last Edit: 06 Aug 2006, 16:24:48 by JasonO »

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Respawn into a vehicle
« Reply #4 on: 06 Aug 2006, 18:18:51 »
"player" is always local.

Offline Seven

  • Members
  • *
  • Am I a llama?
Re: Respawn into a vehicle
« Reply #5 on: 06 Aug 2006, 20:20:38 »
I think it would be better to use random respawn points when it's for a DM;
you can either do that with different spawnpoints by calling them (those are markers) west_respawn   west_respawn_1   west_respawn_2 and so on for the player to respawn. Or use a bunch of gamelogics and make a random respawn script for the player.
Create the vehicle out of sight at a gamelogic;
Then

Code: [Select]
_veh = "classname" createvehicle myGL
Player removeventhandler ["killed",Tx_A]

@ alive player
_pos = getpos player
titlecut [" ","BLACK OUT",0.001]
Tx_A =player addEventHandler ["killed", {_this exec "playerkilled.sqs"}]
@ ! isnull _veh
_veh setpos _pos
Player moveindriver _veh
tittlecut ["","BLACK IN",0.1]
exit

Hope that works.
For random respawn points perform a search there's many topics on that

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Respawn into a vehicle
« Reply #6 on: 12 Aug 2006, 16:29:16 »
I think it would be better to use random respawn points when it's for a DM;
you can either do that with different spawnpoints by calling them (those are markers) west_respawn   west_respawn_1   west_respawn_2 and so on for the player to respawn. Or use a bunch of gamelogics and make a random respawn script for the player.
Create the vehicle out of sight at a gamelogic;
Then

Code: [Select]
_veh = "classname" createvehicle myGL
Player removeventhandler ["killed",Tx_A]

@ alive player
_pos = getpos player
titlecut [" ","BLACK OUT",0.001]
Tx_A =player addEventHandler ["killed", {_this exec "playerkilled.sqs"}]
@ ! isnull _veh
_veh setpos _pos
Player moveindriver _veh
tittlecut ["","BLACK IN",0.1]
exit

Hope that works.
For random respawn points perform a search there's many topics on that

Sorry for the slow reply, but ive been on holiday but im back now so lets continue..

I got an error when player died saying unknow operator removeventhandler.

EDIT: I found problem, a little typo :) Also i found another typo for the fade-in to many 't's in titlecut :D

So now the script to use now is :

Code: [Select]
_veh = "vehiclename" createvehicle gamelogicname
Player removeeventhandler ["killed",Tx_A]

@ alive player
~0.05
_pos = getpos player
titlecut [" ","BLACK OUT",0.001]
Tx_A = player addEventHandler ["killed", {_this exec "playerkilled.sqs"}]
@ ! isnull _veh
_veh setpos _pos
Player moveindriver _veh
_veh lock true
titlecut ["","BLACK IN",0.1]
exit

I added the lock feature since i didnt want ppl getting out of the vehicle.
I also added a small time delay because when the player respawns he randomly ends up in a marker area. Inside the marker area there is 9 triggers. Each takes the player to a diffrent game logic on the map. Therefore random respawn (I use it in all my DM's to avoid scripts :p )

Im gonna see if it works now.  ::)

EDIT II : OK, when it trys to create the vehicle it says the following error :

Code: [Select]
'_veh = "M1Abrams" CreateVehicle vehspawn|#|' Error createvehicle: Type Object, expected Array
Thanks for your help
« Last Edit: 12 Aug 2006, 16:53:15 by JasonO »

Offline Seven

  • Members
  • *
  • Am I a llama?
Re: Respawn into a vehicle
« Reply #7 on: 13 Aug 2006, 17:17:11 »
Quote
'_veh = "M1Abrams" CreateVehicle vehspawn|#|' Error createvehicle: Type Object, expected Array

ehm

Quote
_vspawn = getpos vehspawn
_veh = "vehiclename" createvehicle _vspawn

Player removeeventhandler ["killed",Tx_A]

@ alive player
~0.05
_pos = getpos player
titlecut [" ","BLACK OUT",0.001]
Tx_A = player addEventHandler ["killed", {_this exec "playerkilled.sqs"}]
@ ! isnull _veh
_veh setpos _pos
Player moveindriver _veh
_veh lock true
titlecut ["","BLACK IN",0.1]
exit

Greetz

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Respawn into a vehicle
« Reply #8 on: 15 Aug 2006, 12:57:18 »
Thanks.

I also added to the script that after you respawn you and your vehicle would be transported to one of the 9 random places on the map.

Works great.

Thanks a lot for your help  ;D