Tech questions
by Aaron Scott Kingston · in Torque 3D Public · 11/10/2009 (8:58 pm) · 3 replies
A few questions here:
If these can be accomplished with only torquescript then that'd be great.
Here's what I have for the attachments so far (I don't think the 1.0 demo has attachToObject as far as I know):
just a reminder: I'm helping out someone who does have the full license but I only have the demo so I cannot hard code anything.
- How to mount emitter & light to an object? Think of this as a torch prefab (either as a generic light source or an inventory object).
- How to add weapons/inventory to the player? I copied most of the weapons from the demo's examples. All of the weapons work with the Universal AI Starter pack NPCs so equipping them was easy. The player cannot change weapons yet. I'd post the script but I don't know where I'd equip the player and I don't think the dev for UAI Starter pack would appreciate showing his scripts . . .
- Right click to interact with objects (doors, movable objects, light switches, etc.). This might need another thread.
If these can be accomplished with only torquescript then that'd be great.
Here's what I have for the attachments so far (I don't think the 1.0 demo has attachToObject as far as I know):
// ----------------------------------------------------------------------------
// Lights for the torches
// ----------------------------------------------------------------------------
datablock LightDescription(TorchLightDesc)
{
range = 4.0;
color = "1 1 0";
brightness = 5.0;
animationType = PulseLightAnim;
animationPeriod = 0.25;
//flareType = SimpleLightFlare0;
};
// Torch Fire
datablock ParticleData(TorchFire1)
{
textureName = "art/shapes/particles/smoke";
dragCoefficient = 0.0;
gravityCoefficient = -0.3; // rises slowly
inheritedVelFactor = 0.00;
lifetimeMS = 500;
lifetimeVarianceMS = 250;
useInvAlpha = false;
spinRandomMin = -30.0;
spinRandomMax = 30.0;
spinSpeed = 1;
colors[0] = "0.6 0.6 0.0 0.1";
colors[1] = "0.8 0.6 0.0 0.1";
colors[2] = "0.0 0.0 0.0 0.1";
sizes[0] = 0.5;
sizes[1] = 0.5;
sizes[2] = 2.4;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleData(TorchFire2)
{
textureName = "art/shapes/particles/smoke";
dragCoefficient = 0.0;
gravityCoefficient = -0.5; // rises slowly
inheritedVelFactor = 0.00;
lifetimeMS = 800;
lifetimeVarianceMS = 150;
useInvAlpha = false;
spinRandomMin = -30.0;
spinRandomMax = 30.0;
spinSpeed = 1;
colors[0] = "0.8 0.6 0.0 0.1";
colors[1] = "0.6 0.6 0.0 0.1";
colors[2] = "0.0 0.0 0.0 0.1";
sizes[0] = 0.3;
sizes[1] = 0.3;
sizes[2] = 0.3;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(TorchFireEmitter)
{
ejectionPeriodMS = 15;
periodVarianceMS = 5;
ejectionVelocity = 0.25;
velocityVariance = 0.10;
thetaMin = 0.0;
thetaMax = 45.0;
particles = "TorchFire1" TAB "TorchFire2";
mountPoint = 1;
};
datablock ParticleEmitterNodeData(TorchFireEmitterNode)
{
timeMultiple = 1;
};
datablock LightAnimData( FlickerLightAnim )
{
flicker = true;
chanceTurnOn = 0.1;
chanceTurnOff = 0.15;
mountPoint = 2;
};
datablock StaticShapeData(TorchSimple1){
category = "Lights";
//Points to the DTS object change this for your project
shapeFile = "art/shapes/lights/torches/TorchSimple1.DAE";
position = "0 0 0";
Scale="1 1 1";
emap = 1;
receiveSunLight = "1";
};
FlickerLightAnim.attachToObject( TorchSimple1 );
TorchFireEmitter.attachToObject( TorchSimple1 );I also tried hasLight in the datablock too but that didn't work.just a reminder: I'm helping out someone who does have the full license but I only have the demo so I cannot hard code anything.
About the author
https://sites.google.com/site/ascottk/home http://www.myspace.com/ascottk http://www.soundclick.com/scottkingston
#2
and
this is all pseudo code, but you should get the idea,
I use slightly different meathods, and I use both images and/or objects, depending on the need
11/12/2009 (4:51 am)
instead ofFlickerLightAnim.attachToObject( TorchSimple1 ); TorchFireEmitter.attachToObject( TorchSimple1 );try
FlickerLightAnim.mountObject( TorchSimple1 ); TorchFireEmitter.mountObject( TorchSimple1 );best in the objects "onAdd"
and
datablock ShapeBaseImageData(TorchSimple1)
{
// Basic Item properties
shapeFile = "art/shapes/WHERE/EVER/WHATEVER.dts";
emap = true;
mountPoint = 0;// OR WHEREVER
offset = "-0.01 2.25 0.1";// right/left, forward/backward, up/down
lightType = SpotLight; // OR WHATEVER TYPE YOU WANT
lightColor = "1.0 1.0 1.0";
//lightDuration = 800;
lightRadius = 200;
};this is all pseudo code, but you should get the idea,
I use slightly different meathods, and I use both images and/or objects, depending on the need
#3
11/12/2009 (6:48 pm)
This is was I get with mountObjectart/datablocks/lights/TorchSimple1.cs (122): Unknown command mountObject. Object TorchFireTestEmitter(67) TorchFireTestEmitter -> ParticleEmitterData -> GameBaseData -> SimDataBlock -> SimObject art/datablocks/lights/TorchSimple1.cs (123): Unknown command mountObject. Object TorchLightTestDesc(64) TorchLightTestDesc -> LightDescription -> SimDataBlock -> SimObject
Torque Owner Aaron Scott Kingston
First you need the weapons of course. Then you need to alter the scripts/server/weapon.cs & scripts/server/gameCore.cs so it looks like this:
weapon.cs
gameCore.cs
function GameCore::loadOut(%game, %player) { //echo (%game @"\c4 -> "@ %game.class @" -> GameCore::loadOut"); %player.setInventory(RocketLauncher, 1); %player.setInventory(RocketLauncherAmmo, %player.maxInventory(RocketLauncherAmmo)); %player.setInventory(GrenadeLauncher, 1); %player.setInventory(GrenadeLauncherAmmo, %player.maxInventory(GrenadeLauncherAmmo)); %player.setInventory(GravityGun, 1); %player.setInventory(GravityGunAmmo, %player.maxInventory(GravityGunAmmo)); %player.setInventory(Pistol, 1); %player.setInventory(PistolAmmo, %player.maxInventory(PistolAmmo)); %player.setInventory(Rifle, 1); %player.setInventory(RifleAmmo, %player.maxInventory(RifleAmmo)); %player.setInventory(Crossbow, 1); %player.setInventory(CrossbowAmmo, %player.maxInventory(CrossbowAmmo)); //%player.mountImage(RocketLauncherImage, 0); %player.mountImage(CrossbowImage, 0); }