Deployable base turret goof

Not sure where I goofed at, but while the turret shows in inventory screen, and can be purchased, there is no message concerning how many out of the maximum avalible have been purchased, no icon for the turret base, and worse yet, I can't deploy the thing.


Ideas where I might have messed up?

Comments

  • This points towards an Item or Image Datablock Error, Check to see that the script does not create a syntax error. If that checks out, Check InventoryHud.cs, to ensure you specified the Item Name correctly in it's $NameToInv Entry.
  • I'm probably going to end up gutting and starting over since ther'es too many steps where thigns could have gone wrong.
  • Basically if you dont get the icon then thats in Hud.cs example from Ninja-Xr;
    $BackpackHudData[31, itemDataName] = "BaseTurretDeployable";
    $BackpackHudData[31, bitmapName] = "gui/hud_new_packturret";
    
    The deployable name and then the icon you want as the pack.

    If its not saying the amount of max you purchased then you got this line missing from the deployables own .cs file in the ondeploy function;
    $TeamDeployedCount[%plyr.team, BaseTurretDeployable]++;
    

    Dont forget to add;
    $TeamDeployedCount[%obj.team, BaseTurretDeployable]--;
    
    To the ondestroy function to add one back to the count when destroyed.

    Also add the count to the deployables.cs easy to find the code its at the top and to exec the pack in there as well. Does the pack show on your back when you purchase it?
  • edited July 2009
    Thanks. I'll edit this post to post results.

    Edit: Not sure where the ondeploy/ondestroy functions are in turret.cs
    //-----------------------------------------------------
    // Deployable Base Turret (Micromitch, Liquid, Nick418)
    //-----------------------------------------------------
    
    datablock ShapeBaseImageData(TurretDeployableImage)
    {
    
       mass = 15;
       emap = true;
    
       shapeFile = "stackable1s.dts";
       item = TurretBasePack;
       mountPoint = 1;
       offset = "0 -0.2 0";
    
       minDeployDis = 0.5;
       maxDeployDis = 5.0;
    
       deployed = TurretDeployedBase;
       heatSignature = 0;
    
       stateName[0] = "Idle";
       stateTransitionOnTriggerDown[0] = "Activate";
    
       stateName[1] = "Activate";
       stateScript[1] = "onActivate";
       stateTransitionOnTriggerUp[1] = "Idle";
    
       isLarge = true;
       maxDepSlope = 30;
       deploySound = StationDeploySound;
    };
    
    datablock ItemData(TurretBasePack)
    {
       className = Pack;
       catagory = "Deployables";
       shapeFile = "stackable1s.dts";
    
       origBarrel = "PlasmaBarrelLarge"; //added by nick418
       mass = 3.0;
       elasticity = 0.2;
       friction = 0.6;
       pickupRadius = 1;
       rotate = false;
       image = "TurretDeployableImage";
       pickUpName = "a deployable base turret";
       heatSignature = 0;
    
       computeCRC = true;
       emap = true;
    
    };
    
    datablock TurretData(TurretDeployedBase) : TurretDamageProfile
    {
       className = DeployedTurret;
       shapeFile = "turret_base_large.dts";
    
       isGrounded = true;              // Added per Liquid (set rotation)
       deployedFrom = TurretBasePack;  // Added per BadShot (undeploy)
    
       rechargeRate = 0.31;
    
       selfPower = true;
       needsNoPower = true;
    
       mass = 5.0;
       maxDamage = 2.50;
       destroyedLevel = 2.50;
       disabledLevel = 1.35;
       repairRate = 0;
       explosion = TurretExplosion;
       expDmgRadius = 15.0;
       expDamage = 0.7;
       expImpulse = 2000.0;
    
       deployedObject = true;
    
       thetaMin = 15;
       thetaMax = 140;
       //thetaNull = 90;
    
       isShielded = true;
       energyPerDamagePoint = 50;
       maxEnergy = 200;
    
       humSound = SensorHumSound;
       heatSignature = 0;
       pausePowerThread = true;
    
       canControl = true;
       cmdCategory = "DTactical";
       cmdIcon = CMDTurretIcon;
       cmdMiniIconName = "commander/MiniIcons/com_turret_grey";
       targetNameTag = 'Deployed Base';
       targetTypeTag = 'Turret';
       sensorData = TurretBaseSensorObj;
       sensorRadius = TurretBaseSensorObj.detectRadius;
       sensorColor = "0 212 45";
    
       firstPersonOnly = true;
    
       debrisShapeName = "debris_generic.dts";
       debris = TurretDebris;
    };
    
    function TurretBasePack::onPickup(%this, %obj, %shape, %amount)
    {
       // created to prevent console errors
    }
    
    function TurretDeployableImage::onDeploy(%item, %plyr, %slot)
    {
       $TeamDeployedCount[%plyr.team, BaseTurretDeployable]++;
       %deplObj = Parent::onDeploy(%item, %plyr, %slot);
       %origBarrel = %item.item.origBarrel;
       if(%origBarrel !$= "")
       {
          %deplObj.mountImage(%origBarrel, 0, false);
          %item.item.origBarrel = "PlasmaBarrelLarge"; // Set the default here, too.
       }
       %deplObj.setSelfPowered();
       %deplObj.playThread($PowerThread,"Power");
    }
    
    
    
    function TurretDeployedBase::disassemble(%data, %plyr, %hTgt)
    {
       %plyr.getMountedImage($BackpackSlot).item.origBarrel = %hTgt.getMountedImage(0);
    }
    $TeamDeployedCount[%obj.team, BaseTurretDeployable]--;
    
  • The deployed count for the disassembly is not part of the function. Its out the brackets.

    Also this should push you in the right direction.

    Not tested didnt have much time, the onDestroyed is correct though;
    datablock TurretData(TurretDeployedBase) : TurretDamageProfile
    {
       className = DeployedTurret;
       shapeFile = "turret_base_large.dts";
       isGrounded = true;              // Added per Liquid (set rotation)
       deployedFrom = TurretBasePack;  // Added per BadShot (undeploy)
       rechargeRate = 0.31;
       selfPower = true;
       needsNoPower = true;
       mass = 5.0;
       maxDamage = 2.50;
       destroyedLevel = 2.50;
       disabledLevel = 1.35;
       repairRate = 0;
       explosion = TurretExplosion;
       expDmgRadius = 15.0;
       expDamage = 0.7;
       expImpulse = 2000.0;
       deployedObject = true;
       thetaMin = 15;
       thetaMax = 140;
       //thetaNull = 90;
       isShielded = true;
       energyPerDamagePoint = 50;
       maxEnergy = 200;
       humSound = SensorHumSound;
       heatSignature = 0;
       pausePowerThread = true;
       canControl = true;
       cmdCategory = "DTactical";
       cmdIcon = CMDTurretIcon;
       cmdMiniIconName = "commander/MiniIcons/com_turret_grey";
       targetNameTag = 'Deployed Base';
       targetTypeTag = 'Turret';
       sensorData = TurretBaseSensorObj;
       sensorRadius = TurretBaseSensorObj.detectRadius;
       sensorColor = "0 212 45";
       firstPersonOnly = true;
       debrisShapeName = "debris_generic.dts";
       debris = TurretDebris;
       barrel = PlasmaBarrelLarge; - 4TR3X Set barrel here
    };
    
    function TurretBasePack::onPickup(%this, %obj, %shape, %amount)
    {
       // created to prevent console errors
    }
    
    
    
    function TurretDeployableImage::onDeploy(%item, %plyr, %slot)
    {
         %plyr.unmountImage(%slot); // 4TR3X - Takes the pack off the back
         %plyr.decInventory(%item.item, 1); // 4TR3x - Takes one off the players inventory
         %rot = %item.getInitialRotation(%plyr);
         %turret =	new Turret()
         {
    		dataBlock = "BaseTurretDeployed";
    		initialBarrel = "PlasmaBarrelLarge";
    	};
    
         MissionCleanup.add(%turret); // 4TR3x - Think this removes it from the team usage at end of game
         %turret.setTransform(%item.surfacePt SPC %rot);
         %turret.setSelfPowered(); // 4TR3x - Powers self
         if(%turret.getDatablock().rechargeRate) // 4TR3x - 
               %turret.setRechargeRate(%turret.getDatablock().rechargeRate);
         %turret.team = %plyr.client.Team; // 4TR3x - Sets team
         %turret.owner = %plyr.client; // 4TR3x - Sets person who dropped it
         if(%turret.getTarget() != -1)
               setTargetSensorGroup(%turret.getTarget(), %plyr.client.team);
         addToDeployGroup(%turret);
         AIDeployObject(%plyr.client, %turret);
         serverPlay3D(%item.deploySound, %turret.getTransform()); // 4TR3x - Sound
         $TeamDeployedCount[%plyr.team, BaseTurretDeployable]++; // 4TR3x - Removes from team inventory 
         %turret.deploy();
         return %turret;
    }
    
    function TurretDeployedBase::onDestroyed(%this, %obj, %prevState)
    {
       Parent::onDestroyed(%this, %obj, %prevState);
       $TeamDeployedCount[%obj.team, TurretDeployedBase]--; // 4TR3X - Forgot to change BaseTurretDeployable to your name of TurretDeployedBase
       %obj.schedule(500, "delete");
    }
    
  • Lol...

    I already have the base turret code I just added to his in a rush at work but great spot :D
Sign In or Register to comment.