Author Topic: I have been pickled by Datablocks!  (Read 1243 times)

Code: [Select]
datablock PlayerData(ForceSpeed : PlayerStandardArmor)

{
maxforwardspeed = 20;
maxbackwardspeed = 15;
maxsidespeed = 15;
};
Thats the code, How would I go about applying this to a weapon. I know it has to do with using an onfire function. I want it so when I use the weapon I recieve that datablock for 10 seconds or something... I searched for about 20 min on the forums looking for a way to do this but couldn't find  :iceCream: Can someone explain this to me?

Is that a player type? If so I dont Know. Sorry :cookieMonster:

Thank you for being useless, as usual  :cookieMonster:

-_-  :panda: W/E i could help you but i dont like you anymore  :panda:

It's like the following
Code: [Select]
datablock ShapeBaseImageData(gunImage)
{
   // Basic Item properties
   shapeFile = "./shapes/pistol.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "0 0 0";
   eyeOffset = 0; //"0.7 1.2 -0.5";
   rotation = eulerToMatrix( "0 0 0" );

   // When firing from a point offset from the eye, muzzle correction
   // will adjust the muzzle vector to point to the eye LOS point.
   // Since this weapon doesn't actually fire from the muzzle point,
   // we need to turn this off. 
   correctMuzzleVector = true;

   // Add the WeaponImage namespace as a parent, WeaponImage namespace
   // provides some hooks into the inventory system.
   className = "WeaponImage";

   // Projectile && Ammo.
   item = BowItem;
   ammo = " ";
   projectile = gunProjectile;
   projectileType = Projectile;

casing = gunShellDebris;
shellExitDir        = "1.0 -1.3 1.0";
shellExitOffset     = "0 0 0";
shellExitVariance   = 15.0;
shellVelocity       = 7.0;

   //melee particles shoot from eye node for consistancy
   melee = false;
   //raise your arm up or not
   armReady = true;

   doColorShift = true;
   colorShiftColor = gunItem.colorShiftColor;//"0.400 0.196 0 1.000";
...

...
};

datablock ShapeBaseImageData(rotateygunImage : gunImage)
{
   rotation = eulerToMatrix( "0 0 180" );
};

Lord Iron you have never helped me, only lied to me. So GTFO and find someone who cares.

PS: Monty I am talking about player datablocks, but thank you for trying.

Code: [Select]
function WeaponImage::onFire(%this,%obj)
{
     if(isEventPending(%obj.forceSpeedReturn))
     {
          cancel(%obj.forceSpeedReturn);
          %obj.forceSpeedReturn = %obj.schedule(10000,"setPlayerToNormal");
          return;
     }
     %obj.setDataBlock(ForceSpeed);
     applyCharacterPrefs(%obj.client);
     %obj.forceSpeedReturn = %obj.schedule(10000,"setPlayerToNormal");
}

function Player::setPlayerToNormal(%obj)
{
     %obj.setDataBlock(PlayerStandardArmor);
     applyCharacterPrefs(%obj.client);
}

You'll need to change a few things like the weapon image.

Ephi, you always make sense =). People say you are egotastic but you help so much.  :iceCream: for you.

Code: [Select]
function WeaponImage::onFire(%this,%obj)
{
     if(isEventPending(%obj.forceSpeedReturn))
     {
          cancel(%obj.forceSpeedReturn);
          %obj.forceSpeedReturn = %obj.schedule(10000,"setPlayerToNormal");
          return;
     }
     %obj.setDataBlock(ForceSpeed);
     applyCharacterPrefs(%obj.client);
     %obj.forceSpeedReturn = %obj.schedule(10000,"setPlayerToNormal");
}

function Player::setPlayerToNormal(%obj)
{
     %obj.setDataBlock(PlayerStandardArmor);
     applyCharacterPrefs(%obj.client);
}

You'll need to change a few things like the weapon image.
Minor problem with ::SetPlayerToNormal. Minigame usage.
If a player got the force speed thing, in a no-jet minigame for example, the player would end up getting jets when the effect "wears off".

I'd write better code but I'm using a Wii, meaning I can hardly type for crap and I can't look for coding stuff.

Code: [Select]
function WeaponImage::onFire(%this,%obj)
{
     if(isEventPending(%obj.forceSpeedReturn))
     {
          cancel(%obj.forceSpeedReturn);
          %obj.forceSpeedReturn = %obj.schedule(10000,"setPlayerToNormal");
          return;
     }
     %obj.origdatablock=%obj.getdatablock();
     %obj.setDataBlock(ForceSpeed);
     applyCharacterPrefs(%obj.client);
     %obj.forceSpeedReturn = %obj.schedule(10000,"setPlayerToNormal");
}

function Player::setPlayerToNormal(%obj)
{
     %obj.setDataBlock(%obj.origdatablock);
     applyCharacterPrefs(%obj.client);
}

You'll need to change a few things like the weapon image.
Minor problem with ::SetPlayerToNormal. Minigame usage.
If a player got the force speed thing, in a no-jet minigame for example, the player would end up getting jets when the effect "wears off".

I'd write better code but I'm using a Wii, meaning I can hardly type for crap and I can't look for coding stuff.
try dat.

Wow, I came back to see if anyone knew how to make it go to original datablock... :cookieMonster: