Part of a gamemode I'm making requires changing clients' variables when they drive vehicles into zones, so I accomplished this by editing a function in the Event_Zones add-on. But I need a way to do this without having to edit Event_Zones, because that makes it difficult to release the gamemode.
So what would be the best way to make this happen without editing Event_Zones?
Is it feasible to just copy-paste the editted function in Event_Zones into the server.cs of my gamemode?
Below is the function I've edited in Event_Zones. The portion of the code I added is surrounded by /////////////////.
function fxDTSBrick::onVehicleEnterZone(%obj,%vehicle)
{
//obj is the brick!
if(isObject(%obj.trigger) && %obj.trigger.istriggerBricktrigger == 1)
{
%DriverClient = "";
%DriverPlayer = "";
%VehicleOwnerClient = "";
%VehicleOwnerPlayer = "";
%BrickOwnerClient = %obj.getGroup().client;
%BrickOwnerPlayer = %obj.getGroup().client.player;
//Figure Out Driver---------------------------------
if(isObject(%vehicle.getControllingClient()))
{
%DriverClient = %vehicle.getControllingClient();
}
else//the vehicle may be skiis or there is no driver..
{
if(isObject(%vehicle.client))
{
%DriverClient = %vehicle.client;
}
//otherwise leave the DriverClient empty...
}
%DriverPlayer = %DriverClient.player;
//Figure Out Owner-----------------------------------
if(IsObject(%vehicle.brickGroup))
{
%OwnerClient = %vehicle.brickGroup.client;
}
else//if skiis, Owner is driver..
{
if(IsObject(%vehicle.client))
{
%OwnerClient = %vehicle.client;
}
}
%OwnerPlayer = %OwnerClient.player;
/////////////////////////////////////////////////////////////////////// Faraday's Pizza Delivery crap BELOW //////////////////////////////////////////////////////////////////////////////////////////
if(%DriverClient.deliverTo == %obj && %DriverClient.pizzaCount >= 1)
{
%DriverClient.score += mceil(0.1*(vectorDist(%DriverClient.deliverFromPos,%DriverClient.deliverTo.getposition())));
%DriverClient.pizzaCount -= 1;
if($DelivMode == 1)
{
%DriverClient.deliverTo = $PizzaDeliveryGamemodeLocations[getRandom(1,$PizzaDeliveryGamemodeNumLocations)];
}
if($DelivMode == 2)
{
$Mode2Deliv = $PizzaDeliveryGamemodeLocations[getRandom(1,$PizzaDeliveryGamemodeNumLocations)];
}
echo("Someone delivered a pizza");
talk("Someone delivered a pizza");
}
if(%obj.getname() $= "_pizza")
{
%DriverClient.pizzaCount = 3;
echo("Someone got more pizza");
talk("Someone got more pizza");
}
////////////////////////////////////////////////////////////////////// Faraday's Pizza Delivery crap ABOVE /////////////////////////////////////////////////////////////////////////////////////////
$InputTarget_["Self"] = %obj;
$InputTarget_["Vehicle"] = %vehicle;
$InputTarget_["Driver(Client)"] = %DriverClient;
$InputTarget_["Driver(Player)"] = %DriverPlayer;
$InputTarget_["MiniGame"] = %OwnerClient.minigame;
$InputTarget_["Vehicle_Owner(Player)"] = %OwnerPlayer;
$InputTarget_["Vehicle_Owner(Client)"] = %OwnerClient;
$InputTarget_["Brick_Owner(Client)"] = %BrickOwnerClient;
$InputTarget_["Brick_Owner(player)"] = %BrickOwnerPlayer;
if(isObject(%DriverClient))//driver client.
{
%obj.processInputEvent("onVehicleEnterZone",%DriverClient);
}
else//try the .client field used with skiis - if not settle for brick group owner.
{
%obj.processInputEvent("onVehicleEnterZone",%OwnerClient);
}
}
}