| Blockland Forums > Modification Help |
| lockpick/police baton wont open JVS content |
| << < (3/4) > >> |
| otto-san:
--- Quote from: Custard on July 25, 2011, 01:19:07 PM ---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. --- End quote --- Which is better in some situations. |
| meggey:
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]); |
| Bloxxed:
--- Quote from: Custard on July 25, 2011, 01:19:07 PM ---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. --- End quote --- You'd just have to do like --- Code: ---function isJVS(%arguments) { stufftocheck if jvs } --- End code --- Then in the script. --- Code: ---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; } } --- End code --- 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) |
| meggey:
Well it still hasn't been fixed :( |
| otto-san:
--- Quote from: meggey on July 30, 2011, 05:02:30 PM ---Well it still hasn't been fixed :( --- End quote --- i really hope you didn't literally copy+paste the code bloxxed posted |
| Navigation |
| Message Index |
| Next page |
| Previous page |