Author Topic: Growing/Shrinking playertype  (Read 618 times)

I'm trying to make  a playertype, where when you click <jet>, it increases/decreases your size, depending on your current size. When I do it, it doesn't do the decrease. Here's the code:
Code: [Select]
function Armor::OnTrigger(%data, %player, %slot, %io)
{
if(%slot == 4 && %data.getName() $= "PlayerHuge")
{
%scaleDir = 1;
if(%player.getScale() < 5 && %scaleDir == 1)
{
%player.incScale(%player.getDatablock().EBB_SizeIncSpeed);
if(%player.getScale() == 5)
%scaleDir = 0;
}
if(%player.getScale() > 1 && %scaleDir == 0)
{
%player.incScale(%player.getDatablock().EBB_SizeDeIncSpeed);
if(%player.getScale() == 1)
%scaleDir = 1;
}

}
parent::ONTrigger(%data, %player, %slot, %io);
}
« Last Edit: April 12, 2015, 11:15:24 PM by EV0_ »

function Armor::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f) - Needs to be packaged.
« Last Edit: April 12, 2015, 08:44:03 PM by Advanced Bot »

function Armor::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f) - Needs to be packaged.
What do the letters %a, %b, %c, %d, %e, %f mean?

function Armor::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f)
The full arguments are armor::onCollision(%this, %obj, %col, %norm, %speed).

I do not believe it would need to be packaged since you only wants this to apply to your playertype, so an unpackaged definition of YourPlayertypeDatablockName::onCollision(%this, %obj, %col, %norm, %speed) should suffice.

The full arguments are armor::onCollision(%this, %obj, %col, %norm, %speed).
Awesome. I thought there was more to it.

Similarly as the onCollision issue, you wouldn't need to package onTrigger and can simply define YourPlayertypeDatablockName::onTrigger. The arguments for that are armor::onTrigger(%this, %obj, %slot, %val). Check that %slot equals 4 to ensure that the jet button is being used (slot 0 is right hand, slot 1 is left hand, slot 2 is jump, slot 3 is crouch, and slot 4 is jet), and check that %val is 1 to ensure that the button is being pressed (when %val is 0, it means the button is being released).

Similarly as the onCollision issue, you wouldn't need to package onTrigger and can simply define YourPlayertypeDatablockName::onTrigger. The arguments for that are armor::onTrigger(%this, %obj, %slot, %val). Check that %slot equals 4 to ensure that the jet button is being used (slot 0 is right hand, slot 1 is left hand, slot 2 is jump, slot 3 is crouch, and slot 4 is jet), and check that %val is 1 to ensure that the button is being pressed (when %val is 0, it means the button is being released).
Thanks! locking until I get another issue...