Blitzen88 18 Posted January 30, 2022 Im using a handful of scripts to create a "single player respawn." The "system" works by adding an evenhandler to the player and, once the player dies, creates a new playable unit that the player can switch to. The problem is, once the player dies and selects the new unit, the player/new unit looses access to the military symbols module. Map markers which were displayed for the "original" player unit are not longer displayed for the new unit. Here is what I am using: Init File: PlayerLoadOut = getUnitLoadout player; _RespawnMarker = createMarkerLocal ['PlayerRespawn', getpos Player]; _RespawnMarker setMarkerTypeLocal 'mil_dot'; _RespawnMarker setMarkerTextLocal 'Respawn Point'; _RespawnMarker setMarkerColorLocal 'ColorOrange'; _RespawnMarker setMarkerSizeLocal [0.5, 0.5]; Player addEventHandler ["Killed", {[(_this select 0)] execVM "Scripts\Support\Support_PlayerRespawn.sqf";}]; PlayerRespawn File: params ["_oldUnit"]; [_oldUnit] join grpnull; _newUnit = group _oldUnit createUnit [typeOf _oldUnit, getMarkerPos "PlayerRespawn",[],0,"NONE"]; _newUnit addEventHandler ["Killed", {[(_this select 0)] execVM "Scripts\Support\Support_PlayerRespawn.sqf";}]; addSwitchableUnit _newUnit; _newUnit disableai "path"; _newUnit setUnitLoadout PlayerLoadout; Is there anyway to re-apply the military symbols module to the new unit once the player dies? Any help would be appreciated. **EDIT** I've been doing some testing and I've found something unusual. I joined a game, killed myself via trigger (setdamage 1), and then switched units. Once I switch to the new unit, I killed myself with the map open. After the death of the unit but before I switched again, the enemy map marker's reappeared on the map....? Share this post Link to post Share on other sites
opusfmspol 282 Posted January 31, 2022 [_oldUnit] join grpnull; _newUnit = group _oldUnit createUnit [typeOf _oldUnit, getMarkerPos "PlayerRespawn",[],0,"NONE"]; You're having the new unit created in a new group different than the original group. Units killed are civilian and have their own show rules, apparently different than whichever side your playing. You can set custom rules for civilian to block showing any markers while switching. in init file: grpJoined = Group player; in PlayerRespawn file: _newUnit = grpJoined createUnit [typeOf _oldUnit, getMarkerPos "PlayerRespawn",[],0,"NONE"]; or if you don't want the new unit in the original group, create a new group for your side, then createUnit using that group. (not tested) 1 Share this post Link to post Share on other sites
Blitzen88 18 Posted January 31, 2022 5 hours ago, opusfmspol said: You're having the new unit created in a new group different than the original group. Units killed are civilian and have their own show rules, apparently different than whichever side your playing. You can set custom rules for civilian to block showing any markers while switching. I think I understand the basics of what you’re saying but Im not sure I understand 100%. I want the new unit to be in a different group from the original (killed) unit’s group. Reason being, if the original (killed) unit is leading a group and the new unit is added to that group…wouldnt the original (killed) unit’s teammates join the new unit? Im trying to avoid a situation where the player dies, “respawns”, and the player’s squadmates are on the other side of the map where the death occurred. I havent tested the proposed fix (Im at work) but I hope it works because it seems like an easy solution. Share this post Link to post Share on other sites
opusfmspol 282 Posted January 31, 2022 3 hours ago, Blitzen88 said: I want the new unit to be in a different group from the original (killed) unit’s group. I see. In that case, disregard grpJoined (used for group tracking) and create a new group for the created unit to join. _newGrp = CreateGroup West; // or whichever side player is on. _newUnit = _newGrp createUnit [typeOf _oldUnit, getMarkerPos "PlayerRespawn",[],0,"NONE"]; Military Symbols (MARTA) runs an fsm on the local (player) machine which determines which markers are shown. The fsm is persistent, it doesn't stop until player ends mission. It uses playerSide, Group Player and Faction; mostly it comes down to what side a player is on as to which markers are seen (can be custom set for factions). And as previously said, killed units become civilian, which maybe effects visibility during switch. After switch completes and player is back to proper side, the markers should restore. Share this post Link to post Share on other sites
Blitzen88 18 Posted February 1, 2022 6 hours ago, opusfmspol said: I see. In that case, disregard grpJoined (used for group tracking) and create a new group for the created unit to join. _newGrp = CreateGroup West; // or whichever side player is on. _newUnit = _newGrp createUnit [typeOf _oldUnit, getMarkerPos "PlayerRespawn",[],0,"NONE"]; Military Symbols (MARTA) runs an fsm on the local (player) machine which determines which markers are shown. The fsm is persistent, it doesn't stop until player ends mission. It uses playerSide, Group Player and Faction; mostly it comes down to what side a player is on as to which markers are seen (can be custom set for factions). And as previously said, killed units become civilian, which maybe effects visibility during switch. After switch completes and player is back to proper side, the markers should restore. I tried the suggested fix and its still not working. Map symbols appear for the original unit but do not appear upon "respawn" Is there a way to create a map marker on known enemy units for an entire side? It might be easier to just create my own spotter style of script...? EDIT Im thinking about using the event handler “Handle Damage.” Basically, teleport the player back to the respawn marker when the player’s health drops below a certain point…? Something like that..? That way the playable unit doesnt change. Share this post Link to post Share on other sites
Blitzen88 18 Posted February 6, 2022 It seems this is related to teamswitch in general and is not really related to the script; switching to a playable unit breaks Marta too. @Larrow might have some knowledge (puhllleeezzzee) Share this post Link to post Share on other sites
Larrow 2822 Posted February 6, 2022 addMissionEventHandler[ "TeamSwitch", { params[ "_previousUnit", "_newUnit" ]; //This needs to be set again to enable MARTA icons setGroupIconsVisible[ true, true ]; //Or whatever you originally use [ MAP, HUD ] //Copy over any rules, reveal, hiden etc variables to the new unit/group _newUnit setVariable[ "MARTA_SHOWRULES", _previousUnit getVariable "MARTA_SHOWRULES" ]; _newUnit setVariable[ "MARTA_REVEAL", _previousUnit getVariable "MARTA_REVEAL" ]; _newUnit setVariable[ "MARTA_HIDE", _previousUnit getVariable "MARTA_HIDE" ]; group _newUnit setVariable[ "enemygroups", group _previousUnit getVariable "enemygroups" ]; }]; MARTA_Example Share this post Link to post Share on other sites
Blitzen88 18 Posted February 6, 2022 2 hours ago, Larrow said: addMissionEventHandler[ "TeamSwitch", { params[ "_previousUnit", "_newUnit" ]; //This needs to be set again to enable MARTA icons setGroupIconsVisible[ true, true ]; //Or whatever you originally use [ MAP, HUD ] //Copy over any rules, reveal, hiden etc variables to the new unit/group _newUnit setVariable[ "MARTA_SHOWRULES", _previousUnit getVariable "MARTA_SHOWRULES" ]; _newUnit setVariable[ "MARTA_REVEAL", _previousUnit getVariable "MARTA_REVEAL" ]; _newUnit setVariable[ "MARTA_HIDE", _previousUnit getVariable "MARTA_HIDE" ]; group _newUnit setVariable[ "enemygroups", group _previousUnit getVariable "enemygroups" ]; }]; MARTA_Example Holy shit, that seems to work perfectly! If the MARTA variables are set in the MARTA modules' init line, will the variables still be pulled to the new unit? Or do those variables need to be defined in the player's init line? Thank you so much for the help! Share this post Link to post Share on other sites
Larrow 2822 Posted February 6, 2022 2 hours ago, Blitzen88 said: If the MARTA variables are set in the MARTA modules' init line, will the variables still be pulled to the new unit? Or do those variables need to be defined in the player's init line? If your talking about other options for the logic(BIS_marta_mainscope) "delay" "duration" etc then they don't need to be touched as they are only used by the logic and have no bearing on the MARTA systems operation from point of view of a player change. If you mean the variables I have shown in the code in my last post. Neither, if you are not using any of these features. To fix your current problem all you need is... addMissionEventHandler[ "TeamSwitch", { params[ "_previousUnit", "_newUnit" ]; //This needs to be set again to enable MARTA icons setGroupIconsVisible[ true, true ]; //Or whatever you originally use [ MAP, HUD ] }]; ...the rest was there in case you were using the HIDE/REVEAL/RULES additional settings of MARTA that are used on the player. If you were they need copying over, no matter where they were initially initialised. Share this post Link to post Share on other sites