Takoshi 10 Posted November 7, 2011 I did a few searches on this thread, as it has no doubt been resolved at least ten times before, but I have been unsuccessful in finding a solution. Could someone give me an example of a script that can be used to move the Respawn_West marker to a unit's location? I'm trying to get the marker to follow the unit's location even if the unit dies, allowing it and the units on it's team to respawn at it's last location via "base" respawn. I have absolutely no experience with programming or coding and the scripts I have used thusfar have only been ones which I can edit or tinker around with in the init field. Any help is appreciated though! Share this post Link to post Share on other sites
twirly 11 Posted November 7, 2011 (edited) Well you can monitor the players position and move the marker when he dies like this. Make a script in your mission folder called movemarker.sqf or whatever. This runs a loop that continually gets the players last position. Getting the last position all the time may not be needed but I'm not sure if the position of the dead player will be returned... so do it this way. movemarker.sqf:- _pos = []; while {alive player} do { _pos = getpos player; sleep 1; }; "Respawn_West" setMarkerPos _pos; Call it from your players init like this:- nul = [] execVM "movemarker.sqf"; I'm sure you will follow what's going on there. If not give us a yell. EDIT: More... another idea! Not tested but should also work. Create a script OnPlayerKilled.sqf in your mission folder. Put this in it.... OnPlayerKilled.sqf:- _plyr = _this select 0; "Respawn_West" setMarkerPos getpos _plyr; Edited November 7, 2011 by twirly Added stuff Share this post Link to post Share on other sites
Takoshi 10 Posted November 9, 2011 Hey, thanks for your help thusfar, but I finally had the chance to test it today. I am sorry to say that the first solution did not work for me, though it's HIGHLY probable it is due to some error in the way I implemented your suggestion. I created the movemarker.sqf, pasted the text into it and placed it in the mission folder. I added the init line to the player I wanted the marker to follow. The unit has no name. The end result is something very strange. If the unit dies near the beginning of the game, it will get spawned at the original location of Respawn_West, as if the marker is not following the unit at all. Upon a second death, the unit will respawn over some position that the unit has traveled before. Upon all further deaths, the unit will continue to respawn at that seemingly random position and the respawn marker does not move any further. As for the second suggestion, I feel like I'm missing something that may be common sense to you, but what else do I do with that .sqf? Do I need to add nul = [] execVM "OnPlayerKilled.sqf";? Thanks again for your help thusfar! Share this post Link to post Share on other sites
twirly 11 Posted November 10, 2011 Try it this way maybe... I'll test it a little later on when I get some time to create a little mission. Call it the same way from the units init.... or even better (less likely to cause problems)... make an init.sqf in your mission folder an call it in there the exact same way. movemarker.sqf:- while {true} do { waituntil {alive player}; _pos = []; while {alive player} do { _pos = getpos player; sleep 1; }; "Respawn_West" setMarkerPos _pos; }; For the second way.... no need to add anything. It won't work! ... OnPlayerKilled.sqf is not used in a multiplayer game... which you are obviously creating. Don't know what I was thinking. Try the above code see what happens. It should work. Share this post Link to post Share on other sites
Takoshi 10 Posted November 10, 2011 Well, I have tried it and it is... very interesting to say the least. My first death will respawn at the default location, it will then take note of where I die on my second and third lives and will alternate respawning me between those two points for the rest of my lives. Bizarre. By the way, I have now changed the term "player" to a named unit with no change in the effects. I do this because in my experience, when I use a term with "player" in it, it gets a little fuzzy in multiplayer mode. Thanks, and any more help is just as appreciated, while I won't blame you for throwing your hands up in frustration. Share this post Link to post Share on other sites
f2k sel 164 Posted November 10, 2011 It sounds as if it's getting confused between server and client. I don't know enough about MP to advise on a fix. Share this post Link to post Share on other sites