doomnet 23 Posted May 26, 2016 Hi, Could someone help with my PvP mission ? I need to check if player reach 100 kills then the mission ends for everyone and it shows the player name with his stats in a message to everyone just before the mission ends I really don't know how to do this thanks in advance for helping me Share this post Link to post Share on other sites
serena 151 Posted May 26, 2016 You can count player kills in "Killed" event handler, and call endMission or failMission commands 1 Share this post Link to post Share on other sites
doomnet 23 Posted May 26, 2016 You can count player kills in "Killed" event handler, and call endMission or failMission commands Ok thank you but could you give me an example because i don't know how to write it Share this post Link to post Share on other sites
serena 151 Posted May 26, 2016 Something like PLAYERKILLS = 0; PLAYERDEATHS = 0; addMissionEventHandler ["EntityKilled", { private _victim = _this select 0; private _killer = _this select 1; if (isPlayer _killer) then { PLAYERKILLS = PLAYERKILLS + 1}; if (isPlayer _victim) then { PLAYERDEATHS = PLAYERDEATHS + 1}; if (PLAYERKILLS >= 10) then { endMission "END1"}; if (PLAYERDEATHS >= 10) then { endMission "LOSER"}; }]; 1 Share this post Link to post Share on other sites
serena 151 Posted May 26, 2016 If player does not respawn or switch to another unit during mission, you can better use player addEventHandler ["Killed", { ... }] instead of addMissionEventHandler 1 Share this post Link to post Share on other sites
doomnet 23 Posted May 26, 2016 Ok i see thank you Serena i go try this right now ! Share this post Link to post Share on other sites
mrcurry 496 Posted May 27, 2016 Note that endMission has a local effect only. To end globally use remoteExec. Share this post Link to post Share on other sites
doomnet 23 Posted May 27, 2016 Note that endMission has a local effect only. To end globally use remoteExec. Yes i think i will use endMissionServer instead to end missions on all clients ! Share this post Link to post Share on other sites
kylania 568 Posted May 27, 2016 Yes i think i will use endMissionServer instead to end missions on all clients ! I don't believe there's any endMissionServer command? Instead try this for the ArmA 3 style mission end: "end1" remoteExec ["BIS_fnc_endMission"]; That will run the end1 mission end function on all clients. 1 Share this post Link to post Share on other sites
doomnet 23 Posted May 27, 2016 Yes there is that command it says its better to use this to end properly a mission for all clients according to the wiki "BIS_fnc_endMissionServer" and i already use that to end mission and works good very good because as mrcurry says endMission is local remoteExec i never used before and i don't know how it works but its not needed because of the command BIS_fnc_endMissionServer But anyway thanks for your reply but that was not the question of the topic, also it has already been answered ! ;) Share this post Link to post Share on other sites
kylania 568 Posted May 27, 2016 Ahh, that would be a function rather than a command. If you wanted to use that instead you'd do: ["Won"] remoteExec ["BIS_fnc_endMissionServer", 2]; (The 2 means "only run on the server"). Actually, reading this thread makes it sound like BIS_fnc_endMissionServer is mostly used to end the mission on a dedicated server, basically just turning everything off instead of the nice exit graphics and music that a client run BIS_fnc_endMission would generate for players. So, maybe something like: // Run on all clients but not server. "end1" remoteExec ["BIS_fnc_endMission", -2]; // Code from special ed - https://goo.gl/5cYjNV if (isDedicated) then { sleep 25; // Only run on server. ["Won"] remoteExec ["BIS_fnc_endMissionServer", 2]; }; Share this post Link to post Share on other sites