Author Topic: Looping a Schedule/ Obtaining Health of a Vehicle [Fixed]  (Read 1203 times)

It executed, but the console says
unknown command getMountedObject [Edit: I can use %driver = %vehicle.getMountNodeObject(0)]
and
unknown command getDamagePercent
 :panda:

On a side note, I took out my bottom print and replaced my onMount code with your right aligned idea with all the spiffy colors. It looks nice!

Also, must the code be packaged? I tried it packaged and unpackaged, the console took them both but didn't know the functions. I can work my way not using getDamagePercent- just the way I did my first post, using HP.
« Last Edit: October 11, 2010, 09:25:30 PM by KuriousGeorge »

It executed, but the console says
unknown command getMountedObject
and
unknown command getDamagePercent
 :panda:
I'm not sure what to do about this. I'm tired and I have barely any experience around vehicles, mostly because I don't like how they work in Blockland.

Also, must the code be packaged? I tried it packaged and unpackaged, the console took them both but didn't know the functions. I can work my way not using getDamagePercent- just the way I did my first post, using HP.
They gotta be packaged.

Well thanks for your help Chrono you still make beast add-ons.

I'm using

%driver = %vehicle.getMountNodeObject(0);

but it still won't work... And the console says still that getMountedObject isn't a command when I don't have it in my code (Yes I re executed. ) It says it's in line 0 too?

My current code is


Code: [Select]
package NewPackage
{
function wheeledVehicle::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)
{
Parent::damage(%this, %obj, %sourceObject, %position, %damage, %damageType);
        %driver = %obj.getMountNodeObject(0);
centerPrint(%driver.client,"<just:right><color:ffffff>You got hit" ,3);
}
};

activatePackage(NewPackage);

« Last Edit: October 11, 2010, 09:43:33 PM by KuriousGeorge »

I just exited and opened Block Land and all was good with the ghost commands.
Still though, I need a way to get the driver of the vehicle.

I've tried
%Driver = %obj.getControllingObject();
%Driver = %obj.getMountNodeObject(0);

Both don't work. The console says unknown command. I think the problem may be something else.
« Last Edit: October 11, 2010, 09:56:37 PM by KuriousGeorge »

Try

%driver = %this.getControllingObject();
or
%driver = %this.getMountNodeObject(0);

Try creating a vehicle in blockland, find it's id in the editor, and use <id>.dump();

Also, the function you seek is getMountedObject(0);

Edit: The two from Xalos would also work.

You need to be using WheeledVehicleData::damage, not WheeledVehicle::damage

Let's all give three hoorays for Chrono who found that answer to the problem! I appreciate all of you people helping.

This script definitely helped me learn how to script better, as I am merely a beginner.
Also, add in a GUI and this could be a useful add-on. Of course, GUI's are very difficult and a whole new thing.

Well, this problem is officially solved and very useful for my server. Thank you everybody! :cookieMonster: