BEAKSBY 11 Posted May 4, 2014 HI Folkes, I'm using the respawnTemplates[] = {"MenuInventory","MenuPosition"}; and would like to repsawn with the current init = addAction command. With help from F2k Sel I've placed the following in the player init field but it does not respawn with the addAction available. player addEventHandler ["RESPAWN",{ _id = (_this select 0) addAction ["<t color='#FF0000'>M2A4 Slammer UP $1200</t>", "ArmorDrop.sqf",[],0,true,true,"","( missionnamespace getVariable 'sector' select 1 ) == side _this"] } ]; Does anyone know how to use the Respawn Template and carry-over the current addAdction? It does not work in either SP or MP. Thanks Share this post Link to post Share on other sites
mariodu62 5 Posted May 4, 2014 player addEventHandler ["RESPAWN", { _id = [] spawn { waituntil {alive player}; player addAction ["<t color='#FF0000'>M2A4 Slammer UP $1200</t>", "ArmorDrop.sqf",[],0,true,true,"","( missionnamespace getVariable 'sector' select 1 ) == side _this"]; }; }]; Share this post Link to post Share on other sites
BEAKSBY 11 Posted May 4, 2014 I've added the above to player init field and it still does not activate the addAction. Share this post Link to post Share on other sites
champ-1 40 Posted May 4, 2014 Code in OP post should work, take a look at your "condition". Make sure it's 'true' or remove it at all. Share this post Link to post Share on other sites
BEAKSBY 11 Posted May 4, 2014 Code in OP post should work, take a look at your "condition". Make sure it's 'true' or remove it at all. Thanks, I'm not sure what you mean by "Code in OP post should work"?...do you mean the original script I posted from F2k Sel at the very top? Also, I only want the addAction to occure when the condition is true (when the side has captured the sector area). Share this post Link to post Share on other sites
champ-1 40 Posted May 4, 2014 Yes, that's what I mean. Maybe that condition is wrong for some reason. Double check it, try it without conditions. Share this post Link to post Share on other sites
BEAKSBY 11 Posted May 4, 2014 Yes, that's what I mean.Maybe that condition is wrong for some reason. Double check it, try it without conditions. I did like you suggested, ran it without the condition, so I removed, "( missionnamespace getVariable 'sector' select 1 ) == side _this" from the addAction part of the player init in the first post. It did not show the addAction command either. I think the problem is that it is not reading the init line from the respawnTemplates[] = {"MenuInventory","MenuPosition"}; Share this post Link to post Share on other sites
champ-1 40 Posted May 4, 2014 (edited) You need to put empty quotes (""), not just delete condition. Nevermind, it's the last element in your case and it's optional. You can just delete it. Also turn on script errors log. Edited May 4, 2014 by Champ-1 Share this post Link to post Share on other sites
f2k sel 164 Posted May 4, 2014 The condition works fine in a normal addaction for me, but if something has changed in the mission it could cause it to fail. But yes to make sure the action is being added removing the condition is a good way to test it. Share this post Link to post Share on other sites
BEAKSBY 11 Posted May 4, 2014 The condition works fine in a normal addaction for me, but if something has changed in the mission it could cause it to fail.But yes to make sure the action is being added removing the condition is a good way to test it. I also tried it by simply putting an addAction in the player init, and it would not read it with the respawn template. Share this post Link to post Share on other sites
f2k sel 164 Posted May 4, 2014 Like I said MP is a total mystery to me, it is probably something very simple but will need someone to try the mission. Share this post Link to post Share on other sites
champ-1 40 Posted May 4, 2014 (edited) I also tried it by simply putting an addAction in the player init, and it would not read it with the respawn template.It has nothing to do with respawn templates. You assigning action to player, player is an object. When he respawns new player-object created, obviously without any assigned actions. That's why you need reassign all your actions on respawn. ---------- Post added at 21:42 ---------- Previous post was at 21:39 ---------- I'm 90% sure there something wrong with your conditions. Also I find missionNamespace not very reliable for storing variables. Just use global variable and send it over network with publicVariable. Edited May 4, 2014 by Champ-1 Share this post Link to post Share on other sites
f2k sel 164 Posted May 4, 2014 BIS are using missionspacename to store who owns the sector, were just reading it to obtain who controls the sector. Share this post Link to post Share on other sites
champ-1 40 Posted May 4, 2014 Okay, just saying. I didn't have much luck with it, maybe it's just me. Share this post Link to post Share on other sites
f2k sel 164 Posted May 4, 2014 oops, I actually moved away from missionspacename to use the exact variables that BIS use in the module. They do use missionspacename in the variable but isn't needed anymore as they set the variable to the sector name. the action in the players init is this addAction ["<t color='#FF0000'>M2A4 Slammer UP $1200</t>", "ArmorDrop.sqf",[],0,true,true,"","sector1 getVariable 'owner' == side _this"] Where sector1 is the name of the Module. player addEventHandler ["RESPAWN",{ _id = (_this select 0) addAction ["<t color='#FF0000'>M2A4 Slammer UP $1200</t>", "ArmorDrop.sqf",[],0,true,true,"","sector1 getVariable 'owner' == side _this"] } ]; Share this post Link to post Share on other sites
BEAKSBY 11 Posted May 4, 2014 Thansk Guys, F2k Sel, I've tried using both your scirpts above in the player init field and still no results. I also made sure the module has the name "sector1". I've attached my mission here in case someone wants to try to crack this one. Like Champ-1 said above, it's probably something simple I'm overlooking. When I tried just placing a simple addAction like displaying the string and code it still didn't work. This worked however when I had the mission without the respawn template in both SP and MP modes. I'm trying to recreate The Outfit from the XBOX360 (2006) but with an Arma spin. In that game, before you started you chose one of three types of players (an AT guy, MG guy or sniper) then you chose which base you wanted to respawn from, provided your side captured it. Share this post Link to post Share on other sites
Belbo 462 Posted May 5, 2014 Have you tried addMPEventhandler and MPRespawn instead yet? Share this post Link to post Share on other sites
BEAKSBY 11 Posted May 5, 2014 Have you tried addMPEventhandler and MPRespawn instead yet? Thanks for your thoughts, but unfortunately it is still not working. Do any of the designers from BIS read these posts? Is there someone I can PM from BIS for a solution to this problem? Thanks Share this post Link to post Share on other sites
k0rd 3 Posted May 5, 2014 sorry if this sounds dumb, but are the event handlers CaSe SenSiTive? I have only ever tried using "Respawn" Share this post Link to post Share on other sites
f2k sel 164 Posted May 5, 2014 Just try placing at the end of the init.sqf file after all you para codes. player addAction ["<t color='#FF0000'>M2A4 Slammer UP $1200</t>", "ArmorDrop.sqf",[],0,true,true,"","sector1 getVariable 'owner' == side _this"] ; player addEventHandler ["RESPAWN", { _id = [] spawn { waituntil {alive player}; player addAction ["<t color='#FF0000'>M2A4 Slammer UP $1200</t>", "ArmorDrop.sqf",[],0,true,true,"","sector1 getVariable 'owner' == side _this"]; }; }]; If nothing else it should add the action back to SP. Share this post Link to post Share on other sites
BEAKSBY 11 Posted May 6, 2014 (edited) It worked on the first paste and test...THANKS!!! I'm still doing some additional testing. I don't think I need the lines in the player init fields anymore. At first I thought it wad a BUG, but I noticed the addAction disappeared after a while, but noticed this only happened when I killed/destroyed one of my own units. I noticed on the map my player initially was blue but then turned purple after destroying his own units and no longer had access to the addAction until he respawned anew. Interesting. Edited May 6, 2014 by BEAKSBY Share this post Link to post Share on other sites
f2k sel 164 Posted May 6, 2014 (edited) What happens when you shoot your own side you become side ENEMY so will loose the action as it's side WEST/EAST/RESISTANCE only in sectors.(may be) When you respawn it looks your set back to the default side again so the action works. Edited May 6, 2014 by F2k Sel Share this post Link to post Share on other sites
BEAKSBY 11 Posted May 6, 2014 Yes, it does work quite nicely. I've added side dependency to the addAction condition so the side controlling the area can call in their respective vehicles. I've also added a number of vehicles selections to drop. I added a clean up script to delete all dead units and weapons so the battle field runs smoother and does not cause too much driving difficulties. Thanks again for your dedicated support! BTW why don't you like to script in MP? What are the main issues? Share this post Link to post Share on other sites
k0rd 3 Posted May 6, 2014 BTW why don't you like to script in MP? What are the main issues? locality is a big consideration in ARMA. some functions will only work where the target of the function is local (e.g. player 1 executes a script to spawn a group of enemies - many commands to manipulate those enemies must also be run from player 1's machine, because those units are local to machine 1) please see https://community.bistudio.com/wiki/Locality_in_Multiplayer Share this post Link to post Share on other sites
KevsNoTrev 44 Posted May 6, 2014 I will take a look at this even though it looks like you have fixed the issue. One thing to note, using 'player' in scripts can cause issues in multiplayer environment as all human units are player and are all local to themself. This means if you run a script that adds an action to 'player' all non-AI will get the action. if they already have it it will add again. Share this post Link to post Share on other sites