Author Topic: Assigning a datablock and going back to original  (Read 2205 times)

I need to have a way to make an on collision function that makes the victim get a certain datablock for a time (I know it has something to do with schedules but I don't exactly get it) then give the victim its original datablock after that time. Please Help, Ive tried for about 5 hours and I know that some of you might be able to help :)

I don't know how to set a players but I'd do something like this:

Code: [Select]
function setPlayerDataBlock(%this, %datablock)
{
        %revertto = %this.playerDatablock; //or whatever
        %this.setDatablock(%datablock); //or whatever it is
        schedule(1000,0,%this.setDatablock(%revertto); //...
}

I don't know how to set a players but I'd do something like this:

Code: [Select]
function setPlayerDataBlock(%this, %datablock)
{
        %revertto = %this.getDatablock(); //or whatever
        %this.setDatablock(%datablock); //or whatever it is
        schedule(1000,0,%this.setDatablock(%revertto)); //...
}
Fixed something, although I am not completely sure about it.

I know for a fact that won't work :(. It needs to be On collision silly people :P

thats the function you would call in the oncollsion.

so
<<oncollision stuff>>
{
   setplayerdatablock(%obj,"playernojet");
}

So is this all right together?

Code: [Select]
function IceFreezeImage::onCollision(%this,%obj,%slot)
{
   setplayerdatablock(%obj,"playerfreezed");
}

function setPlayerDataBlock(%this, %datablock)
{
        %revertto = %this.getDatablock(); //or whatever
        %this.setDatablock("PlayerFreezed"); //or whatever it is
        schedule(10000,0,%this.setDatablock(%revertto)); //...
}

datablock PlayerData(PlayerFreezed : PlayerStandardArmor)
{
    maxForwardSpeed = 0;
    maxBackwardSpeed = 0;
    maxSideSpeed = 0;

    maxForwardCrouchSpeed = 0;
    maxBackwardCrouchSpeed = 0;
    maxSideCrouchSpeed = 0;

    jumpForce = 0 * 0; //0.0 * 0;
canJet = 0;
uiName = "";
};

I would think, try it. get any problems, post.


Does the armor::onCollision work properly?


There are no syntax errors or any others so console wont help :(. I am working on a different method right now, I'll post it soon.

So is this all right together?

Code: [Select]
function IceFreezeImage::onCollision(%this,%obj,%slot)
{
   setplayerdatablock(%obj,"playerfreezed");
}

function setPlayerDataBlock(%this, %datablock)
{
        %revertto = %this.getDatablock(); //or whatever
        %this.setDatablock(%datablock); //or whatever it is
        schedule(10000,0,%this.setDatablock(%revertto)); //...
}

datablock PlayerData(PlayerFreezed : PlayerStandardArmor)
{
    maxForwardSpeed = 0;
    maxBackwardSpeed = 0;
    maxSideSpeed = 0;

    maxForwardCrouchSpeed = 0;
    maxBackwardCrouchSpeed = 0;
    maxSideCrouchSpeed = 0;

    jumpForce = 0 * 0; //0.0 * 0;
canJet = 0;
uiName = "";
};
using %datablock would be pointless if you didn't use it, so i editted that.

I'd like to note that if you hit a person while they are frozen, after turning back to normal for a little bit, they'll go back to being frozen.

ITT: people who don't know how to use schedules (or script, after reading this).

Code: [Select]
function setPlayerDataBlock(%this, %datablock)
{
        %revertto = %this.dataBlock;
        %this.setDataBlock(%datablock);
        %this.schedule(10000,"setDatablock",%revertto);
}

IceFreezeImage? Tell me, how does one collide with an image? This has a minefield of errors...

IceFreezeImage? Tell me, how does one collide with an image?

Haha, pandaing owned.