Skitso Posted September 8, 2017 Hey, I'm trying to mod my chaingun to have a faster firerate and a quick windup animation to compensate it. I've managed the firerate part, but I have no idea what to do to have a windup animation after pressing fire button but before the weapon fires. I'd be eternally grateful if anyone could help me out. I'm using smooth doom as a basis and here's what I have so far: Quote CaseFire: TNT1 A 0 a_jumpif(callacs("BobToggle")==1, "bobcasefire") TNT1 A 0 A_JumpIf(CallACS("ChaingunToggle")==1, "64CaseFire") TNT1 A 0 A_JumpIf(CallACS("recoiltoggle")==1, "recoilcasefire") PKCG A 0 A_FireCGun TNT1 A 0 A_spawnitemex ("bulletcasing", 40, 0, 15, random(5,7), random(7,8), random(7,10), 0) PKCG BCD 1 PKCG A 0 A_FireCGun TNT1 A 0 A_spawnitemex ("bulletcasing", 40, 0, 15, random(4,6), random(7,9), random(7,9), 0) PKCG BCD 1 PKCG B 0 A_ReFire PKCG A 1 A_Weaponready PKCG BB 1 A_Weaponready PKCG CCC 1 A_Weaponready PKCG DDD 1 A_Weaponready Goto Ready Thanks in advance! :) 0 Quote Share this post Link to post
Voros Posted September 8, 2017 Do you really need the ACS scripts? As for windup, here's what I'd do: Fire: PKCG DDD 1 PKCG CCC 1 PKCG BB 1 PKCG A 1 Goto CaseFire CaseFire: TNT1 A 0 a_jumpif(callacs("BobToggle")==1, "bobcasefire") TNT1 A 0 A_JumpIf(CallACS("ChaingunToggle")==1, "64CaseFire") TNT1 A 0 A_JumpIf(CallACS("recoiltoggle")==1, "recoilcasefire") PKCG A 0 A_FireCGun TNT1 A 0 A_spawnitemex ("bulletcasing", 40, 0, 15, random(5,7), random(7,8), random(7,10), 0) PKCG BCD 1 PKCG A 0 A_FireCGun TNT1 A 0 A_spawnitemex ("bulletcasing", 40, 0, 15, random(4,6), random(7,9), random(7,9), 0) PKCG BCD 1 PKCG B 0 A_ReFire("CaseFire") PKCG A 1 A_Weaponready PKCG BB 1 A_Weaponready PKCG CCC 1 A_Weaponready PKCG DDD 1 A_Weaponready Goto Ready I don't know how complex your code is, so let's go with the easiest route. *WARNING: THIS IS UNTESTED* 0 Quote Share this post Link to post
Skitso Posted September 8, 2017 (edited) Yeah, the problem is, I don't know anything about scripting. I'm just modifying smooth doom for my personal liking. The code is so messy I just can't understand half of it. Thanks, I'll try that one and return if I have problems. :) Edited September 8, 2017 by Skitso 0 Quote Share this post Link to post
Skitso Posted September 8, 2017 Okay, my code is now like this: Quote Ready: PKCG A 1 A_WeaponReady Loop Deselect: PKCG A 1 A_Lower Loop Select: PKCG A 1 A_Raise Loop Fire: PKCG A 3 PKCG BB 3 PKCG CCC 3 PKCG DDD 2 PKCG A 2 PKCG BB 2 PKCG CCC 1 PKCG DDD 1 goto CaseFire CaseFire: PKCG A 0 A_FireCGun TNT1 A 0 A_spawnitemex ("bulletcasing", 40, 0, 15, random(5,7), random(7,8), random(7,10), 0) PKCG BCD 1 PKCG A 0 A_FireCGun TNT1 A 0 A_spawnitemex ("bulletcasing", 40, 0, 15, random(4,6), random(7,9), random(7,9), 0) PKCG BCD 1 PKCG B 0 A_ReFire PKCG A 1 A_Weaponready PKCG BB 1 A_Weaponready PKCG CCC 1 A_Weaponready PKCG DDD 1 A_Weaponready Goto Ready What it does now, its it winds up, then shoots 2 bullets, winds up again, then shoots 2 bullets... So it's not exactly what I had in mind. How do I need to change it to have only one windup when I start to shoot, and them continue shooting without stops as long as the button is held down? Thanks! :) 0 Quote Share this post Link to post
scifista42 Posted September 8, 2017 (edited) Either rename CaseFire to Hold, or change A_ReFire to A_ReFire("CaseFire"). See how and why it works here: https://zdoom.org/wiki/A_ReFire Edited September 8, 2017 by scifista42 1 Quote Share this post Link to post
Skitso Posted September 8, 2017 Btw, is there a way to prevent holding the fire key to keep shooting? Say if I'd want to make the pistol to require a separate key press per shot, how would I do it? 0 Quote Share this post Link to post
scifista42 Posted September 8, 2017 (edited) Give the weapon a WEAPON.NOAUTOFIRE flag and don't use A_ReFire in its fire animation. Alternatively, after fire animation, use A_ReFire to loop a single frame with duration 1 and action A_WeaponReady with WRF_NOPRIMARY flag, so that the weapon would be unable to fire again while in this loop, and the loop would be broken only after the fire button stops being pressed. Note that weapons that require pressing fire for each shot tend to be viewed as annoying to use by players, though. Especially players who play with keyboard-only controls. Edited September 8, 2017 by scifista42 0 Quote Share this post Link to post
Empyre Posted September 8, 2017 2 hours ago, scifista42 said: Note that weapons that require pressing fire for each shot tend to be viewed as annoying to use by players, though. Especially players who play with keyboard-only controls. One possible exception is if you make it so it fires faster than the normal hold-to-fire pistol if the player presses fire fast enough, but even that gets old. 0 Quote Share this post Link to post
Skitso Posted September 9, 2017 (edited) that's the idea... I'm putting together a weapon balance mod for deathmatch. A "free firing" pistol wth double damage is part of it. Is there a better way to double the pistol damage than make it shoot two bullets at the same time? Edited September 9, 2017 by Skitso 0 Quote Share this post Link to post
Voros Posted September 9, 2017 Yes. You edit the Damage property. 0 Quote Share this post Link to post
Skitso Posted September 9, 2017 Yeah, but it seems to be a bit of a challenge to change it without messing shotguns and chainguns damage output? 0 Quote Share this post Link to post
Voros Posted September 9, 2017 Wait, my bad. Damage is for projectiles. Use A_FireBullets to alter spread, damage, visible shots, puff, etc. 0 Quote Share this post Link to post
Skitso Posted September 9, 2017 (edited) Thanks, this community is awesome. Could you post an example for pistol with double damage? Edited September 9, 2017 by Skitso 0 Quote Share this post Link to post
Voros Posted September 9, 2017 ACTOR SkitsoPistol : Pistol REPLACES Pistol { Weapon.SlotNumber 2 States { Fire: PISG A 4 PISG B 6 A_FireBullet(5.6, 0, 1, 10) TNT1 A 0 A_PlaySound("weapons/pistol", CHAN_WEAPON) PISG C 4 A_GunFlash PISG B 5 A_ReFire Goto Ready } } Should do it. 0 Quote Share this post Link to post
Voros Posted September 9, 2017 (edited) Whhops Edited September 9, 2017 by Voros 0 Quote Share this post Link to post
Skitso Posted September 10, 2017 (edited) I can't get it working... Quote ACTOR PerkPistol : Pistol replaces Pistol { decal bulletchip States { Spawn: PSTO a -1 stop Ready: PKPI A 1 A_WeaponReady Loop Deselect: PKPI A 1 A_Lower Loop Select: PKPI A 1 A_Raise Loop Fire: PKPI A 3 PKPI B 0 A_FireBullet(5.6, 0, 1, 10) PKPI B 2 A_spawnitemex ("bulletcasing", 40, 0, 25, random(4,6), random(7,8), random(7,9), 0) PKPI B 1 PKPI C 1 PKPI D 2 A_Weaponready PKPI E 1 offset(0,34) A_Weaponready PKPI E 1 offset(0,33) A_Weaponready PKPI D 1 offset(0,32) A_Weaponready PKPI B 1 offset(0,32) A_Weaponready Goto Ready GZDoom crashes saying: " Script error, "SmoothDoom.pk3:deco/player/pistol.txt" line 20: Invalid parameter 'a_firebullet'" Edited September 10, 2017 by Skitso 0 Quote Share this post Link to post
scifista42 Posted September 10, 2017 (edited) It should be bullets, not bullet. https://zdoom.org/wiki/A_FireBullets Edited September 10, 2017 by scifista42 0 Quote Share this post Link to post
Skitso Posted September 10, 2017 After setting my pistol damage up to 15, it seems to gib enemies, which is not something I would like to have. I tried using NOEXTREMEDEATH flag but it presumably only works for projectiles? Any ideas? 0 Quote Share this post Link to post
scifista42 Posted September 10, 2017 (edited) Enemies gib when the last hit that kills them reduces their health below a value given by the monster's GibHealth property. For example, Zombieman's Health is 20 and GibHealth is -20. One hit of your weapon deals 15-45 damage (due to randomization). Therefore, even a full health Zombieman can get its health reduced down to -25 in a single hit, and if this happens, he will gib. To avoid gibbing Zombiemen, consider defining your bullet damage such that it won't exceed 20 even after randomization. One way is to simply decrease the damage. Another way, you can use FBF_NORANDOM flag in A_FireBullets to remove the default randomization. In that case, if you want custom randomization, specify it by putting for example "random(15,20)" into the place where you have "15" now, so that the generated number would be between 15 and 20 instead of either a fixed 15 or a randomized 15-45. Edited September 10, 2017 by scifista42 0 Quote Share this post Link to post
Skitso Posted September 10, 2017 (edited) Hmm, strange... I'm still gibbing zombies with PKPI B 0 A_FireBullets (5.6, 0, 1, random(15,20)) It shouldn't be possible? I'm also some times one shotting sargeant (that have 30hp) so there's clearly something wrong... Also, I'm missing my muzzle flash when using A_FireBullets :/ Edited September 10, 2017 by Skitso 0 Quote Share this post Link to post
scifista42 Posted September 10, 2017 13 minutes ago, Skitso said: PKPI B 0 A_FireBullets (5.6, 0, 1, random(15,20)) It shouldn't be possible? You need to put "FBF_NORANDOM" to the "flags" parameter of A_FireBullets, otherwise the damage value gets further multiplied by a random number between 1 and 3, see the wiki. 15 minutes ago, Skitso said: Also, I'm missing my muzzle flash when using A_FireBullets :/ Use A_GunFlash. Specifically, make a new state with duration 0 and with action A_GunFlash before the state with A_FireBullets, so they they will be called at the same time. And please... Start learning from the wiki on your own. You can't do modding all by asking questions on a forum and letting people do your work. 1 Quote Share this post Link to post
Skitso Posted September 10, 2017 Thanks. I will. I'm just starting to get a hang of how this thing works. I'll stop beign a pain in the butt now. :) 0 Quote Share this post Link to post
Empyre Posted September 10, 2017 On the other hand, don't be afraid to ask questions here. Just try to figure it out for yourself first, using the wiki. Then, if you're still stumped, ask questions here. Once you have learned the ropes, you can start answering questions when you know the answer, while still asking some, like I do. 0 Quote Share this post Link to post
Skitso Posted September 11, 2017 (edited) My chaingun windup mod is evolving nicely but now I'm stuck with a thing I'm not sure if it's is even possible to achieve. Quote ACTOR Z86Chaingun : Chaingun replaces Chaingun { decal bulletchip States { Ready: PKCG A 1 A_WeaponReady Loop Deselect: PKCG A 1 A_Lower Loop Select: PKCG A 1 A_Raise Loop Fire: PKCG A 0 A_GunFlash PKCG A 0 A_FireBullets (1, 1, 1, 4) TNT1 A 0 A_spawnitemex ("bulletcasing", 40, 0, 15, random(4,6), random(7,9), random(7,9), 0) TNT1 A 0 A_PlaySound("weapons/pistol", CHAN_WEAPON) PKCG A 3 PKCG BB 3 PKCG CCC 2 PKCG A 0 A_GunFlash PKCG A 0 A_FireBullets (1, 1, 1, 4) TNT1 A 0 A_spawnitemex ("bulletcasing", 40, 0, 15, random(5,7), random(7,8), random(7,10), 0) TNT1 A 0 A_PlaySound("weapons/pistol", CHAN_WEAPON) PKCG DDD 2 PKCG A 2 PKCG BB 1 PKCG A 0 A_GunFlash PKCG A 0 A_FireBullets (2, 2, 1, 4) TNT1 A 0 A_spawnitemex ("bulletcasing", 40, 0, 15, random(4,6), random(7,9), random(7,9), 0) TNT1 A 0 A_PlaySound("weapons/pistol", CHAN_WEAPON) PKCG CCC 1 PKCG DDD 1 goto CaseFire CaseFire: PKCG A 0 A_GunFlash PKCG A 0 A_FireBullets (4, 4, 1, 4) TNT1 A 0 A_spawnitemex ("bulletcasing", 40, 0, 15, random(5,7), random(7,8), random(7,10), 0) TNT1 A 0 A_PlaySound("weapons/pistol", CHAN_WEAPON) PKCG BCD 1 PKCG A 0 A_GunFlash PKCG A 0 A_FireBullets (4, 4, 1, 4) TNT1 A 0 A_spawnitemex ("bulletcasing", 40, 0, 15, random(4,6), random(7,9), random(7,9), 0) TNT1 A 0 A_PlaySound("weapons/pistol", CHAN_WEAPON) PKCG BCD 1 PKCG B 0 A_ReFire("CaseFire") PKCG A 1 A_Weaponready (WRF_NOSWITCH) PKCG BB 1 A_Weaponready (WRF_NOSWITCH) PKCG CCC 1 A_Weaponready (WRF_NOSWITCH) PKCG DDD 2 A_Weaponready (WRF_NOSWITCH) PKCG A 2 A_Weaponready (WRF_NOSWITCH) PKCG BB 3 A_Weaponready (WRF_NOSWITCH) PKCG CCC 3 A_Weaponready (WRF_NOSWITCH) PKCG DDD 3 A_Weaponready (WRF_NOSWITCH) Goto Ready So when a player shoots, there's a quick windup sequence where the gun starts to shoot slowly and then faster. After windup the gun reaches it's maximum speed but at the same time loses a bit of it's accuracy. After releasing the trigger, the gun slowly winds down. It's great and I'm really satisfied with the results as it combines the accuracy of the original chaingun and the powerful and fast feeling of a real chaingun without being overpowered. What I still would like to do, is that if the player starts shooting again while the gun is still winding down, it would jump straight back to the CaseFire state and not have to windup again. I've tried to find a way to do it, but without any decent results. Could some one point me in the right direction? Thanks! Edited September 11, 2017 by Skitso 0 Quote Share this post Link to post
scifista42 Posted September 11, 2017 (edited) Make several zero-duration frames with A_Refire("CaseFire") in between frames of the wind-down animation. You could even have a transition between half-finished wind-down and half-finished wind-up this way: Make several labels in between frames of the wind-up animation, and make several zero-duration frames with A_Refire("labelname") in between frames of the wind-down animation. Edited September 11, 2017 by scifista42 0 Quote Share this post Link to post
Skitso Posted September 11, 2017 Of course. I was thinking way too complicated stuff. But I'm learning all the time! :) 0 Quote Share this post Link to post
Skitso Posted September 13, 2017 One more thing I can't seem to figure on my own: is there a way to abort the windup animation if the fire button is released before goto casefire? 0 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.