Author Topic: lockpick/police baton wont open JVS content  (Read 2365 times)

OK i know people have said this before but please help me to fix the police baton and lock pick on ibans rp :(

i cant get them to open doors i have tryed everything :(

you have to actually edit the script for it to work

you have to actually edit the script for it to work

yes i know but i am just a very noob at this haha as in scripting i know what it is and all that and i know a few things i can read it but not yet master it if you know what i mean

but this i find it very hard to do i cant find the problem :(

The main issue is how the new JVS works, it's completely different.

I could help you, except I don't remember the use of every parameter in there.
Sorry.

The main issue is how the new JVS works, it's completely different.

I could help you, except I don't remember the use of every parameter in there.
Sorry.

OK tell me what to do to refresh your memory lol :P

OK tell me what to do to refresh your memory lol :P
I basically went ingame, placed a JVS brick, dump()ed it, played around with the parameters, and eventually it worked.

Do not use iban's rp, download rp core made by McTwist.

Do not use iban's rp, download rp core made by McTwist.

do you have it?

i will try anything out :)

do you have it?

i will try anything out :)
Go to RTB site. You will find it there.

As I just said in a previous topic, you need to change the Baton's and Lockpick's recognized events to the current JVS event lines, instead of the old "ondooropen" and "ondoorclose".

This would mean it would have to recognize "oncontentstart" and "oncontentstop".

Edit: With our CityRPG, we simply made the baton recognize whether or not what it was hitting was a JVS door, and fakekilled it if it was.
« Last Edit: July 25, 2011, 01:21:45 PM by Custard »

Edit: With our CityRPG, we simply made the baton recognize whether or not what it was hitting was a JVS door, and fakekilled it if it was.
Which is better in some situations.

see here this is what i have there is no "ondoor" or "oncontent"

// ============================================================
// Project            :   CityRPG
// Author            :   Iban
// Description         :   Police Baton Code file
// ============================================================
// Table of Contents
// 1. Datablocks
// 2. Functions
// ============================================================

// ============================================================
// Section 1 : Datablocks
// ============================================================
datablock itemData(CityRPGBatonItem : hammerItem)
{
   category = "Weapon";
   uiName = "Baton";
   image = CityRPGBatonImage;
   colorShiftColor = "0.898039 0.898039 0.000000 1.000000";
   
   // CityRPG Properties
   noSpawn = true;
   canArrest = true;
};

datablock shapeBaseImageData(CityRPGBatonImage : hammerImage)
{
   // SpaceCasts
   raycastWeaponRange = 6;
   raycastWeaponTargets = $TypeMasks::All;
   raycastDirectDamage = 25;
   raycastDirectDamageType = $DamageType::HammerDirect;
   raycastExplosionProjectile = hammerProjectile;
   raycastExplosionSound = hammerHitSound;
   
   item = CityRPGBatonItem;
   projectile = hammerProjectile;
   colorShiftColor = "0.898039 0.898039 0.000000 1.000000";
   showBricks = 0;
};

// ============================================================
// Section 2 : Functions
// ============================================================

// Section 2.1 : Visual Functionality
function CityRPGBatonImage::onPreFire(%this, %obj, %slot)
{
   %obj.playThread(2, "armAttack");
}

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

function CityRPGBatonImage::onHitObject(%this, %obj, %slot, %col, %pos, %normal)
{
   if(%col.getClassName() $= "fxDTSBrick")
   {
      %client = %obj.client;
      %brickData = %col.getDatablock();
      if(isObject(%col.door) && %col.door.closed)
      {
         %col.fakeKillBrick(%vec, 3, %client);
         %col.doorDestroy();
      }
   }
   else if(%col.getClassName() $= "Player")
   {
      %client = %obj.client;
      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 "\c6has resisted 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; }
}

function CityRPGBatonItem::onPickup(%this, %item, %obj)
{
   %item.delete();
   
   for(%a = 0; %a < %obj.getDatablock().maxTools; %a++)
   {
      if(!isObject(%obj.tool[%a]) || %obj.tool[%a].getName() !$= "CityRPGLBItem")
         if(%freeSpot $= "" && %obj.tool[%a] $= "") { %freeSpot = %a; }
      else
         %alreadyOwns = true;
   }
   
   if(%freeSpot !$= "" && !%alreadyOwns)
   {
      %obj.tool[%freeSpot] = CityRPGLBItem.getID();
      messageClient(%obj.client, 'MsgItemPickup', "", %freeSpot, %obj.tool[%freeSpot]);

As I just said in a previous topic, you need to change the Baton's and Lockpick's recognized events to the current JVS event lines, instead of the old "ondooropen" and "ondoorclose".

This would mean it would have to recognize "oncontentstart" and "oncontentstop".

Edit: With our CityRPG, we simply made the baton recognize whether or not what it was hitting was a JVS door, and fakekilled it if it was.
You'd just have to do like

Code: [Select]
function isJVS(%arguments)
{
stufftocheck if jvs
}
Then in the script.

Code: [Select]
function CityRPGBatonImage::onHitObject(%this, %obj, %slot, %col, %pos, %normal)
{
   if(%col.getClassName() $= "fxDTSBrick")
   {
      %client = %obj.client;
      %brickData = %col.getDatablock();
      if(isJVS); //This is the KEY part for it to work.
      {
         %col.fakeKillBrick(%vec, 3, %client);
         %col.doorDestroy();
      }
   }
   else if(%col.getClassName() $= "Player")
   {
      %client = %obj.client;
      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 "\c6has resisted 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; }
}

This is basically saying;

"Is this a JVS Door? Well, I've hit it, ah, it is! Let's fakekill it, wait a minute, is did my owner just hit a brick, no fake kill that!"

Meggey, send me your CityRPG file and I'll fix it for you. (Obviously by message)

Well it still hasn't been fixed :(

Well it still hasn't been fixed :(
i really hope you didn't literally copy+paste the code bloxxed posted