snipman 0 Posted August 25, 2005 Hi..... Im Trying To Find A Way To Respawn Players in Multiplayer At A Certain Height....... In My Case On A Carrier... I Was Wondering If Anyone has a answer to this post Share this post Link to post Share on other sites
Trapper 0 Posted August 25, 2005 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> #l1 @ alive player player setpos [(getpos player select 0),(getpos player select 1),7.5] goto "l1" You can use this script for it. Everytime a player spawns (or the missions starts) he will be positioned in the height you choose. Here at 7.5m: player setpos [(getpos player select 0),(getpos player select 1),7.5] EDIT: You can use a trigger, too: Multiple activation trigger Condition: alive player OnActivation: player setpos [(getpos player select 0),(getpos player select 1),7.5] Share this post Link to post Share on other sites
Garcia 0 Posted August 25, 2005 that script won't work...it will loop all the time. '@alive player' checks if the player is alive, if the player is, then move on in the script. And since it's usual for the player to actually be alive, then that script will always move on unless the player dies, and therefor the player will be setpossed lots of times each second. in your init.sqs or something, add a killed eventhandler to the player. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player addEventHandler[{killed},{_this exec{respawn.sqs}}] then, in the script, write something like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _man=player ?(_this select 0)!=_man:exit ?not local _man:exit @alive player player addEventHandler[{killed},{_this exec{respawn.sqs}}] player setpos [x,y,z] deletevehicle _man exit replace [x,y,z] with the postion you want the player to spawn at. Most likely it should be something like: '[getpos carrier select 0,getpos carrier select 1,30]' have no idea how high a carrier usually is, and have no idea how high the one you're using it Share this post Link to post Share on other sites
Trapper 0 Posted August 25, 2005 Thats not ? or if it's @ Try it yourself! Its not checking if the player is alive, it waits for the player to "become" alive. If this occurs it waits for the next occuring (only after the players death). I've used it in a mp mission at OFP version 1.85 times and it works. Only problem is the player will start at this height when the mission begins, so he has to start on the carrier or the script needs a check for that. Share this post Link to post Share on other sites
snipman 0 Posted August 25, 2005 is there a way to implement this with a Vehicle Respawn Script...........? because usually if the player dies then most likely the plane would too!. srry if this is asking too much =) Share this post Link to post Share on other sites
snipman 0 Posted August 25, 2005 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#l1 @ alive player player setpos [(getpos player select 0),(getpos player select 1),7.5] goto "l1" You can use this script for it. Everytime a player spawns (or the missions starts) he will be positioned in the height you choose. Here at 7.5m: player setpos [(getpos player select 0),(getpos player select 1),7.5] EDIT: You can use a trigger, too: Multiple activation trigger Condition: alive player OnActivation: player setpos [(getpos player select 0),(getpos player select 1),7.5] will they respawn at the same location at the begining or do i have to designate a respawn area on the carrier? Share this post Link to post Share on other sites
Garcia 0 Posted August 25, 2005 hmm...ok I don't use the @ command much. You could add a vehicle respawn with the same delay as your respawn. Share this post Link to post Share on other sites
snipman 0 Posted August 26, 2005 so how would i make the vehilce respawn on the carrier? and I used Garcia's Script....... it respawns me but at the location where u died at!!! so im drowing over and over! Share this post Link to post Share on other sites
Trapper 0 Posted August 26, 2005 My script will lift the player up in the air whereever he respawns. You've to place special respawnmarkers if you want them respawning in a certain area, or you'll have to use setpos with a predefined [x,y,z] position thats on the carrier deck. replace [x,y,z] with the postion you want the player to spawn at. Most likely it should be something like: '[getpos carrier select 0,getpos carrier select 1,30]'have no idea how high a carrier usually is, and have no idea how high the one you're using it If you use the example line you should at least drown somewhere near the carrier until you've found the right z. Oh and of course you've to name the carrier carrier for this line to work! Try to understand the 3d postions in OFP: [x,y,z] x = West-East y = South-North z = Ground-Sky [0,0,0] is the SW mapcorner at sealevel getpos something returns the position of object named somehting as [x,y,z]. Thats called an array. something setpos [x,y,z] beams object named something to this position in the world. If you want to set the height (z) but keep the position (x,y) of an object you use getpos to get the x and y value and replace z with the height you want. something setpos [(getpos something select 0),(getpos something select 1),1000] You can also open the mission.sqm with notepad to find out the x,y position of an object you've placed in editor. (z value in the mission.sqm differs from z value you've to use with setpos! ) Place gamlogics (example name gamelogic99) at the positions if you want to see/move the spawnpositions on the map while editing, use player setpos [(getpos gamelogic99 select 0),(getpos gamelogic99 select 1),1000] for example. It's still neccessary to set z to the required height above ground. setpos/getpos works for vehicles, too. Share this post Link to post Share on other sites
Garcia 0 Posted August 26, 2005 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _vcl = _this select 0 _pos = _this select 1 _dir = _this select 2 _respawndelay = _this select 3 ?!(local Server): goto "loop" _type = typeOf _vcl #start ~10 ?alive _vcl : goto "start" ~_respawndelay _oldvcl = _vcl #Respawn _vcl = _type createVehicle _pos _vcl setdir _dir deleteVehicle _oldvcl goto "start" that should work fine to respawn the vehicles. It will create a new vehicle at a given location and delete the old one. Problem is, it always create the vehicle at ground level. So I suggest you place a gamelogic somewhere, name is 'spawngl1', and then you could do something like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _vcl = _this select 0 _pos = _this select 1 _dir = _this select 2 _respawndelay = _this select 3 _spawnpos = getpos spawngl1 ?!(local Server): goto "loop" _type = typeOf _vcl #start ~10 ?alive _vcl : goto "start" ~_respawndelay _oldvcl = _vcl #Respawn _vcl = _type createVehicle _spawnpos ~0.5 _vcl setpos _pos _vcl setdir _dir deleteVehicle _oldvcl goto "start" You have to write in the position to place the new aircraft on the carrier, you have to set which direction it should face when respawning, and you have to set how long it will take for it to respawn (in seconds). oh, and you have to place a game logic and call it 'server' Share this post Link to post Share on other sites
snipman 0 Posted August 26, 2005 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_vcl = _this select 0 _pos = _this select 1 _dir = _this select 2 _respawndelay = _this select 3 ?!(local Server): goto "loop" _type = typeOf _vcl #start ~10 ?alive _vcl : goto "start" ~_respawndelay _oldvcl = _vcl #Respawn _vcl = _type createVehicle _pos _vcl setdir _dir deleteVehicle _oldvcl goto "start" that should work fine to respawn the vehicles. It will create a new vehicle at a given location and delete the old one. Problem is, it always create the vehicle at ground level. So I suggest you place a gamelogic somewhere, name is 'spawngl1', and then you could do something like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _vcl = _this select 0 _pos = _this select 1 _dir = _this select 2 _respawndelay = _this select 3 _spawnpos = getpos spawngl1 ?!(local Server): goto "loop" _type = typeOf _vcl #start ~10 ?alive _vcl : goto "start" ~_respawndelay _oldvcl = _vcl #Respawn _vcl = _type createVehicle _spawnpos ~0.5 _vcl setpos _pos _vcl setdir _dir deleteVehicle _oldvcl goto "start" You have to write in the position to place the new aircraft on the carrier, you have to set which direction it should face when respawning, and you have to set how long it will take for it to respawn (in seconds). oh, and you have to place a game logic and call it 'server' so that line of code would go in the INIT file right or do i have to make it an Sqs script file and put the <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> [this] exec "blah.sqs" in the vehicles init? and also.... looking at this script....... every vehicle that is destoryed will respawn at the same location all the time so if i blow up a F-14 and then a M-18 wouldn't they spawn at the same location?? lol im a noob when it comes to scripting  Share this post Link to post Share on other sites
Garcia 0 Posted August 26, 2005 lets say you place a vehcile named v1. to then respawn it, you write this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> [v1,[getpos carrier select 0,getpos carrier select 1,30],30] exec "script.sqs" in the init. Or you could write: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> [this,[getpos carrier select 0,getpos carrier select 1,30],30] exec "script.sqs" in the vehicles init field. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> [v1,[getpos carrier select 0,getpos carrier select 1,30],30] exec "script.sqs" 'v1' is the name of the vehicle to respawn. '[getpos carrier select 0,getpos carrier select 1,30]' is the position to spawn the vehicle to. You probaly have to play around with it to find the right place of the vehicle. '30' is the direction of the vehicle when respawned. 0 is north, 90 is east, 180 is south and 270 is west. Make sure to place the 'spawngl1' somewhere flat, on land, and somewhere you won't be during the mission. Share this post Link to post Share on other sites
snipman 0 Posted August 27, 2005 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_vcl = _this select 0 _pos = _this select 1 _dir = _this select 2 _respawndelay = _this select 3 ?!(local Server): goto "loop" _type = typeOf _vcl #start ~10 ?alive _vcl : goto "start" ~_respawndelay _oldvcl = _vcl #Respawn _vcl = _type createVehicle _pos _vcl setdir _dir deleteVehicle _oldvcl goto "start" that should work fine to respawn the vehicles. It will create a new vehicle at a given location and delete the old one. Problem is, it always create the vehicle at ground level. So I suggest you place a gamelogic somewhere, name is 'spawngl1', and then you could do something like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _vcl = _this select 0 _pos = _this select 1 _dir = _this select 2 _respawndelay = _this select 3 _spawnpos = getpos spawngl1 ?!(local Server): goto "loop" _type = typeOf _vcl #start ~10 ?alive _vcl : goto "start" ~_respawndelay _oldvcl = _vcl #Respawn _vcl = _type createVehicle _spawnpos ~0.5 _vcl setpos _pos _vcl setdir _dir deleteVehicle _oldvcl goto "start" You have to write in the position to place the new aircraft on the carrier, you have to set which direction it should face when respawning, and you have to set how long it will take for it to respawn (in seconds). oh, and you have to place a game logic and call it 'server' aight one last question and i'll be on my way................... in the script where do u place the Respawn delayat..... location........... basically every thing i have to fill in in the "script.sqs" u posted Share this post Link to post Share on other sites
Garcia 0 Posted August 27, 2005 lets say you place a vehcile named v1. to then respawn it, you write this:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> [v1,[getpos carrier select 0,getpos carrier select 1,30],30] exec "script.sqs" in the init. Or you could write: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> [this,[getpos carrier select 0,getpos carrier select 1,30],30] exec "script.sqs" in the vehicles init field. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> [v1,[getpos carrier select 0,getpos carrier select 1,30],30] exec "script.sqs" 'v1' is the name of the vehicle to respawn. '[getpos carrier select 0,getpos carrier select 1,30]' is the position to spawn the vehicle to. You probaly have to play around with it to find the right place of the vehicle. '30' is the direction of the vehicle when respawned. 0 is north, 90 is east, 180 is south and 270 is west. Make sure to place the 'spawngl1' somewhere flat, on land, and somewhere you won't be during the mission. just do what I told you there...when you execute the script, you fill in position, direction and delay. Share this post Link to post Share on other sites
NaveReyem 0 Posted September 6, 2005 yo snipman, this should work, ive respawned things before in the air, im not sure how you would get the vehicles to respawn up there, but here is code, put this in the INIT file of youre mission. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> #AirSpawn @! alive Player @alive Player Player setpos [getpos Player select 0, getpos Player select 1, (getpos Player select 2) +515] goto "AirSpawn" the 515 is the height, you can change it to anything, but something wierd may happen is the ground underneath the water under the carrier is unlevel, or it may just elevate from "sea" level, i dont remember lol.... test it.... you could also put in things like <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> #airholdloop @! alive Player @alive Player Player setpos [getpos Player select 0, getpos Player select 1, (getpos Player select 2) +515] RemoveAllWeapons Player Player addmagazine "G36AMag" Player addmagazine "G36AMag" Player addmagazine "G36AMag" Player addmagazine "G36AMag" Player addweapon "G36A" Player addweapon "binocular" Player selectweapon "G36A" goto "airholdloop" to make the guy spawn with a g36 and a binocular, with g36 selected as main weapon... mess with it... Share this post Link to post Share on other sites
snipman 0 Posted November 5, 2005 Alrighty Thank You All..... Now For Some More Assistance =D How Do You assign 2 seperate spawns locations for the same side!! Like Selected Respawns Location...... with this "respawn script" =D One on The Carrier and ANother on the island or something... Share this post Link to post Share on other sites