Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: Boomer on June 26, 2005, 11:42:29 pm

Title: Irritating artillery
Post by: Boomer on June 26, 2005, 11:42:29 pm
I've been trying to make an "artillery" weapon for freespace and I've got it to work, but then I came to the end to test the final product, and the bloody ships won't fire it!  I'll post the code here, it's just infuriating....

$Name:          Tunneler
$Model File:        piranha.pof
$Mass:          1.0
$Velocity:      40.0
$Fire Wait:     8.0
$Damage:        200         ;; damage applied when within inner radius
$Blast Force:       3000.0
$Inner Radius:      50.0         ;; radius at which damage is full (0 for impact only)
$Outer Radius:      150.0         ;; max radius for attenuated damage
$Shockwave Speed:   40           ;; velocity of shockwave.  0 for none.
$Armor Factor:      4.0
$Shield Factor:     0.01
$Subsystem Factor:  25.0
$Lifetime:      40.0
$Energy Consumed:   0.0       ;; Energy used when fired
$Cargo Size:        1.0       ;; Amount of space taken up in weapon cargo
$Homing:          YES
 ;; the following indented fields are only required when $Homing is YES
 +Type:        ASPECT        ;; Legal: HEAT, ASPECT
 +Turn Time:   1.5
 +Min Lock Time: 2.0       ;; Minimum lock time (in seconds)
 +Lock Pixels/Sec: 70          ;; Pixels moved per sec while locking
 +Catch-up Pixels/Sec:100        ;; Pixels moved per sec while catching up
 +Catch-up Penalty:      30        ;; Extra pixels to move after catching up
$LaunchSnd:     96          ;; The sound it makes when fired
$ImpactSnd:     88          ;; The sound it makes when it hits something
$FlyBySnd:      -1
$Rearm Rate:        0.02       ;; number of missiles/sec that are rearmed
$Flags:         ("Bomb" "Big Ship" "Huge" "Spawn Artillery Baby, 150" "Remote Detonate" "local ssm" )
$Trail:            ;; Trail cannot be set if Exhaust is set
 +Start Width:      0.5         ;; Width of trail nearest missile
 +End Width:      1.75        ;; Width of trail before it "evaporates"
 +Start Alpha:  1.0
 +End Alpha:  0.0
 +Max Life:        1.5         ;; how many seconds before trail disappears
 +Bitmap:      MissileTrail04      ;; Bitmap used to draw trail
$Icon:          iconmissile04
$Anim:          LoadMissile04
$Impact Explosion:      none
$Local SSM:
 +Warpout Delay:    2500
 +Warpin Delay:     6000
 +Stage 5 Velocity: 500
 +Warpin Radius:    1000
 +Lock Range:       15000

If I take out the Spawn flag it works, but the spawn flag is necessary to the character of the weapon.  Any suggestions?  It's driving me crazy!
:shaking: :hopping: :mad2:
Title: Irritating artillery
Post by: FireCrack on June 26, 2005, 11:50:09 pm
"Spawn arltillery bayby, 150"

Is that right, or should there be a comma after spawn?
Title: Irritating artillery
Post by: phreak on June 27, 2005, 12:30:08 am
spawn will only work on turrets if there are at least 2 fighters within 1500 meters of the turret
Title: Irritating artillery
Post by: Boomer on June 27, 2005, 10:34:21 am
Oh, great, so it's a coding issue?
Wonderful....:deadpan:
back to the drawing boards...
Title: Irritating artillery
Post by: phreak on June 27, 2005, 11:56:04 am
it was put in place since the only spawn weapons on capitals are piranhas and synaptics,  its just an easy out so they don't need to gain a target lock on something in order to launch them.
Title: Irritating artillery
Post by: FireCrack on June 27, 2005, 01:54:34 pm
Should realy have another flag for that, like

$DontDoFighterProxCheck


osr somthing...
Title: Irritating artillery
Post by: Solatar on June 27, 2005, 02:02:49 pm
What kind of artillery effect are you going for?
Title: Irritating artillery
Post by: StratComm on June 27, 2005, 02:35:25 pm
Quote
Originally posted by FireCrack
Should realy have another flag for that, like

$DontDoFighterProxCheck


osr somthing...


If I'm understanding Phreak correctly, what he's trying to say is that right now, the swarm tag on capship turrets bypasses the normal AI all together, instead relying on a primitive "are targets in range" check.  What you'd actually need is an overhaul of a chunk of AI behavior, which is a slightly more complicated request than a bug as such.
Title: Irritating artillery
Post by: phreak on June 27, 2005, 04:32:23 pm
actually i think its a 1 line fix.  i'll see if G5k will let me add this in before 3.6.7
Title: Irritating artillery
Post by: phreak on June 27, 2005, 05:24:33 pm
here's the offending code

Code: [Select]

