Blockland Forums > Modification Help
Syntax Error in Script
Headcrab Zombie:
Then add something after the if, and then post that part of the script. I was just saying what it looks like from the console file.
What are you trying to do, anyways?
Audax:
There is something after 'if' though:
--- Code: ---if(%zVec <= -20)
--- End code ---
What I am trying to do is the script will check your velocity while you are falling. Once it reaches -20 or less on the Z-Axis (descending) the player will tumble as if crashing on the skis.
Headcrab Zombie:
--- Quote from: Audax on June 12, 2010, 02:20:02 PM ---There is something after 'if' though:
--- End quote ---
--- Quote ---package TumbleOnFall
{
function Player::getVelocity(%this,%obj,%col,%pos,%speed)
{
%zVec = getWord(%obj.getVelocity(),2);
if(%zVec <= -20)
there's nothing here that will execute if the above if is true
}
}
--- End quote ---
What I'd do is make a repeating function, first called when the server is started, that checks through everyone's velocity, and calls tumble if the velocity is high enough. You don't need to change anything in the tumble or getVelocity functions, just one looping function, and package one of the functions that is called when the server starts.
Audax:
--- Quote from: Script ---package TumbleOnFall
{
function Player::getVelocity(%this,%obj,%col,%pos,%speed)
{
%zVec = getWord(%obj.getVelocity(),2);
if(%zVec <= -20)
}
}
--- End quote ---
The blank line was created in the console log, no idea why.
I'll try the looping function.
Wait, wouldn't it be better though to check the player's velocity while they are falling, instead of continuously checking?
Headcrab Zombie:
As I said in your other topic, I don't believe there is an onFall function, so you'll have to continously check, unless someone can think of another way.
And you don't get what I mean about the if statement, look at the script that was posted on the first post, there is nothing on the line after the if that will be executed if the if evaluates to true.