Author Topic: playertype change function  (Read 5340 times)

So is the playertype name wrong? if it is how can i know what name i should type in there to get that playertype ?

function KarambitImage::onMount(%this, %obj, %slot)
{   
        %obj.player.setDatablock(IDFSoldierK);
   %obj.hidenode("RHand");
}

%obj is already the player, so the .player isn't needed
You are asking for the player of the player, which does not exist.

So change the %obj.player to %obj

%obj is already the player, so the .player isn't needed
You are asking for the player of the player, which does not exist.

So change the %obj.player to %obj

See previous page

Error> Could not find datablock IDFSolderK

Error> Could not find datablock IDFSolderK

Where is IDFSolderK defined?

i have a playertype called like that

Can you show us the code for the playertype. You know what? Hell, show us absolutely everything that you have so far.

datablock TSShapeConstructor(IDFSoldierKDts)
{
   baseShape  = "./IDFSoldierK.dts";
   sequence0  = "./IDFSoldierK_root.dsq root";

   sequence1  = "./IDFSoldierK_walk.dsq run";
   sequence2  = "./IDFSoldierK_running.dsq walk";
   sequence3  = "./IDFSoldierK_back.dsq back";
   sequence4  = "./IDFSoldierK_walk.dsq side";

   sequence5  = "./IDFSoldierK_crouch.dsq crouch";
   sequence6  = "./IDFSoldierK_crouchRun.dsq crouchRun";
   sequence7  = "./IDFSoldierK_CrouchBack.dsq crouchBack";
   sequence8  = "./IDFSoldierK_crouchRun.dsq crouchSide";

   sequence9  = "./IDFSoldierK_look.dsq look";
   sequence10 = "./IDFSoldierK_headside.dsq headside";
   sequence11 = "./IDFSoldierK_root.dsq headUp";

   sequence12 = "./IDFSoldierK_jump.dsq jump";
   sequence13 = "./IDFSoldierK_jump.dsq standjump";
   sequence14 = "./IDFSoldierK_fall.dsq fall";
   sequence15 = "./IDFSoldierK_land.dsq land";

   sequence16 = "./IDFSoldierK_armAttack.dsq armAttack";
   sequence17 = "./IDFSoldierK_armReadyLeft.dsq armReadyLeft";
   sequence18 = "./IDFSoldierK_armReadyRight.dsq armReadyRight";
   sequence19 = "./IDFSoldierK_armReadyBoth.dsq armReadyBoth";
   sequence20 = "./IDFSoldierK_spearready.dsq spearready"; 
   sequence21 = "./IDFSoldierK_spearThrow.dsq spearThrow";

   sequence22 = "./IDFSoldierK_talk.dsq talk"; 

   sequence23 = "./IDFSoldierK_death1.dsq death1";
   
   sequence24 = "./IDFSoldierK_root.dsq shiftUp";
   sequence25 = "./IDFSoldierK_root.dsq shiftDown";
   sequence26 = "./IDFSoldierK_root.dsq shiftAway";
   sequence27 = "./IDFSoldierK_root.dsq shiftTo";
   sequence28 = "./IDFSoldierK_root.dsq shiftLeft";
   sequence29 = "./IDFSoldierK_root.dsq shiftRight";
   sequence30 = "./IDFSoldierK_root.dsq rotCW";
   sequence31 = "./IDFSoldierK_root.dsq rotCCW";

   sequence32 = "./IDFSoldierK_root.dsq undo";
   sequence33 = "./IDFSoldierK_root.dsq plant";

   sequence34 = "./IDFSoldierK_sit.dsq sit";

   sequence35 = "./IDFSoldierK_armAttack.dsq wrench";

   sequence36 = "./IDFSoldierK_activate.dsq activate";
   sequence37 = "./IDFSoldierK_activate2.dsq activate2";

   sequence38 = "./IDFSoldierK_root.dsq leftrecoil";
};     

datablock AudioProfile(IDFSoldierKDeathSound)
{
   fileName = "./death1.wav";
   description = AudioClose3d;
   preload = true;
};
datablock AudioProfile(IDFSoldierKPainSound)
{
    fileName = "./pain.wav";
    description = AudioClose3d;
    preload = true;
};
datablock AudioProfile(IDFSoldierKrunSound)
{
    fileName = "./run.wav";
    description = AudioClose3d;
    preload = true;
};

