NEW TOPIC: Event help

Author Topic: NEW TOPIC: Event help  (Read 1193 times)

New Topic

I need help with creating this new event...
Basically I'm trying to make the setMaxForwardSpeed function usable in terms of eventing.

Code: [Select]
function Player::setMaxForwardSpeed(%this, %x) //%this = player object and %x = the speed you put in (my understanding)
{
if(!isObject(%this))
{
return;
}
%this.setMaxForwardSpeed(%x);
}

registerOutputEvent(Player, "setMaxForwardSpeed", "int 0 999 1");

There are no syntax errors, but when I activate a brick using this output event the console says this:

Player::setMaxForwardSpeed - wrong number of arguments.
usage: ( float speed )Sets run speed
Backtrace:



Help?

-----------------------------------------------------------------------------------------------------------------------------
Old Topic

Is there any way to reset/change a player object's attributes ingame without changing their datablock?
Example: Setting their forward speed to 10.

this would be useful considering I wouldn't have to create a new datablock every time I want the player
object to act differently.
« Last Edit: September 25, 2015, 10:51:46 PM by Radíowave »

It depends on what specifically you want to change

Speed can be changing individually using some new(ish) functions

Oh ok, I guess I was just entering it in wrong.

There is no reason to check if %this exists in this case, as in order to call this function, you should be using %this.setMaxForwardSpeed(%x) , so if %this didn't exist, it would throw an error there.

Although it is possible to call it using Player::setMaxForwardSpeed(%this, %x); (exploiting how torque functions work), but if anyone is doing that, they should check if its an object themselves.

registerOutputEvent(Player, "setMaxForwardSpeed", "int 0 999 1", false); should do the trick

remove all other code, you just need this line

You're trying to overwrite the function that sets their movement in the first place. You don't even need to make a function.

You should still try this in your code, and only this, remove everything else that modifies it.
registerOutputEvent(Player, "setMaxForwardSpeed", "int 0 999 1", false); should do the trick