Hard Light Productions Forums
Modding, Mission Design, and Coding => The Modding Workshop => Topic started 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:
-
"Spawn arltillery bayby, 150"
Is that right, or should there be a comma after spawn?
-
spawn will only work on turrets if there are at least 2 fighters within 1500 meters of the turret
-
Oh, great, so it's a coding issue?
Wonderful....:deadpan:
back to the drawing boards...
-
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.
-
Should realy have another flag for that, like
$DontDoFighterProxCheck
osr somthing...
-
What kind of artillery effect are you going for?
-
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.
-
actually i think its a 1 line fix. i'll see if G5k will let me add this in before 3.6.7
-
here's the offending code
//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
//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;
}
-
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?
-
the Turret-lock and fire-turret sexps are your friends :)
-
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.
-
Yes, except that there is no fire-turret sexp. There's the old fire-beam, but no fire-turret... yet, we hope.
-
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.
-
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.
-
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.
-
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!
-
Fire-turret should be put on the fast track after 3.6.7, methinks. :)
-
you know goob, i was also thinking of adding the "no autofire" flag too :)
-
What's that flag supposed to do?
-
Stop turrets firing unless explicitly told to with a fire-turret SEXP?
-
You could just lock the turret for that.
-
Originally posted by Goober5000
What's that flag supposed to do?
workaround for this:
spawn will only work on turrets if there are at least 2 fighters within 1500 meters of the turret
-
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.
-
It appears as if I have competion in the weird FRED hack department :)