Author Topic: setPlayerScale on weapon use?  (Read 1913 times)

I want it so when you use a weapon, your scale changes.

So far I have...

Code: [Select]
function exampleImage::onFire(%player, %obj, %slot)
{
    %client.player.setscale("2 2 2");
}

Ya, that won't work because there's no client.

Code: [Select]
function exampleImage::onFire(%image, %player, %slot) {
  if(%player.getScale() $= "2 2 2")
      %player.setscale("1 1 1");
  else
      %player.setscale("2 2 2");
}

Okay, not sure about which is the player, but first should always be the object calling, so it should be the image.

You mean like the Mushroom thing from Mario?

Someone made it and you could look at the script for future references :p

i think you are missing a parent

Tom

i think you are missing a parent
Parent isn't necessary because he isn't modifying existing code.

Parent isn't necessary because he isn't modifying existing code.

oh, i seemed to have missed that

3 problems...

1 - ::onFire() is only called when you shoot the weapon, so nothing is going to happen until you pull the trigger
2 - code needs a little fixing:
Code: [Select]
function exampleImage::onFire(%this, %player, %obj, %slot)
{
    %player.setscale("2 2 2");
}

3 - To do what you want, you need to set the player scale when the weapon is actually picked up.  If I remember correctly, there is a "onToolPickup" message that you can package to catch this.

i think you are missing a parent
/glare

3 problems...

1 - ::onFire() is only called when you shoot the weapon, so nothing is going to happen until you pull the trigger
2 - code needs a little fixing:
Code: [Select]
function exampleImage::onFire(%this, %player, %obj, %slot)
{
    %player.setscale("2 2 2");
}

3 - To do what you want, you need to set the player scale when the weapon is actually picked up.  If I remember correctly, there is a "onToolPickup" message that you can package to catch this.


you are my hero of the day