Author Topic: Need help fixing Iban's Lockpick.  (Read 1547 times)

I need some help fixing the script, it's a edited script by JJStorm, it somewhat doesn't work, and I do not know why, it's two pieces of codes, it's the Lockpick code and the Baton code as they are both broken, I don't know what to do because I don't know about JVS's new content.

Thanks if you can help.

Code: [Select]
function CityRPGPicklockImage::onHitObject(%this, %obj, %slot, %col, %pos, %normal)
{
%client = %obj.client;

if(%col.getType() & $TypeMasks::FxBrickObjectType)
{
if($CityRPG::pref::canpicklockadmindoors != 1)
{
if(getrandom(0,3) == 2)
{
%col.JVSOpen(%client);

commandToClient(%client, 'centerPrint', "\c6You have commited a crime. [\c3Breaking and Entering\c6]", 3);
CityRPG_AddDemerits(%client.bl_id, $CityRPG::demerits::breakingAndEntering);
return;
}
else
{
commandToclient(%client, 'centerprint', "\c6Picking Lock...", 3);
}
}
else
{
commandToclient(%client, 'centerprint', "\c6Lock Is unpickable", 3);
}
}
else if(%col.getType() & $TypeMasks::VehicleObjectType)
{
if(%col.locked)
{
%col.locked = false;
CityRPG_AddDemerits(%obj.client.bl_id, $CityRPG::demerits::grandTheftAuto);
commandToClient(%client, 'centerPrint', "\c6You have committed a crime. [\c3Grand Theft Auto\c6]", 5);
}
}

parent::onHitObject(%this, %obj, %slot, %col, %pos, %normal);
}
This code, the door does not open for some strange reason.

Code: [Select]
function CityRPGBatonImage::onHitObject(%this, %obj, %slot, %col, %pos, %normal)
{
%client = %obj.client;

if(%col.getClassName() $= "fxDTSBrick")
{
%col.JVSOpen(%client);
}
else if(%col.getClassName() $= "Player")
{
if((%col.getType() & $typeMasks::playerObjectType) && isObject(%col.client))
{
if(%col.client.getWantedLevel())
{
if(%col.getDatablock().maxDamage - (%col.getDamageLevel() + 25) < %this.raycastDirectDamage)
{
%col.setDamageLevel(%this.raycastDirectDamage + 1);
%col.client.arrest(%client);
}
else
commandToClient(%client, 'CenterPrint', "\c3" @ %col.client.name SPC "\c6is resisting arrest!", 3);
}
else if(CityRPGData.getData(%col.client.bl_id).valueBounty > 0)
commandToClient(%client, 'CenterPrint', "\c3" @ %col.client.name SPC "\c6is not wanted alive.", 3);
else
%doNoEvil = true;
}
}

if(%doNoEvil) { %this.raycastDirectDamage = 0; }
parent::onHitObject(%this, %obj, %slot, %col, %pos, %normal);
if(%doNoEvil) { %this.raycastDirectDamage = 25; }
}


Ah, the all too common DoesntWorkException. :cookieMonster:
Seriously though, what is the error?
What happens?
Have you even tried debugging this yourself?

Ah, the all too common DoesntWorkException. :cookieMonster:
Seriously though, what is the error?
What happens?
Have you even tried debugging this yourself?
I've tried, I can't figure it out
The doors will not open at all, I want it so that the door opens.

I've tried, I can't figure it out
The doors will not open at all, I want it so that the door opens.
Do you get any error in the console?

Do you get any error in the console?
No, it's just that the door won't open.

No, it's just that the door won't open.
Sorry then, I have no idea.
I have never tried to extend JVS in any way.

JVS has changed in the last 4 years and this code doesn't work because of that.

JVS has changed in the last 4 years and this code doesn't work because of that.
clearly.

Yeah, that's kind of a bummer.

Could you guys help me fix it? I have no knowloage of JVS what so ever.

I haven't really looked at the code, but I assume that you could just force a contentstart event on a door?  That would take like five minutes to script.

I haven't really looked at the code, but I assume that you could just force a contentstart event on a door?  That would take like five minutes to script.
No, this doesn't work, I've tried it.

No, this doesn't work, I've tried it.

Why wouldn't it work?  ContentStart needs no special permissions to run.  I think it would work fine.  Lemme write it up.

Code: [Select]
function CityRPGPicklockImage::onHitObject(%this, %obj, %slot, %col, %pos, %normal)
{
%client = %obj.client;

if(%col.getType() & $TypeMasks::FxBrickObjectType)
{
if($CityRPG::pref::canpicklockadmindoors != 1)
{
if(getrandom(0,3) == 2)
{
%col.processInputEvent("onContentStarted",%client);

commandToClient(%client, 'centerPrint', "\c6You have commited a crime. [\c3Breaking and Entering\c6]", 3);
CityRPG_AddDemerits(%client.bl_id, $CityRPG::demerits::breakingAndEntering);
return;
}
else
{
commandToclient(%client, 'centerprint', "\c6Picking Lock...", 3);
}
}
else
{
commandToclient(%client, 'centerprint', "\c6Lock Is unpickable", 3);
}
}
else if(%col.getType() & $TypeMasks::VehicleObjectType)
{
if(%col.locked)
{
%col.locked = false;
CityRPG_AddDemerits(%obj.client.bl_id, $CityRPG::demerits::grandTheftAuto);
commandToClient(%client, 'centerPrint', "\c6You have committed a crime. [\c3Grand Theft Auto\c6]", 5);
}
}

parent::onHitObject(%this, %obj, %slot, %col, %pos, %normal);
}

I'm not sure that would work Nexus. They might remove the onContentStarted event from the brick. Is there not a function you can just call like %col.startContent(%args); ? I will take a look at the code.

Edit:
function fxDTSBrick::contentStart(%obj, %startType, %startDirection, %text, %client)
« Last Edit: April 18, 2011, 01:48:09 AM by lilboarder32 »

So I'd need to put that function in there to get the door to open?

Great :/

I'm not sure that would work Nexus. They might remove the onContentStarted event from the brick. Is there not a function you can just call like %col.startContent(%args); ? I will take a look at the code.

Edit:
function fxDTSBrick::contentStart(%obj, %startType, %startDirection, %text, %client)

The point is, if there is no event on the door, why should it open for any reason?  The way mine would work, I think, is if any events that would be triggered by the door opening would also be triggered.  That way, the lockpick could also be used for windows and buttons and odther jvs things.