a_settics in weapon attacks

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
Ultimate Freedoomer
Posts: 218
Joined: Fri Jan 30, 2015 10:32 pm
Location: Pittman Center
Contact:

a_settics in weapon attacks

Post by Ultimate Freedoomer »

How do I use a_settics in fire/altfire states without making the weapon unable to fire in that state? I'm trying to recreate the Thunderbolt from Quake I in DECORATE. The issue I'm having only affects the primary fire. Before anyone asks, the primary fire is the lightning bolt, & the secondary fire is the plasma ball from Quake I Mission Pack Number 2: Dissolution of Eternity. Here's the relevant code:

Code: Select all

Fire:
		TNT1 A 0 A_JumpIfInventory("ThunderboltLightningAmmo",1,2,AAPTR_DEFAULT)
		Goto Click
		TNT1 A 0 A_JumpIf(waterlevel == 3, "Discharge")
		TNT1 A 0 A_Playsound("Light/fire",CHAN_BODY,1.0,0,ATTN_NORM,false)
		TNT1 A 0 A_Playsound("Light/run",Chan_7,1.0,1,ATTN_NORM,false)
		Hold:
		TNT1 A 0 A_JumpIfInventory("ThunderboltLightningAmmo",1,2,AAPTR_DEFAULT)
		Goto Click
		TNT1 A 0 A_JumpIf(waterlevel == 3, "Discharge")
		TNT1 A 0 A_TakeInventory("ThunderboltLightningAmmo",1,TIF_NOTAKEINFINITE,AAPTR_DEFAULT)
		GZAP C 1 bright a_settics(14/8)
		GZAP C 0 a_gunflash("Flash",0)
		GZAP C 0 A_RailAttack(30,0,0,"none","white",RGF_SILENT|RGF_NOPIERCING,3,"zapPUFF",0,0,1207.349733333333,0,0,0,"lightningbolt",0,0,0)
		GZAP B 1 bright a_settics(14/8)
		GZAP B 0 A_RailAttack(30,0,0,"none","white",RGF_SILENT|RGF_NOPIERCING,3,"zapPUFF",0,0,1207.349733333333,0,0,0,"lightningbolt",0,0,0)
		TNT1 A 0 A_Refire
		TNT1 A 0 A_StopSound(Chan_7)
		Goto Ready
In this state, a_settics is used to replicate the 1/10th-of-a-second attack interval that the original weapon had while working with GZDoom tics. The problem is, testing this causes GZDoom to crash, & I have no idea why.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: a_settics in weapon attacks

Post by Graf Zahl »

What are you trying to do anyway? 14/8 as integer is 1, so the code won't do anything useful to begin with.
And what does the crash say?
Ultimate Freedoomer
Posts: 218
Joined: Fri Jan 30, 2015 10:32 pm
Location: Pittman Center
Contact:

Re: a_settics in weapon attacks

Post by Ultimate Freedoomer »

Graf Zahl wrote:What are you trying to do anyway? 14/8 as integer is 1, so the code won't do anything useful to begin with.
And what does the crash say?
It crashes while I'm already in-game, so there is no log. I'm trying to adjust it so the rate of fire is 10 rounds a second, like the original.
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm
Contact:

Re: a_settics in weapon attacks

Post by Arctangent »

Tics can only be integers, as they're the number of playsim frames that must pass before moving onto the next state. It's completely impossible to do something faster than a single tic without just being instant ( i.e. 0 tics ), as that time literally doesn't exist to the engine. 1 tic is the smallest unit of time that the engine allows.
User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Re: a_settics in weapon attacks

Post by Pixel Eater »

1/10th of a second equals 3.5 tics I believe. You'd have to choose 3, 4 or alternate between the two somehow.
Post Reply

Return to “Scripting”