Blockland Forums > Modification Help

All of my problems on one thread. (renewed)

Pages: (1/8) > >>

Dy mar:

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.

Light And Day:

1 Happens to me to

lilboarder32:


--- Quote from: Dy mar on March 17, 2010, 10:07:21 PM ---3: What is the [if then / else] syntax for torque? examples?

--- End quote ---

--- Code: ---if(%var == %value)
{
   //do stuff
}
else if(%var > %value)
{
   //do other stuff
}
else
{
   //do other other stuff
}

--- End code ---
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: ---if(%var == %val)
   return;

--- End code ---
The else and else if works the same way:

--- Code: ---if(%var == %val)
   return;
else
   //do something
--- End code ---


--- Quote from: Dy mar on March 17, 2010, 10:07:21 PM ---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.

--- End quote ---
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: ---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;
}
--- End code ---


--- Quote from: Dy mar on March 17, 2010, 10:07:21 PM ---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?

--- End quote ---
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!

Light And Day:

That it did

Dy mar:

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

Pages: (1/8) > >>

Go to full version