Weapon Projectile Question

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Mayhem666
Posts: 501
Joined: Sun Feb 26, 2012 6:17 pm
Location: Canada,Qc

Weapon Projectile Question

Post by Mayhem666 »

I'm currently Making a New DECORATE Weapon and y've got this problem...

I want my Weapon to shoot 3 Missile In same Time, But All that i can do is to make him shoot 1 per 1 in one shoot. I want them to be shoot the three one in same time.

What i need to edit to dot that??
User avatar
Mayhem666
Posts: 501
Joined: Sun Feb 26, 2012 6:17 pm
Location: Canada,Qc

Re: Weapon Projectile Question

Post by Mayhem666 »

I state like

STPO FGH 1 bright A_FireCustomMissile("SuperPlasmaBall", 1.5)
STPO FGH 1 bright A_FireCustomMissile("SuperPlasmaBall")
STPO FGH 1 bright A_FireCustomMissile("SuperPlasmaBall", -1.5)

And it shoot them One After One, If anyone understand what i mean, I want them to be Shoot simultaneously With The Stated Fire Rate I want.

Any Help would be great.
User avatar
ChronoSeth
Posts: 1631
Joined: Mon Jul 05, 2010 2:04 pm
Location: British Columbia

Re: Weapon Projectile Question

Post by ChronoSeth »

Code: Select all

STPO F 0 bright A_FireCustomMissile("SuperPlasmaBall", 1.5)
STPO F 0 bright A_FireCustomMissile("SuperPlasmaBall")
STPO F 1 bright A_FireCustomMissile("SuperPlasmaBall", -1.5)
All of these states will execute in the same tic. In an animation, 0-duration frames will execute their actions at the same time as the next non-0 duration frame.
User avatar
Mayhem666
Posts: 501
Joined: Sun Feb 26, 2012 6:17 pm
Location: Canada,Qc

Re: Weapon Projectile Question

Post by Mayhem666 »

Yeah But when i state 0-Duration Frames, My Weapons is so fast that he Shoot the 600 cell Ammo in one Shot, Rofl,

So i wanted a solution to fix that with.

If there a way..?
User avatar
Mikk-
Posts: 2274
Joined: Tue Jun 30, 2009 1:31 pm

Re: Weapon Projectile Question

Post by Mikk- »

Posting your full code for that weapon would definitely help.
User avatar
Mayhem666
Posts: 501
Joined: Sun Feb 26, 2012 6:17 pm
Location: Canada,Qc

Re: Weapon Projectile Question

Post by Mayhem666 »

actor SuperPlasmaGun : DoomWeapon 30303
{
Game Doom
Weapon.SelectionOrder 100
Weapon.AmmoUse 1
Weapon.AmmoGive 80
Weapon.AmmoType "Cell"
Inventory.PickupMessage "You Got The Super Plasma Gun!"
States
{
Ready:
STPO A 0 A_PlaySound("weapons/SuperPlasmaGun")
STPO ABC 4 A_WeaponReady
loop
Deselect:
STPO A 0
STPO E 1 A_Lower
loop
Select:
STPO A 1 A_Raise
loop
Fire:
STPO FGH 1 bright A_FireCustomMissile("SuperPlasmaBall", 1.5)
STPO FGH 1 bright A_FireCustomMissile("SuperPlasmaBall")
STPO FGH 1 bright A_FireCustomMissile("SuperPlasmaBall", -1.5)
STPO E 4 A_ReFire
Goto Ready
Flash:
STPO F 4 Bright A_Light1
Goto LightDone
STPO G 4 Bright A_Light1
Goto LightDone
Spawn:
STPP A -1
Stop
}
}


That's it, So with this he's shooting Three Ball In One Shot But Not in Same Time, But with Code 1-Duration Frame It Shoot's really fast, which i want, And if i put 0-Duration Frame it's Shoot ridiculously fast like all Cell in one shot Lol, Then i need to set it up so he can Shoot in same Speed but the 3 Missile in Sametime, Not One By One Per Shot.
User avatar
cypherphage
Posts: 213
Joined: Sun Feb 27, 2011 2:54 am

Re: Weapon Projectile Question

Post by cypherphage »

The problem is each time you call a_firecustommissile you use a cell. From the wiki:
A_FireCustomMissile (string missiletype [, angle angle [, bool useammo [, int spawnofs_horz [, int spawnheight [, bool aim[, angle pitch]]]]]])
So, try this:

