Blockland Forums > Modification Help

Homing Player With Sword Weapon

Pages: << < (3/7) > >>

Uxie:

Anyways, this is a video of the gameplay of the energy sword. I have the hitting part down. But the right click OnTrigger is what I'm stuck on.

http://www.youtube.com/watch?v=BjwzVFXBuWg

The first strike is not what I am doing.
The second strike is more of a thrust. Basicly what I am talking about.


I'm new to coding, so would this work?

--- Code: ---function armor::onTrigger(%this, %obj, %triggerNum, %val)
{
     %obj.containerRadiusSearch();
}
else
{
     %obj.setVelocity("5 0 2");
}
--- End code ---


MegaScientifical:


--- Quote from: Uxie on January 09, 2011, 10:21:32 AM ---Anyways, this is a video of the gameplay of the energy sword. I have the hitting part down. But the right click OnTrigger is what I'm stuck on.

--- End quote ---

Ah, it all makes sense now. Sorry.

Uxie:

Nope, my code was a Syntax Error.


--- Code: ---function armor::onTrigger(%this, %obj, %triggerNum, %val)
{
     %obj.containerRadiusSearch();
}
else
##
##{
     %obj.setVelocity("5 0 2");
}
--- End code ---


MegaScientifical:


--- Quote from: Uxie on January 09, 2011, 10:39:53 AM ---Nope, my code was a Syntax Error.


--- Code: ---function armor::onTrigger(%this, %obj, %triggerNum, %val)
{
     %obj.containerRadiusSearch();
}
else
##
##{
     %obj.setVelocity("5 0 2");
}
--- End code ---

--- End quote ---

Why do you have a floating "else" check when there's no "if?" In fact, since it's a command floating in the file, it'd just try to do setVelocity on a non-existent %obj whenever you load the script.

Uxie:


--- Code: ---function armor::onTrigger(%this, %obj, %triggerNum, %val)
{
     %obj.containerRadiusSearch();
     %obj.addVelocity("-5 0 2");
}
--- End code ---

This?

Pages: << < (3/7) > >>

Go to full version