Author Topic: A few questions  (Read 1087 times)

I know some people are going to call me a "noob", but my scripting ability is sort of at that point

In threads commands like:
%obj.playThread(2, shiftAway);

What does the 2 in it mean? I couldn't figure it out.


I know there's a setVelocity command; I've already used it. But is there some way to simply add velocity? I tried
%obj.addVelocity("# # #")
But it didn't work


In function headers like:
function tbhVehicle::onCollision(%this,%obj,%col,%a,%b,%c,%d,%e)
What do the variables %this.%obj,%col,%a etc. mean? (yes, I took that from the Tank script)

And is there some way to make the "vehicle:onTrigger" function shoot in the direction your moving? I tried Heed's B24 bomber for reference, but it went in the universal direction.


Thanks guys! But I still have a few more questions

It's the slot that thread is playing in.
If you play another thread in slot 2, shiftAway will stop, and then that one called will play instead.
Generally, you would stop a thread by using .playThread(2, root);

When you say slot, do you mean as in arm or a slot system that allows multiple threads to play at once?
« Last Edit: February 07, 2010, 10:11:27 PM by Narkro555 »

In threads commands like:
Code: [Select]
%obj.playThread(2, shiftAway);
What does the 2 in it mean? I couldn't figure it out.

It's the slot that thread is playing in.
If you play another thread in slot 2, shiftAway will stop, and then that one called will play instead.
Generally, you would stop a thread by using .playThread(2, root);

I know there's a setVelocity command; I've already used it. But is there some way to simply add velocity? I tried
Code: [Select]
%obj.addVelocity("# # #")But it didn't work

Because addVelocity is a function created specifically for the events system, You may have to add a client as a second arg.

In function headers like:
Code: [Select]
function tbhVehicle::onCollision(%this,%obj,%col,%a,%b,%c,%d,%e)What do the variables %this.%obj,%col,%a etc. mean? (yes, I took that from the Tank script)
%this, or the first argument of the function, is the object that the function was called on. In this case, the tbhVehicle.
%obj usualy references an object. In this case, I believe it means the vehicle that called the function, because %this in this case is used for the datablock.
%col usually references the target object in a collision function.

The rest are generally not important, but if you wish to really know what they are, experiment with echos.

The names of these arguments do not matter. I could rewrite the entire function to follow this:
function tbhVehicle::onCollision(%poop,%frog,%duck,%apple,%baby,%code,%dog,%elephant)
and still produce the same result.
The only thing that matters is the order and how you use it.



As for your last question, I'm not sure. I haven't worked on vehicles.

I know there's a setVelocity command; I've already used it. But is there some way to simply add velocity? I tried
Code: [Select]
%obj.addVelocity("# # #")But it didn't work
Code: [Select]
function ShapeBase::addVelocity(%this, %vel)
{
    %this.setVelocity(vectorAdd(%this.getVelocity(), %vel));
}
This should work, I'm not sure if you should package it. This will apply an addVelocity function to any "shape base", basically any shape in the game. It will not work on skies(lol) or terrains, as they are not ShapeBase's and are interiors, they can't have these functions applied, and I don't know why you would give them a velocity.
You input a velocity the same way you gave an example:
Code: [Select]
%obj.addVelocity("# # #");

Thanks! But I still have a few more questions



And I'll get the snacks.
If you can, pick me up a bag of Lay's Dill Pickle.


Slots are just points on the model(usually the modeler will define where a slot is)
Often, 0 is the driver seat.

When you say slot, do you mean as in arm or a slot system that allows multiple threads to play at once?
A slot system that allows multiple threads to play at once.

A slot system that allows multiple threads to play at once.
Thank you.

One more thing: what's the datablock for terrain? And the other stuff I asked about. I guess my general mod help topic wasn't in the right section

Thank you.

One more thing: what's the datablock for terrain? And the other stuff I asked about. I guess my general mod help topic wasn't in the right section
TerrainBlock

Terrains don't have datablocks.
Their classname is
TerrainBlock

I tried that, it didn't work. Here's my testing:
Code: [Select]
  function <name>Vehicle::onCollision(%this,%obj,%col,%a,%b,%c,%d,%e)
   {
      if(%col.dataBlock.className == "TerrainBlock")
      {
         %obj.setvelocity("0 0 1");
      }
      Parent::onCollision(%this,%obj,%col,%a,%b,%c,%d,%e);
   }

I'm going to do something fancier then setVelocity, that's just what I'm using to test

The problem is that you're doing .dataBlock
Terrains don't have datablocks.

You're also using ==.
That's for number comparison.

do it this way:

if(%col.getClassName() $= "TerrainBlock")