kahna 13 Posted June 20, 2013 Alright, I spent about three hours today beating up the search function and trying out scripts that simply don't work or don't do what I want them to do. Although I did find out how to move the respawn_west marker around to accommodate a 'new respawn point unlocked' type of gameplay which is nice to know... Anyway, basically I have respawn_west at Stratis Air Base and I want the Infantry to spawn/respawn in one location and the Pilots to spawn/respawn in a separate location (partly for realism and partly to stop "the swarm" to people rushing to meet my rotors/skids/wheels/tail /sigh). I'm still learning scripting (I'd say a 3 out of 10 atm), so if someone can point me in the right direction or offer a snippet of example code I'd be very grateful. My most recent attempt was to add a MPrespawn event handler on the pilots that called a script to make the unit (this) setpos getpos markername and that didn't work out. I also tried a variation that had fields for x and y axis positions & elevation, no joy... Thanks in advance! Share this post Link to post Share on other sites
samatra 85 Posted June 20, 2013 Add into init.sqf: true spawn { waitUntil{player == player}; player addEventHandler ["Respawn", { if((typeOf player) in ["B_Helipilot_F", "O_helipilot_F"]) then { player setPos [1000,1000,0]; //Your pilot respawn coordinate here. Might as well create new marker and use getMarkerPos instead of specifying coordinates }; }]; }; This spawns new thread (true spawn), thread waits until player fully loaded (player == player) and then adds respawn even handler which moves player to special position if their class is heli pilot class Share this post Link to post Share on other sites
XSOF - Toxx 10 Posted June 20, 2013 First thing you could do is use multiple respawn-markers: respawn_west1, respawn_west2, etc.. Arma now randomly lets you respawn on these two. But I'm not sure if there is any way to "control" it. I guess your setPos-attempt is the way to go. Put a new text file in your mission folder named onPlayerRespawn.sqf There you would have to check if the player is a pilot and teleport him to a marker where you want him for example. For that you would need something like this: http://forum.armedassault.info/index.php?showtopic=402 I never used setPos myself but I think you can find more explanations about it via Google/Forums. ---------- Post added at 08:15 PM ---------- Previous post was at 08:14 PM ---------- Edit: Good job SaMatra, you were faster and more precise :) Share this post Link to post Share on other sites
kahna 13 Posted June 20, 2013 Add into init.sqf: true spawn { waitUntil{player == player}; player addEventHandler ["Respawn", { if((typeOf player) in ["B_Helipilot_F", "O_helipilot_F"]) then { player setPos [1000,1000,0]; //Your pilot respawn coordinate here. Might as well create new marker and use getMarkerPos instead of specifying coordinates }; }]; }; This spawns new thread (true spawn), thread waits until player fully loaded (player == player) and then adds respawn even handler which moves player to special position if their class is heli pilot class Sadly that doesn't work. My pilots are still respawning at the respawn_west marker. Tried it with coordinates [1905.50,5740.10,5.68] and using an invisible marker "pilot". Share this post Link to post Share on other sites
dr_strangepete 6 Posted June 21, 2013 could it be the statement: waitUntil {player == player}; the expression is true without waiting. try waitUntil {!isNull player} if memory serves correct Share this post Link to post Share on other sites
Larrow 2822 Posted June 21, 2013 (edited) My most recent attempt was to add a MPrespawn event handler on the pilots that called a script to make the unit (this) setpos getpos markername and that didn't work out.Shouldnt that be (_this select 0) setpos (getMarkerPos "MarkerName") _this select 0 As the eventHandler supplies two variables. From the WIKI MPRespawnTriggered when a unit respawns. Passed array: [unit, corpse, ...] unit: Object - Object the event handler is assigned to corpse: Object - Object the event handler was assigned to, aka the corpse/unit player was previously controlling. and getMarkerPos to return the marker position, not getpos._________________________________________________________________ Try using the new available options from the new respawning system. I gather from your post your already using the respawn = 3 for BASE respawn. Add to your description.ext respawnOnStart = 1; to make it run the respawn scripts on startup aswell. Add a onPlayerRespawn.sqf to your mission directory. onPlayerRespawn.sqf waitUntil {!(isNull player)}; if (typeOf player == "B_Helipilot_F") then { player setPosATL (getMarkerPos "respawn_pilot"); }; Where respawn_pilot is the name of your marker for the pilots to spawn at. A bit of a mixture between SaMatra and Toxx's advice using the new A3 respawn system. Edited June 21, 2013 by Larrow Share this post Link to post Share on other sites
samatra 85 Posted June 21, 2013 Sadly that doesn't work. My pilots are still respawning at the respawn_west marker. Tried it with coordinates [1905.50,5740.10,5.68] and using an invisible marker "pilot". Are you sure your pilots have "B_Helipilot_F" or "O_helipilot_F" class? Try to add debug messages: true spawn { waitUntil{player == player}; player addEventHandler ["Respawn", { systemChat format ["Respawned, my class is %1", typeOf player]; if((typeOf player) in ["B_Helipilot_F", "O_helipilot_F"]) then { player setPos [1000,1000,0]; //Your pilot respawn coordinate here. Might as well create new marker and use getMarkerPos instead of specifying coordinates }; }]; }; could it be the statement: waitUntil {player == player};the expression is true without waiting. try waitUntil {!isNull player} if memory serves correct No, (objNull == objNull) returns false. http://community.bistudio.com/wiki/objNull This value is not equal to anything, including itself. Share this post Link to post Share on other sites
kahna 13 Posted June 21, 2013 (edited) Ok wow I feel dumb. On a hunch I made a brand new testbed mission and SaMatra's code works just fine with coordinates and getMarkerPos. Anyway, after some trial and error I discovered that the culprit is the BTC Revive script. When you die normally the pilot respawn script works just fine and puts your body back at base while waiting to be revived in the field, but hitting the Respawn button teleports you over to the respawn_west marker. It wasn't obvious until I turned off the fade to black effect. One problem solved, another to unravel. Thanks much SaMatra! Script works beautifully! Edited June 21, 2013 by Kahna Share this post Link to post Share on other sites
Tuliq 2 Posted June 21, 2013 There is another way to do this which i feel is probably the best way. Use setmarkerposlocal to set the position of a marker locally on a players computer, independent from all other players. Just make a simple "if" check, and if the player is a pilot, then do a "respawn_west" setmarkerposlocal [your pilot spawn coordinates]. ---------- Post added at 11:41 ---------- Previous post was at 11:38 ---------- F.ex "respawn_west" setmarkerposlocal getpos player will make units respawn at the same position you placed them in the editor Share this post Link to post Share on other sites
kahna 13 Posted June 21, 2013 Found it! In order to get this to work with BTC Revive simply go into the BTC Functions and change this line of code: player setPos getMarkerPos BTC_respawn_marker; To this: if (typeOf player == "B_Helipilot_F") then {player setPos getMarkerPos pilot;} else {player setPos getMarkerPos BTC_respawn_marker;}; Where pilot is the marker you want B_Helipilot_F to spawn at. /happy dance. Thanks a million guys! Share this post Link to post Share on other sites
Andyj1 22 Posted June 23, 2013 Hi, Kahna, you think your dumb well i'm dumber lol. So I changed the line as described, and I am respawning where I died. I don't unserstand your line "Where pilot is the marker you want B_Helipilot_F to spawn at." The way I read it was that the pilot would respawn at the coordinates given in the mission. Please help so I can dance too. :) Share this post Link to post Share on other sites
kahna 13 Posted June 23, 2013 (edited) Hi, Kahna, you think your dumb well i'm dumber lol. So I changed the line as described, and I am respawning where I died. I don't unserstand your line "Where pilot is the marker you want B_Helipilot_F to spawn at." The way I read it was that the pilot would respawn at the coordinates given in the mission. Please help so I can dance too. :) pilot was the name of a marker that I had set down on the map. However after further testing it wasn't working. Currently the only way I can get it to work with BTC revive is to use the coordinate system. Example: if (typeOf player == "B_Helipilot_F") then {player setPos [1850,5460,0];} else {player setPos getMarkerPos BTC_respawn_marker;}; Where 1850 is the X-Coordinate, 5460 is the Y Coordinate and 0 is the Z-Coordinate (Elevation). Note, these coordinates are pretty close to the default pilot spawn point in AW Invade and Annex if that saves you some time. I'm guessing you're asking for your server. Played there many times. Just refine the coordinate position in the editor if you want it more exact. Furthermore, if you want to have multiple seperate respawns with BTC Revive, this is how you go about doing it with my example code for Pilots, Armor Crewman and everyone else: if (typeOf player == "B_Helipilot_F") then {player setPos [1734,5127,0]} else {if (typeOf player == "B_crew_F")} then {player setPos [1907,5640,0]} else {player setPos getMarkerPos BTC_respawn_marker;}; Edited June 24, 2013 by Kahna Share this post Link to post Share on other sites
Larrow 2822 Posted June 23, 2013 if (typeOf player == "B_Helipilot_F") then {player setPos getMarkerPos [color="#FF0000"]"[/color]pilot[color="#FF0000"]"[/color];} else {player setPos getMarkerPos BTC_respawn_marker;}; Quotes around your marker NAME. BTC_respawn_marker is ok as its a variable containing the name. Share this post Link to post Share on other sites
kahna 13 Posted June 24, 2013 Probably why the pilot marker wasn't working then eh? Whoops! Still learning here =) Thanks! Share this post Link to post Share on other sites
Andyj1 22 Posted June 24, 2013 (edited) Thanks Kahna, now I understand. Ive added the quotes as Larrow suggested and seems to work a treat. Many thanks.,, Now i'm dancing too :) Edited June 24, 2013 by Andie Share this post Link to post Share on other sites
pipyn1970 19 Posted January 24, 2014 Hi guys, im sorry to ask what might be a very basic question but to me its quite complicated. I no nothing much about scripting & so am after something special. What I'd like to create is a couple of enemy respawn points. My mission are set up with respawn base but is it possible to group my enemy to different respawns? So for example groups 1,2 & 3 would respawn at point 1 & groups 4,5,6 at point 2? if so how would I do it? many thanks for any help guys Share this post Link to post Share on other sites