Author Topic: All of my problems on one thread. (renewed)  (Read 3032 times)

Problems:


1: how do you make multiple animations on one model? I tried and all of my animated meshes followed one bone. (using blender)

2: I am having problems getting a variable to effect changes in the state system. Is this even possible? Is there a boolean comand (if true / false) for the state system?

3: What is the [if then / else] syntax for torque? examples?

4: Is it possible to manipulate things like the muzzle velocity var within the state system to have a weapon that changes (pressure/speed and grav of bullet) in response to a variable or a state.

5: Is it possible to have a weapon use several different types of bullets that are predefined? How would one add another projectile, and have a separate firing command?

6: is it possible to make a clear modle, like a ballon that is slightly see through? would your texture have to be clear, or would my modle have to be coded? (using blender)

7: Is it possible to have more than 0 - 9 states in the state system?


Lots of these are just questions about torque which I expect never to be answered, but the syntax ones are easy and simple to answer if common knowlege. I am stalled waiting for answeres, so any of these answered would help. If you dont know, dont post please. The last topic got so cluttered that it dropped like a rock.
anyways, if anyone can help, it would be appreciated.
« Last Edit: September 07, 2010, 08:32:01 AM by Dy mar »


3: What is the [if then / else] syntax for torque? examples?
Code: [Select]
if(%var == %value)
{
   //do stuff
}
else if(%var > %value)
{
   //do other stuff
}
else
{
   //do other other stuff
}
There are the three examples in one piece. To see all of the different operators, check out the file posted in this topic: http://forum.blockland.us/index.php?topic=20754.0. That file contains much of the basic Torque syntax and functions.
If you are only calling one function with an if statement, you don't need brackets after it. Ex:
Code: [Select]
if(%var == %val)
   return;
The else and else if works the same way:
Code: [Select]
if(%var == %val)
   return;
else
   //do something

4: Is it possible to manipulate things like the muzzle velocity var within the state system to have a weapon that changes (pressure/speed and grav of bullet) in response to a variable or a state.
I've never worked much with states, so I'm not sure how that works exactly. I do know that you can overwrite the fire function and create your own projectile(s). Ephialtes executed this well in his shotgun.
Here is the code:
Code: [Select]
function shotgunImage::onFire(%this,%obj,%slot)
{
if((%obj.lastFireTime+%this.minShotTime) > getSimTime())
return;
%obj.lastFireTime = getSimTime();
     
%obj.setVelocity(VectorAdd(%obj.getVelocity(),VectorScale(%obj.client.player.getEyeVector(),"-3")));
%obj.playThread(2, shiftAway);

%projectile = %this.projectile;
%spread = 0.0015;
%shellcount = 3;

for(%shell=0; %shell<%shellcount; %shell++)
{
%vector = %obj.getMuzzleVector(%slot);
%objectVelocity = %obj.getVelocity();
%vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
%vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
%velocity = VectorAdd(%vector1,%vector2);
%x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%velocity = MatrixMulVector(%mat, %velocity);

%p = new (BowImage.projectileType)()
{
dataBlock = %projectile;
initialVelocity = %velocity;
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
MissionCleanup.add(%p);
}
return %p;
}

5: Is it possible to have a weapon use several different types of bullets that are predefined? How would one add another projectile, and have a separate firing command?
A) Yes, using code such as the one posted above.
B) You would need to make your own modification to the fire method.
C) I'm assuming you mean something like the spacebar as a separate firing command. You would need to overwrite the method Armor::onTrigger(%this,%obj,%slot,%val) and check what they're triggering by checking the %slot argument. I believe if %slot returns 2 it is the spacebar that was pressed, and 4 is right click. %val is whether the pressed the key down or released it (1 if pressed, 0 if released).

I hope that helps!


thanks a ton! ill be tearing apart that shotgun code when i have time. meanwhile, SOLVATION


6: is it possible to make a clear modle, like a ballon that is slightly see through? would your texture have to be clear, or would my modle have to be coded? (using blender)
I do believe that the four values for the color of an object in Blender are: Red (R), Green (G), Blue (B), and Opacity (A for Alpha). I am not sure if this carries over to Blockland, but in Blender it is very easy.
I checked in Blender, and found it, and then I discovered that they have a tutorial on just that.
Here it is!

blender colors dont carry over into BL whatsoever. -.-
rethink and repost ->

While exporting, go to materials and select semi-transparent.

"7: Is it possible to have more than 0 - 9 states in the state system?"
If its what I think it is, then yes.


ty amade, but can you make it completely transparent, or have a texture that has dots on it that are visable but the rest is transparent?

"7: Is it possible to have more than 0 - 9 states in the state system?"
If its what I think it is, then yes.



it says that my 10th one is nonexistant :C



i still need help... plus, that clear thing->
id wouldnt let me select those buttons in the export GUI. there were no materials to select and add atributes to, so i couldn't make it clear.