datablock fxDTSBrickData (BrickIDFSoldierKBot_HoleSpawn Data)
{
   brickFile = "Add-ons/Bot_Hole/4xSpawn.blb";
   category = "Special";
   subCategory = "Holes";
   uiName = "IDFSoldierK Hole";
   iconName = "Add-Ons/Bot_IDFSoldierK/icon_vv";

   bricktype = 2;
   cancover = 0;
   orientationfix = 1;
   indestructable = 1;

   isBotHole = 1;
   holeBot = "IDFSoldierKHoleBot";
};

datablock PlayerData(IDFSoldierKHoleBot : PlayerStandardArmor)
{
   shapeFile = "./IDFSoldierK.dts";
   uiName = "IDF_Soldier+Knife";
   minJetEnergy = 0;
   cameramaxdist = 2;
   cameraVerticalOffset = 1;
   cameraHorizontalOffset = 0.8;
   cameraTilt = 0.2;
   maxfreelookangle = 3;
   jetEnergyDrain = 0;
   canJet = 0;
   maxItems   = 10;
   maxWeapons = 5;
   maxTools = 5;

   rideable = false;
   canRide = true;
   paintable = true;

   useCustomPainEffects = true;
   PainSound         = IDFSoldierKPainSound;
   DeathSound         = IDFSoldierKDeathSound;

   mass = 100;
   drag = 0.02;//0.02
   density = 0.80;//0.6
   runSurfaceAngle = 70;
   jumpSurfaceAngle = 70;
    runForce = 90 * 90;
   maxForwardSpeed = 13;
   maxBackwardSpeed = 12;
   maxSideSpeed = 13;

   maxForwardCrouchSpeed = 9;
   maxBackwardCrouchSpeed = 7;
   maxSideCrouchSpeed = 9;

   maxForwardProneSpeed = 2;
   maxBackwardProneSpeed = 2;
   maxSideProneSpeed = 2;

   attackpower = 13;

   maxdamage = 170;//Bot Health
   jumpSound = "";//Removed due to bots jumping a lot

   crouchBoundingBox   = vectorScale("3.5 3.5 1.6", 4); //"2.5 2.5 2.4";
   
   //Hole Attributes
   isHoleBot = 1;

   //Spawning option
   hSpawnTooClose = 0;//Doesn't spawn when player is too close and can see it
     hSpawnTCRange = 8;//above range, set in brick units
   hSpawnClose = 0;//Only spawn when close to a player, can be used with above function as long as hSCRange is higher than hSpawnTCRange
     hSpawnCRange = 32;//above range, set in brick units

   hType = Friendly; //Enemy,Friendly, Neutral
     hNeutralAttackChance = 0; //0 to 100, Chance that this type will attack neutral bots, ie horses/vehicles/civilians
   //can have unique types, national socialists will attack zombies but national socialists will not attack other bots labeled national socialist
   hName = "IDFSoldierK";//cannot contain spaces
   hTickRate = 3000;
   
   //Wander Options
   hWander = 1;//Enables random walking
     hSmoothWander = 1;//This is in addition to regular wander, makes them walk a bit longer, and a bit smoother
     hReturnToSpawn = 1;//Returns to spawn when too far
     hSpawnDist = 80;//Defines the distance bot can travel away from spawnbrick
     hGridWander = 0;//Locks the bot to a grid, overwrites other settings
   
   //Searching options
   hSearch = 1;//Search for Players
     hSearchRadius = 150;//in brick units
     hSight = 1;//Require bot to see player before pursuing
     hStrafe = 1;//Randomly strafe while following player
   hSearchFOV = 0;//if enabled disables normal hSearch
     hFOVRange = 0.7; // determines the angle we can see the player at, 0.7 is about normal fov for players, if 0 we can see all in front, if 1 we could only see someone perfectly ahead, can be negative
     // hFOVRadius = 6; // no longer used, we now use searchRadius
     hHearing = 2;//If it hears a player it'll look in the direction of the sound

     hAlertOtherBots = 3;//Alerts other bots when he sees a player, or gets attacked

   //Attack Options
   hMelee = 0;//Melee
     hAttackDamage = 15;//Melee Damage
   hShoot = 1;
     hWep = "gunItem";
     hShootTimes = 5;//Number of times the bot will shoot between each tick
     hMaxShootRange = 300;//The range in which the bot will shoot the player
     hAvoidCloseRange = 2;//
      hTooCloseRange = 7;//in brick units

   //Misc options
   hActivateDirection = 0; // 0 1 2, determines the direction you have to face the bot to activate him, both, front back
   hMoveSlowdown = 0; // bool, determines wether the bot will slow down when following enemies
   hAvoidObstacles = 1;
   hSuperStacker = 0;//When enabled makes the bots stack a bit better, in other words, jumping on each others heads to get to a player
   hSpazJump = 0;//Makes bot jump when the user their following is higher than them

   hAFKOmeter = 1;//Determines how often the bot will wander or do other idle actions, higher it is the less often he does things

   hIdle = 1;// Enables use of idle actions, actions which are done when the bot is not doing anything else
     hIdleAnimation = 0;//Plays random animations/emotes, sit, click, love/hate/etc
     hIdleLookAtOthers = 1;//Randomly looks at other players/bots when not doing anything else
     hSpasticLook = 1;//Makes them look around their environment a bit more.
   hEmote = 1;
};

function IDFSoldierKHoleBot::onAdd(%this,%obj)
{
   armor::onAdd(%this,%obj);
   %color[%a++] = "0.766355 0.584112 0.369159 1";
   //Appearance IDFSoldierK

   %choice = getRandom(1,%a);
   %obj.setNodeColor("ALL",%color[%choice]);
   %obj.chestColor =  %color[%choice];
   scheduleNoQuota(10,%obj,delayIDFSoldierKCheck,%obj);
}

function IDFSoldierKHoleBot::onBotLoop( %this, %obj )
{
   // echo( "IDFSoldierK onLoop" );
   // parent::onBotLoop( %this, %obj );
   //Called every cycle
   //Useful for doing unique behaviors during normal loop
}

function IDFSoldierKHoleBot::onBotCollision( %this, %obj, %col, %normal, %speed )
{
   // echo( "IDFSoldierK onCollision" );
   //Called once every second the object is colliding with something
}

function IDFSoldierKHoleBot::onBotFollow( %this, %obj, %targ )
{
   // echo( "IDFSoldierK onFollow" );
   //Called when the target follows a player each tick, or is running away
}

function IDFSoldierKHoleBot::onBotDamage( %this, %obj, %source, %pos, %damage, %type )
{
   // echo( "IDFSoldierK onDamage" );
   //Called when the bot is being damaged
}

package BotFollowPlayerPackage
{
   function AIPlayer::hLoop(%obj)
   {
      Parent::hLoop(%obj);

      if(!isObject(%obj.hFollowingNoDamage))
         %obj.hFollowingNoDamage = 0;

      if(%obj.hFollowingNoDamage == 0 && %obj.hFollowType != 1 && %obj.hFollowType != 2)
         return;

      if(%obj.hFollowingNoDamage == 0 && (%obj.hFollowType == 1 || %obj.hFollowType == 2))
      {
         %obj.followPlayer(%obj.hFollowType, %obj.hFollowingNoDamage.bl_id, %obj.hKeepFollowing, %obj.hFollowingNoDamage);
         return;
      }

      %following = %obj.hFollowingNoDamage.player;

      if(!isObject(%following) && !%obj.hKeepFollowing)
         %obj.hFollowingNoDamage = 0;

      if(%following.client.isDead && !%obj.hKeepFollowing)
         %obj.hFollowingNoDamage = 0;

      %obj.followPlayer(%obj.hFollowType, %obj.hFollowingNoDamage.bl_id, %obj.hKeepFollowing, %obj.hFollowingNoDamage);
   }

   function GameConnection::onDeath(%this, %killerPlayer, %killerClient, %damageType, %damageLoc)
   {
      Parent::onDeath(%this, %killerPlayer, %killerClient, %damageType, %damageLoc);
      %this.isDead = true;
   }

   function GameConnection::spawnPlayer(%this, %spawn)
   {
      %this.isDead = false;
      return Parent::spawnPlayer(%this, %spawn);
   }
};

is this the right file ?

Your playertype is very clearly not named IDFSolderK. The correct name is IDFSoldierKHoleBot.

datablock PlayerData(IDFSoldierKHoleBot : PlayerStandardArmor)
                     ^~~~~~~~~~~~~~~~~~


Ok it WORKS !!!!!!!!!!!
but now i ran into another porblem now it's a much more difficult one. i wanted the knife to make my player move faster so i made it change the playertype to a similiar one just abit faster but the other team has a playertype with a different model but when he uses the knife he turns into the other team's playertype OMG what should i do -__-

You have to create a separate playertype for each of the teams and turn them into appropriate datablocks using the slayer's getteam(), that i am sure that someone else could explain much better.

Hmm Dannu i got 2 slow player types and 2 fast playertypes

And both of them are personalized for either team?