Weapon assigning problem
by William Goh (Joondalup IT TAFE) · in Torque 3D Professional · 10/14/2009 (4:46 am) · 5 replies
Weapons not switching when pressing 2 or using wheel
In scripts/clients/default.bind.cs I have one code of line:
moveMap.bindCmd(keyboard, "2", "commandToServer('use',\"M4A1Carbine\");", "");
which corresponds from the
moveMap.bindCmd(keyboard, "1", "commandToServer('use',\"RocketLauncher\");", "");
Scripts under the M4A1Carbine.cs file contains:
datablock ItemData(M4A1CarbineAmmo)
{
// Mission editor category
category = "Ammo";
// Add the Ammo namespace as a parent. The ammo namespace provides
// common ammo related functions and hooks into the inventory system.
className = "Ammo";
// Basic Item properties
shapeFile = "art/shapes/weapons/SwarmGun/rocket.dts";
mass = 2;
elasticity = 0.2;
friction = 0.6;
// Dynamic properties defined by the scripts
pickUpName = "Rockets";
maxInventory = 20;
};
// ----------------------------------------------------------------------------
// Weapon Item. This is the item that exists in the world,
// i.e. when it's been dropped, thrown or is acting as re-spawnable item.
// When the weapon is mounted onto a shape, the Image is used.
// ----------------------------------------------------------------------------
datablock ItemData(M4A1Carbine)
{
// Mission editor category
category = "Weapon";
// Hook into Item Weapon class hierarchy. The weapon namespace
// provides common weapon handling functions in addition to hooks
// into the inventory system.
className = "Weapon";
// Basic Item properties
shapefile = "art/shapes/weapons/M4A1 Carbine/M4A1 Carbine.DAE";
mass = 3;
elasticity = 0.2;
friction = 0.6;
emap = true;
// Dynamic properties defined by the scripts
pickUpName = "M4A1 Carbine";
description = "Rifle";
image = M4A1CarbineImage;
// weaponHUD
previewImage = 'swarmer.png';
reticle = 'reticle_rocketlauncher';
};
Why is it not switching?
In scripts/clients/default.bind.cs I have one code of line:
moveMap.bindCmd(keyboard, "2", "commandToServer('use',\"M4A1Carbine\");", "");
which corresponds from the
moveMap.bindCmd(keyboard, "1", "commandToServer('use',\"RocketLauncher\");", "");
Scripts under the M4A1Carbine.cs file contains:
datablock ItemData(M4A1CarbineAmmo)
{
// Mission editor category
category = "Ammo";
// Add the Ammo namespace as a parent. The ammo namespace provides
// common ammo related functions and hooks into the inventory system.
className = "Ammo";
// Basic Item properties
shapeFile = "art/shapes/weapons/SwarmGun/rocket.dts";
mass = 2;
elasticity = 0.2;
friction = 0.6;
// Dynamic properties defined by the scripts
pickUpName = "Rockets";
maxInventory = 20;
};
// ----------------------------------------------------------------------------
// Weapon Item. This is the item that exists in the world,
// i.e. when it's been dropped, thrown or is acting as re-spawnable item.
// When the weapon is mounted onto a shape, the Image is used.
// ----------------------------------------------------------------------------
datablock ItemData(M4A1Carbine)
{
// Mission editor category
category = "Weapon";
// Hook into Item Weapon class hierarchy. The weapon namespace
// provides common weapon handling functions in addition to hooks
// into the inventory system.
className = "Weapon";
// Basic Item properties
shapefile = "art/shapes/weapons/M4A1 Carbine/M4A1 Carbine.DAE";
mass = 3;
elasticity = 0.2;
friction = 0.6;
emap = true;
// Dynamic properties defined by the scripts
pickUpName = "M4A1 Carbine";
description = "Rifle";
image = M4A1CarbineImage;
// weaponHUD
previewImage = 'swarmer.png';
reticle = 'reticle_rocketlauncher';
};
Why is it not switching?
#2
10/14/2009 (12:01 pm)
Can you mount the weapons with the mountImage function?
#3
For weapon cycling to work with the wheel you'll need to look in "scripts/server/weapon.cs", and add your WeaponOrder() command in order to setup the array for cycling.
10/14/2009 (12:58 pm)
Everything above, and did you delete the prior existing config.cs file?For weapon cycling to work with the wheel you'll need to look in "scripts/server/weapon.cs", and add your WeaponOrder() command in order to setup the array for cycling.
#4
Sure !
@Aaron & William
Look in "game/art/datablocks/weapons" for the full weapon datablocks,
and "game/scripts/server/weapon.cs" for all the mount/use examples.
Hope it helps =D
10/14/2009 (11:39 pm)
@AaronSure !
@Aaron & William
Look in "game/art/datablocks/weapons" for the full weapon datablocks,
and "game/scripts/server/weapon.cs" for all the mount/use examples.
Hope it helps =D
#5
I can mount the weapon using the mountimage function on the console
@Dreamarvel
I havent added the weapons to the inventory as of yet
Where do you define the ShapeBaseImageData?
10/15/2009 (11:25 pm)
@Aaron HealI can mount the weapon using the mountimage function on the console
@Dreamarvel
I havent added the weapons to the inventory as of yet
Where do you define the ShapeBaseImageData?
Torque 3D Owner Dreamarvel
1)Did you exec the file ?
2)Did you add any of the objects to your inventory ?
3)Did you define the ShapeBaseImageData ? ("use" uses mountImage iirc)
4)Any errors in the console ?