STPO FGH 0 bright A_FireCustomMissile("SuperPlasmaBall", 1.5,0) //setting use ammo to false
STPO FGH 0 bright A_FireCustomMissile("SuperPlasmaBall",0,0) //ditto
STPO FGH 1 bright A_FireCustomMissile("SuperPlasmaBall", -1.5,1) //set this way, you now use 1 cell per shot
STPO E 6 A_ReFire //since it seemed like you were saying 0 frame duration was too short, lengthen this frame

if you wanted to use more ammo, just switch it back to useammo on each shot
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: Weapon Projectile Question

Post by Blue Shadow »

Also, your weapon calls [wiki]A_FireCustomMissile[/wiki] 9 times in total per fire sequence (three times for each of these frames: "F","G" and "H") resulting in firing 9 projectiles and, ultimately, consuming 9 rounds of ammo.

This is how your Fire state looks like, in fact:

Code: Select all

  Fire:
    STPO F 1 bright A_FireCustomMissile("SuperPlasmaBall", 1.5)
    STPO G 1 bright A_FireCustomMissile("SuperPlasmaBall", 1.5)
    STPO H 1 bright A_FireCustomMissile("SuperPlasmaBall", 1.5)
    STPO F 1 bright A_FireCustomMissile("SuperPlasmaBall")
    STPO G 1 bright A_FireCustomMissile("SuperPlasmaBall")
    STPO H 1 bright A_FireCustomMissile("SuperPlasmaBall")
    STPO F 1 bright A_FireCustomMissile("SuperPlasmaBall", -1.5)
    STPO G 1 bright A_FireCustomMissile("SuperPlasmaBall", -1.5)
    STPO H 1 bright A_FireCustomMissile("SuperPlasmaBall", -1.5)
    STPO E 4 A_ReFire
    Goto Ready
User avatar
Mayhem666
Posts: 501
Joined: Sun Feb 26, 2012 6:17 pm
Location: Canada,Qc

Re: Weapon Projectile Question

Post by Mayhem666 »

cypherphage wrote:The problem is each time you call a_firecustommissile you use a cell. From the wiki:
A_FireCustomMissile (string missiletype [, angle angle [, bool useammo [, int spawnofs_horz [, int spawnheight [, bool aim[, angle pitch]]]]]])
So, try this:

STPO FGH 0 bright A_FireCustomMissile("SuperPlasmaBall", 1.5,0) //setting use ammo to false
STPO FGH 0 bright A_FireCustomMissile("SuperPlasmaBall",0,0) //ditto
STPO FGH 1 bright A_FireCustomMissile("SuperPlasmaBall", -1.5,1) //set this way, you now use 1 cell per shot
STPO E 6 A_ReFire //since it seemed like you were saying 0 frame duration was too short, lengthen this frame

if you wanted to use more ammo, just switch it back to useammo on each shot
Then It's these code i need for my weapon to work like i want?

Does it fix the issue then
User avatar
cypherphage
Posts: 213
Joined: Sun Feb 27, 2011 2:54 am

Re: Weapon Projectile Question

Post by cypherphage »

Try it? I'm guessing at which part is the problem as your description is a bit vague, post what happens and how that differs from what you want.
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1118
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Contact:

Re: Weapon Projectile Question

Post by Jekyll Grim Payne »

Basically, if you want several actions to happen at the same time, tie all the commands up until the very last one to frames with zero length. If you want it to happen not so often... Well, kinda like this:

Code: Select all

TNT1 A 0 A_FireCustomMissile("SuperPlasmaBall", 1.5,0)
TNT1 A 0 A_FireCustomMissile("SuperPlasmaBall",0,0)
TNT1 A 0 A_FireCustomMissile("SuperPlasmaBall", -1.5,1)
STPO FGH 1 bright
This way it uses 1 ammo, shoots 3 projectiles and does it at showing frame F. Do it like this if you want it at the end of the animation:

Code: Select all

STPO F 1 bright
STPO G 1 bright
TNT1 A 0 A_FireCustomMissile("SuperPlasmaBall", 1.5,0)
TNT1 A 0 A_FireCustomMissile("SuperPlasmaBall",0,0)
TNT1 A 0 A_FireCustomMissile("SuperPlasmaBall", -1.5,1)
STPO H 1 bright
I tie all the actions to zero-length empty frames (TNT1* is emtpy), that's kinda my habit.
Notice that if you tie one command to several frames, it'll be executed several times, so in your original code 9 projectiles are launched, not 3.
Locked

Return to “Editing (Archive)”