Weapon direction

Weapon direction

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
fc14159
Posts: 153
Joined: 06 Jul 2007, 17:27

Weapon direction

Post by fc14159 »

Is it possible to make a weapon's default direction not forward?

If there is, does it have anything to do with weaponmaindir?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Weapon direction

Post by smoth »

Image

[11:35:42 AM] <smoth> WeaponMainDir1=0 0 -1;
[11:35:54 AM] <smoth> that will set it's fire arc behind it
[11:36:00 AM] <smoth> MaxAngleDif1=210;
[11:36:14 AM] <smoth> will limit it to firing 210 in that rear arc
[11:36:30 AM] <smoth> you have to also use max angle to limit the rear arc

WeaponMainDir1=0 0 -1;
MaxAngleDif1=180;
says behind it in a 180 degree arc, as though the unit has been cut in half and can only fire along the rear half.
User avatar
fc14159
Posts: 153
Joined: 06 Jul 2007, 17:27

Re: Weapon direction

Post by fc14159 »

[UNITINFO]
{
//************************************************************
// Unit Description
//********************
side=HLA;
name=Buster;
description=- Tech level 1 mortar vehicle;

//************************************************************
// Categories
//**************
category=HLA LAND MOBILE WEAPON;
tedclass=TANK;

//************************************************************
// External Specs
//******************
unitname=hla_buster;
unitnumber=66;
objectname=hla_buster.s3o;
corpse=hla_buster_dead;
buildpic=hla_buster.DDS;
soundcategory=ARM_TANK;

//************************************************************
// Health/Cost/Size
//********************
maxdamage=400;
healtime=10;
buildcostmetal=150;
buildcostenergy=1500;
buildtime=1500;
footprintx=2;
footprintz=2;

//************************************************************
// Resources
//*************
metalstorage=0;
energymake=0.6;
energyuse=0.6;
energystorage=0;

//************************************************************
// Building
//************

//************************************************************
// Constructor
//***************
builder=0;
workertime=0;

//************************************************************
// Abilities
//*************
canattack=1;
canguard=1;
canmove=1;
canpatrol=1;
canstop=1;

//************************************************************
// Movement
//************
movementclass=TANKSH2;
turnrate=450;
acceleration=0.1;
brakerate=0.2;
maxvelocity=1.5;
maxslope=10;
maxwaterdepth=10;

//************************************************************
// Sight/Radar/Sonar
//*********************
sightdistance=600;
radardistance=0;

//************************************************************
// Weapons
//***********
weapon1=HLA_BUSTER;
onlytargetcategory1=LAND;
explodeas=SMALL_UNITEX;
selfdestructas=SMALL_UNIT;
WeaponMainDir1=0 0 -1;
MaxAngleDif1=210;

//************************************************************
// Orders
//**********
noautofire=0;
firestandorders=1;
mobilestandorders=1;
standingfireorder=2;
standingmoveorder=1;
defaultmissiontype=Standby;

//************************************************************
// Miscellaneous
//*****************
bmcode=1;
designation=ARM-FA5;
downloadable=1;
leavetracks=1;
maneuverleashlength=640;
shootme=1;
steeringmode=1;
threed=1;
trackoffset=2;
trackstrength=4;
trackstretch=1;
tracktype=StdTank;
trackwidth=22;
version=1.2;
zbuffer=1;
hightrajectory=2;
}
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Weapon direction

Post by KDR_11k »

fc14159 wrote:Is it possible to make a weapon's default direction not forward?

If there is, does it have anything to do with weaponmaindir?
Has nothing to do with it. The "forward" direction of a turret is the end your script turns towards the target, Spring doesn't care which one that is. Just offset the direction appropriately.
User avatar
fc14159
Posts: 153
Joined: 06 Jul 2007, 17:27

Re: Weapon direction

Post by fc14159 »

screenie of model:

Image
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Weapon direction

Post by Argh »

Oh, you just want it to start in that upwards direction?

Nothing could be easier.

In your model, make the gun face forwards. Pre-posing models is not generally a good idea- it usually just makes your work more frustrating later.

Then, in your COB script, just have your weapon's aimer / barrel / whatever turn to whatever you want, during Create(), then turn it back to that every time that RestoreAfterDelay calls.

So, just write something like "turn aimer to x-axis <-20> speed <50>;" in your script. See the ArtilleryCannon's script in P.U.R.E., I always reset the cannon back to that angle after awhile, because it looks cooler, imo.

Everything else about the gun's angle is also negotiable. If you have a fake point that is rotated to actually fire the gun, you could even make it fire at an angle that has nothing to do with the real angle of the gun's barrel.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Weapon direction

Post by KDR_11k »

Argh, why a fake point?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Weapon direction

Post by Argh »

So that you're not messing about with your model's real points, if you want AimFromWeapon to return within tolerance correctly, etc.

You certainly don't have to do that, it's just a trick I use for a lot of things, to keep stuff simple- for example, on an aircraft where I want the gunflares to go straight ahead, but I really want the gun to fire in the aiming cone specified, I just use a fake point for the gun...
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Weapon direction

Post by KDR_11k »

Er, why? If you don't visibly turn anything why bother with a separate piece? You realize Spring doesn't care what you do with your pieces in your aiming animation, right?
Post Reply

Return to “Game Development”