For the ZAPT gamemode, I'm trying to make it so that when a zombie touches a non-zombie player, it instantly turns them into a zombie.
What i've tried to do is edit the oncollision function in package.cs to be this:
function Armor::onCollision(%this, %obj, %col, %pos, %vel)
{
%result = parent::onCollision(%this, %obj, %col, %pos, %vel);
%mini = getMiniGameFromObject(%obj);
if(zombieGameSetUpRight(%mini))
{
if(zombieBot(%obj) && zombieValidTarget(%obj, %col))
{
if(%col.getType() & $TypeMasks::VehicleObjectType)
{
if(%col.getMountedObjectCount() > 0)
{
if(!%obj.zombieHasTarget() || (%obj.target.getID() != %col.getID() && !%obj.target.zombieDistract))
{
%obj.zombieChase(%col);
}
%obj.zombieClaw();
}
else if(%obj.zombieHasTarget() && %obj.target.getID() == %col.getID() && !%col.zombieDistract)
{
%obj.zombieChase(-1);
}
}
else
{
if(!%obj.zombieHasTarget() || (%obj.target.getID() != %col.getID() && !%obj.target.zombieDistract))
{
%obj.zombieChase(%col);
}
%obj.zombieClaw();
}
}
else if(!%obj.isZombie && !%obj.zombieHelpless && !%obj.zombieSmoked && %obj.getState() !$= "Dead" &&
!%col.isZombie && %col.zombieSmoked && %col.getState() !$= "Dead")
{
if(isObject(%col.zombieSmokedBy.zombieSmokingWho) && %col.zombieSmokedBy.zombieSmokingWho.getID() == %col.getID())
{
if(!zombieBot(%col.zombieSmokedBy))
{
if(!zombieBot(%obj.client) && !zombieBot(%col.client))
{
messageClient(%col.zombieSmokedBy.client, '', "\c3" @ %obj.client.name @ "<color:ffaaaa> broke your strangle on \c3" @ %col.client.name @ "<color:ffaaaa>!");
}
else if(!zombieBot(%obj.client) && zombieBot(%col.client))
{
messageClient(%col.zombieSmokedBy.client, '', "\c3A survivor <color:ffaaaa>broke your strangle on \c3" @ %col.client.name @ "<color:ffaaaa>!");
}
else if(zombieBot(%obj.client) && !zombieBot(%col.client))
{
messageClient(%col.zombieSmokedBy.client, '', "\c3" @ %obj.client.name @ "<color:ffaaaa> broke your strangle on \c3another survivor<color:ffaaaa>!");
}
else
{
messageClient(%col.zombieSmokedBy.client, '', "\c3A survivor <color:ffaaaa>broke your strangle on \c3another survivor<color:ffaaaa>!");
}
}
if(isObject(%col.getMountedImage(2)) && %col.getMountedImage(2).getID() == ZombieSmokerConstrictImage.getID())
{
%col.unMountImage(2);
}
%col.zombieHelpless = false;
cancel(%col.zombieSmokedBy.zombieStrangleSched);
%col.zombieSmoked = false;
%col.zombieSmokedBy = "";
if(!zombieBot(%obj.client))
{
if(!zombieBot(%col.client))
{
messageClient(%obj.client, '', "<color:aaffaa>You rescued \c3" @ %col.client.name @ "<color:aaffaa>!");
}
else
{
messageClient(%obj.client, '', "<color:aaffaa>You rescued \c3a survivor<color:aaffaa>!");
}
}
if(!zombieBot(%col.client))
{
if(!zombieBot(%obj.client))
{
messageClient(%col.client, '', "<color:aaffaa>You were rescued by \c3" @ %obj.client.name @ "<color:aaffaa>!");
}
else
{
messageClient(%col.client, '', "<color:aaffaa>You were rescued<color:aaffaa>!");
}
}
}
}
else if(%obj.isZombie != %col.isZombie)
{
if(zombieGameSetUpRight(%mini))
{
if(%obj.isZombie)
%z = %obj;
else
%z = %col;
%z.zombieDiedAs = %z.isZombie;
if(!%z.isZombie)
{
%mini.zombieLastDeathTime = $sim::time;
if(%mini.getProperty("respawn"))
{
if(%mini.ZAPT_PlayerZombies)
{
%transformed = true;
%z.isZombie = true;
messageClient(%client, '', "<color:ffaaaa>You are now a Zombie.");
%z.setDatablock(ZombieStandardArmor);
}
}
else
{
%client.isDead = true;
messageClient(%client, '', "<color:ffaaaa>You are now Dead. There's no respawning in <color:ffffaa>" @ %mini.getProperty("uiName") @ "<color:ffaaaa>, so sit back.");
messageClient(%client, 'MsgYourSpawn');
%client.zombieCameraSched = %client.schedule(2000, "zombieAutoCameraTarget");
}
}
}
}
}
return %result;
}
All I did is near the end of that function I added in a part from the onDeath function, so that (in theory) it would set the non-zombie player's datablock to that of a zombie.
Why isn't this working?