Author Topic: Fixing the Lockpick  (Read 461 times)

I found this old topic: http://forum.blockland.us/index.php?topic=143226.0
And I realized the lockpick could be fixed.
I'm working on customizing the mod for Vigilance and I need to have it fixed.

So could anyone help me fix the DoorOpen parts to a fakekill event? I know the errors are because of the JVS switch about 2 years ago.

Code: [Select]
// Section 2.1 : Visual Functionality
function CityRPGPicklockImage::onPreFire(%this, %obj, %slot)
{
%obj.playThread(2, "armAttack");
}

function CityRPGPicklockImage::onStopFire(%this, %obj, %slot)
{
%obj.playThread(2, "root");
}

function CityRPGPicklockImage::onHitObject(%this, %obj, %slot, %col, %pos, %normal)
{
if(%col.getType() & $TypeMasks::FxBrickObjectType)
{
%client = %obj.client;
%brickData = %col.getDatablock();
if(isObject(%col.door) && %col.door.closed)
{
if(getRandom(0, 3) > 2)
{
for(%i = 0; %col.eventInput[%i] !$= "" && !%doorPath; %i++)
{
if(%col.eventOutput[%i] $= "doorOpen")
%doorPath = %col.eventOutputParameter[%i, 2];
}

switch(%doorPath)
{
case 0: %doorResult = %col.doorOpenCW();
case 1: %doorResult = %col.doorOpenCCW();
default: %doorResult = %col.doorOpen();
}

%col.schedule(3000, "doorClose");

if(%doorResult == 1)
{
%col.schedule(3000, "doorClose");

commandToClient(%client, 'centerPrint', "\c6You have commited a crime. [\c3Breaking and Entering\c6]", 3);
CityRPG_AddDemerits(%client.bl_id, $CityRPG::demerits::breakingAndEntering);
}
else
{
commandToClient(%client, 'centerPrint', "\c6You have commited a crime. [\c3Attempted Breaking and Entering\c6]", 3);
CityRPG_AddDemerits(%client.bl_id, $CityRPG::demerits::attemptedBnE);
}
}
else
commandToClient(%client, 'centerPrint', "\c6Picklocking attempt failed", 1);
}
}

So could anyone help me fix the DoorOpen parts to a fakekill event?
Code: [Select]
// Section 2.1 : Visual Functionality
function CityRPGPicklockImage::onPreFire(%this, %obj, %slot)
{
%obj.playThread(2, "armAttack");
}

function CityRPGPicklockImage::onStopFire(%this, %obj, %slot)
{
%obj.playThread(2, "root");
}

function CityRPGPicklockImage::onHitObject(%this, %obj, %slot, %col, %pos, %normal)
{
if(%col.getType() & $TypeMasks::FxBrickObjectType)
{
%client = %obj.client;
%brickData = %col.getDatablock();
if(isObject(%col.door) && %col.door.closed)
{
if(getRandom(0, 3) > 2)
{
commandToClient(%client, 'centerPrint', "\c6You have commited a crime. [\c3Breaking and Entering\c6]", 3);
CityRPG_AddDemerits(%client.bl_id, $CityRPG::demerits::breakingAndEntering);
%col.fakeKillBrick("0 0 0",TIMEYOUWANTITTOBREAKFOR);
}
else
commandToClient(%client, 'centerPrint', "\c6Picklocking attempt failed", 1);
}
}
}