//If this is a spawning type weapon, shoot it!
if ( wip->wi_flags & WIF_SPAWN )
{
if (( num_ships_nearby >= 3 ) || ((num_ships_nearby >= 2) && (frand() < 0.1f))) {
turret_fire_weapon(i, ss, parent_objnum, &gpos, &ss->turret_last_fire_direction);
} else {
ss->turret_next_fire_stamp = timestamp(1000); // Regardless of firing rate, don't check whether should fire for awhile.
}

//we're done with this weapon mount
continue;
}


after modifications, this should work fine

Code: [Select]

//If this is a spawning type weapon, shoot it as long as they're told otherwise.
if (( wip->wi_flags & WIF_SPAWN ) && (!wip->wi_flags2 & WIF_NO_AUTOSHOOT))
{
if (( num_ships_nearby >= 3 ) || ((num_ships_nearby >= 2) && (frand() < 0.1f))) {
turret_fire_weapon(i, ss, parent_objnum, &gpos, &ss->turret_last_fire_direction);
} else {
ss->turret_next_fire_stamp = timestamp(1000); // Regardless of firing rate, don't check whether should fire for awhile.
}

//we're done with this weapon mount
continue;
}
Title: Irritating artillery
Post by: Flipside on June 27, 2005, 06:42:10 pm
Hmmmm... Capital Ships always have infinite missiles iirc?

I wonder if that could be altered to account for, for example, torpedos a'la StarLancer? A modified Fenris carrying, say,  4 Meson torpedoes would actually become an item of concern for a Ravana, for example? Or would it be better to use sexp's for that sort of thing?
Title: Irritating artillery
Post by: Singh on June 27, 2005, 11:31:50 pm
the Turret-lock and fire-turret sexps are your friends :)
Title: Irritating artillery
Post by: NGTM-1R on June 28, 2005, 01:03:16 am
The problem is that you can't specify the turret to fire a number of times before it turret-locks, so it will not, and cannot, be an exact science. And folks will notice that.
Title: Irritating artillery
Post by: Trivial Psychic on June 28, 2005, 01:04:05 am
Yes, except that there is no fire-turret sexp.  There's the old fire-beam, but no fire-turret... yet, we hope.
Title: Irritating artillery
Post by: Black Wolf on June 28, 2005, 01:58:41 am
Quote
Originally posted by ngtm1r
The problem is that you can't specify the turret to fire a number of times before it turret-locks, so it will not, and cannot, be an exact science. And folks will notice that.


But if you control when the turret fires (through the suggested "turret-fire" sexp) it'd work out fine.
Title: Irritating artillery
Post by: karajorma on June 28, 2005, 04:49:29 am
Pretty much what I would have suggested BW. This is something that it would be nice to have specified in the table or in FRED but which could be implemented using events fairly easily anyway.
Title: Irritating artillery
Post by: DarthWang on June 29, 2005, 02:32:08 am
Solution: Create an invisible model with no collision detection and label it as a fighter. Give it no weapons or anything, make it invulnerable, and put about 20 of them in the mission on the enemy side, ordering them to attack your ship. They won't do any damage to it, and no one will notice them, but their proximity will allow your weapons to fire.
Title: Irritating artillery
Post by: Boomer on June 29, 2005, 08:38:31 am
Thanks guys.  I tried DW's way and I've gotten the best results:devil:

If you're lucky, once I get the bugs worked out, I'll release it to the public, see if you guys can't have some fun with it!
Title: Irritating artillery
Post by: Goober5000 on June 29, 2005, 11:49:01 am
Fire-turret should be put on the fast track after 3.6.7, methinks. :)
Title: Irritating artillery
Post by: phreak on June 29, 2005, 04:56:22 pm
you know goob, i was also thinking of adding the "no autofire" flag too :)
Title: Irritating artillery
Post by: Goober5000 on June 29, 2005, 05:21:42 pm
What's that flag supposed to do?
Title: Irritating artillery
Post by: aldo_14 on June 29, 2005, 05:39:58 pm
Stop turrets firing unless explicitly told to with a fire-turret SEXP?
Title: Irritating artillery
Post by: karajorma on June 29, 2005, 06:01:26 pm
You could just lock the turret for that.
Title: Irritating artillery
Post by: phreak on June 29, 2005, 06:41:08 pm
Quote
Originally posted by Goober5000
What's that flag supposed to do?


workaround for this:

Quote

spawn will only work on turrets if there are at least 2 fighters within 1500 meters of the turret
Title: Irritating artillery
Post by: DarthWang on June 30, 2005, 05:44:22 am
Quote
Originally posted by Boomer
Thanks guys.  I tried DW's way and I've gotten the best results:devil:

 


WTF!? I was expecting a reply more along the lines of "YOU IDIOT! THAT IS THE STUPIDEST, MOST RIDICULOUS, LUDICROUS, UNNECESSARY IDEA I HAVE EVER HEARD IN MY ENTIRE LIFE!!!!!"


Heh, weird.
Title: Irritating artillery
Post by: karajorma on June 30, 2005, 06:30:39 am
It appears as if I have competion in the weird FRED hack department :)