Author Topic: SetPlayerScale crashes?  (Read 952 times)

I was modifying the SetPlayerScale script and now whenever I use the event or use any functions that execute SetScale, it crashes. Here's what I have:
Code: [Select]
function player::setScale(%this, %scale, %client)
{
parent::SetScale(%this, %scale, %client);

%hunger = %this.client.RPData.value["hunger"];
%thirst = %this.client.RPData.value["thirst"];

if ((%hunger + %thirst) / 2 >= 1 && (%hunger + %thirst) / 2 <= 20)
{
%this.setScale("0.5 0.5 1");
}

if ((%hunger + %thirst) / 2 >= 21 && (%hunger + %thirst) / 2 <= 50)
{
%this.setScale("0.7 0.7 1");
}

if ((%hunger + %thirst) / 2 >= 51 && (%hunger + %thirst) / 2 <= 80)
{
%this.setScale("0.9 0.9 1");
}

if ((%hunger + %thirst) / 2 >= 81 && (%hunger + %thirst) / 2 <= 100)
{
%this.setScale("1 1 1");
}

if ((%hunger + %thirst) / 2 >= 101 && (%hunger + %thirst) / 2 <= 120)
{
%this.setScale("1.1 1.1 1");
}

if ((%hunger + %thirst) / 2 >= 121 && (%hunger + %thirst) / 2 <= 150)
{
%this.setScale("1.3 1.3 1");
}

if ((%hunger + %thirst) / 2 >= 151 && (%hunger + %thirst) / 2 <= 180)
{
%this.setScale("1.5 1.5 1");
}

if ((%hunger + %thirst) / 2 >= 181 && (%hunger + %thirst) / 2 <= 200)
{
%this.setScale("2 2 1");
}
}

It is inside a package that is activated whenever I use this function.
« Last Edit: December 03, 2013, 02:09:46 AM by Gordo12699 »

Is it inside a package?

Yeah, forgot to mention that. It is inside a package and the package is activated when I use this function.

You're calling setscale inside setscale.

The infinite loop will crash the game.

You're calling setscale inside setscale.

The infinite loop will crash the game.

Ah, makes sense. How do I change the players scale without using SetScale?

Ah, makes sense. How do I change the players scale without using SetScale?

Call the parent instead of the function.

Call the parent instead of the function.

Will do.

Edit: Works fine now. Thanks guys!
« Last Edit: December 03, 2013, 06:30:26 AM by Gordo12699 »