Jump to content
Sign in to follow this  
macnova1

Help with Mission Bonus reward

Recommended Posts

Hi Guys, I am stuck on how to go about making a reward for completing a mission its on a MP hosted server , i would like to have a bonus respect and money payout to all players who are in the area when the mission is completed ...but i am totally lost on how to script that, I am totally NOOB at scripting I looked into eventhandlers but not sure if i am on the right lines any help would be greatly appreciated 

Share this post


Link to post
Share on other sites

Too little information to give you actually useful help, so here is some less useful help:

// when mission done
{
	if (local _x) then {
		hint "Congratulations on completing the mission, you've won as many tanks as you can carry!";
		createVehicle ["O_MBT_02_cannon_F", (getPosATL _x) vectorAdd [0,0,4], [], 0, "CAN_COLLIDE"];
	};
} forEach (allPlayers inAreaArray "someareamarker");

Share this post


Link to post
Share on other sites

Sorry so i have this script, random tanks spawn once they are killed and crew are killed i would like to have players get a bonus for completing the mission

 

if ((TankMissionCount < 1) && ((random 1) > .5)) then {

TankMissionLocation = [[14988.9,14495.8,0],0,35000,1,0,5,0] call BIS_fnc_findSafePos;
_marker1 = createMarker ["TankMissionMarker", TankMissionLocation]; 
_marker1 setMarkerType "ExileMissionModerateIcon";
_marker1 setMarkerText "Tank Mission";
_marker1 setMarkerPos TankMissionLocation;

_missionVehicles = [


["O_MBT_02_cannon_F"],
["O_MBT_02_cannon_F"]

];

_group1 = createGroup EAST;
_group1 setCombatMode "RED";


{
    TankMissionLocationVehicle = [TankMissionLocation,3,20,1,0,5,0] call BIS_fnc_findSafePos;
_vehicle = createVehicle [(_x select 0),TankMissionLocationVehicle,[],50,"NONE"];
_vehicle setPos [(TankMissionLocationVehicle select 0),(TankMissionLocationVehicle select 1), (TankMissionLocationVehicle select 2)];
_vehicle setVectorUp surfaceNormal position _vehicle;
createVehicleCrew _vehicle;
{
        [_x] joinSilent _group1;
        
        if ("ToolKit" in items _x) then {
            _x removeItems "ToolKit";
        };
        
        if ("Exile_Item_Knife" in magazines _x) then {
            _x removeMagazines "Exile_Item_Knife";
        };
        
        if ("Medikit" in items _x) then {
            _x removeItems "Medikit";
        };
        
        _x addMPEventHandler 
        ["MPKilled",
            {

                private ["_killer","_currentRespect","_amountEarned","_newRespect","_killSummary","_newKillerFrags"];

                _killed = _this select 0;
                _killer = _this select 2;

                _killingPlayer = _killer call ExileServer_util_getFragKiller;

                Event_ALLAI_SimulatedUnits = Event_ALLAI_SimulatedUnits - [_killed]; 

                _currentRespect = _killingPlayer getVariable ["ExileScore", 0];
                _amountEarned = 600;
                _newRespect = _currentRespect + _amountEarned;

                _killingPlayer setVariable ["ExileScore", _newRespect];
                //_killSummary = [];
                //_killSummary pushBack ["ENEMY FRAGGED", _amountEarned];
                //[_killingPlayer, "showFragRequest", [_killSummary]] call ExileServer_system_network_send_to;
                
                _newKillerFrags = _killingPlayer getVariable ["ExileKills", 0];
                _newKillerFrags = _newKillerFrags + 1;
                _killingPlayer setVariable ["ExileKills", _newKillerFrags];
                format["addAccountKill:%1", getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;

                format["setAccountScore:%1:%2", _newRespect, getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;
                _killingPlayer call ExileServer_object_player_sendStatsUpdate;

            }
        ];
    } forEach crew _vehicle;
    [_group1,TankMissionLocationVehicle,500] call BIS_fnc_taskPatrol;
    
    _vehicle addMPEventHandler 
    ["MPKilled",
        {

            private ["_killer","_currentRespect","_amountEarned","_newRespect","_killSummary","_newKillerFrags"];

            _killed = _this select 0;
            _killer = _this select 2;

            _killingPlayer = _killer call ExileServer_util_getFragKiller;

            Event_ALLAI_SimulatedUnits = Event_ALLAI_SimulatedUnits - [_killed]; 

            _currentRespect = _killingPlayer getVariable ["ExileScore", 0];
            _amountEarned = 50000;
            _newRespect = _currentRespect + _amountEarned;

            _killingPlayer setVariable ["ExileScore", _newRespect];
            _killSummary = [];
            _killSummary pushBack ["VEHICLE DESTROYED", _amountEarned];
            [_killingPlayer, "showFragRequest", [_killSummary]] call ExileServer_system_network_send_to;
                
            //_newKillerFrags = _killingPlayer getVariable ["ExileKills", 0];
            //_newKillerFrags = _newKillerFrags + 1;
            //_killingPlayer setVariable ["ExileKills", _newKillerFrags];
            //format["addAccountKill:%1", getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;

            format["setAccountScore:%1:%2", _newRespect, getPlayerUID _killingPlayer] call ExileServer_system_database_query_fireAndForget;
            _killingPlayer call ExileServer_object_player_sendStatsUpdate;

        }
    ];
} forEach _missionVehicles;

_group1 setBehaviour "AWARE";
_group1 setSpeedMode "FULL";

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×