DECORATE weapons class

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
DoomRater
Posts: 8270
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ
Contact:

DECORATE weapons class

Post by DoomRater »

Hello weapon modders. I assume you've all graduated from weapons 101 where we've remade the shotgun and chaingun from Doom and fingerpainted with the weapon values enough to get the basic idea of what everything does, so let's try some more advanced stuff.

As I previously posted in the currently working on thread, my first challenge is a simple one, but some of you may have already done a similar weapon to this so HONOR SYSTEM guys, spoiler or attach your answers and NO PEEKING until everyone's had a chance to work out a solution for themselves.

The first challenge is to make a weapon that is compatible with the Tome of Power withOUT using a sisterweapon. It must have a normal attack and another attack that works only when a player activates a Tome. Ideally the attack should override the default one.
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Re: DECORATE weapons class

Post by XutaWoo »

DoomRater wrote:Ideally the attack should override the default one.
Didn't you complain about ammo wasting when I told you about my DUAL MINIGUNS? :P
User avatar
DoomRater
Posts: 8270
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ
Contact:

Re: DECORATE weapons class

Post by DoomRater »

Think of this as a chance to fingerpaint! Like the (nonexistant) 101 class, we can make completely unbalanced weapons as long as we understand the concept behind the weapon. Polish and balance belong in completed mods, but who says we can't have a little fun while we're learning?
User avatar
Ceeb
Posts: 5125
Joined: Wed Jun 11, 2008 4:07 pm
Location: Castle Wut

Re: DECORATE weapons class

Post by Ceeb »

I have a gun that shoots impsex, class won't save me.
User avatar
przndoom
Posts: 692
Joined: Sun Dec 23, 2007 12:22 pm
Location: Right behind you
Contact:

Re: DECORATE weapons class

Post by przndoom »

I got one teacher!!!

Im trying to make a teleport gun shooting 2 projectiles. The first one, when it hits a thing (no damage) , that thing becomes the portal or thing that teleports
2nd is where the #1 gets teleported... only to a certain distance like a few feet in front, cant do it across the room.

Now how does teleportation work? I check zdwiki but still can't wrap it around my mind.
Can a monster/player/object be the "receiving" end of a teleportation?
User avatar
ThatOneZDoomer
Posts: 225
Joined: Sun Jun 01, 2008 1:33 am
Preferred Pronouns: She/Her
Location: Where I'm at of course

Re: DECORATE weapons class

Post by ThatOneZDoomer »

Oh man, the good old days back in Weapons 101, where making a simple shotgun or chaingun seemed like a really hard task. It was more about learning how to put it together then anything else, where the more advanced lessons focus on various tricks and more. Of course, there was that one guy who refused to try to learn anything on his own, which was highly annoying for everyone else. I even heard he tried to copy someone else's project.

*raises hand* Here's my answer. This was easy since I already done something like this in my own personal project. I didn't really do anything overpowered yet.
Spoiler:
User avatar
BouncyTEM
Posts: 3822
Joined: Sun Aug 24, 2003 5:42 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: 2280 Lol Street: The Calamitous Carnival (formerly Senators Prison)

Re: DECORATE weapons class

Post by BouncyTEM »

This would be my answer to it, since when you suggested that initially I was curious as to how it'd be done. Well, I figured that out! :)
Attachments
LichStaffWeapon.zip
Replaces the chainsaw. Go pick that up, use it for a bit, then go use the powerup cheat and there you go.
(55.08 KiB) Downloaded 30 times
User avatar
DoomRater
Posts: 8270
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ
Contact:

Re: DECORATE weapons class

Post by DoomRater »

>D just as expected, two people have come up with different looking code to achieve the same effect!

Bouncy, your answer has an interesting bug in it: when the Tome runs out your weapon is still turned blue. It's an easy fix of course- you're just looping to the wrong section of the code, but it shows how tricky some of these solutions can be.

I'm gonna go ahead and post a modified version of ThatOneZDoomer's answer (which is just a tad more optimized), and I'd like you two to compare it to Bouncy's solution. Which method, using a SisterWeapon or the design we just experimented with, would you use for each weapon design and why?
Spoiler:
User avatar
BouncyTEM
Posts: 3822
Joined: Sun Aug 24, 2003 5:42 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: 2280 Lol Street: The Calamitous Carnival (formerly Senators Prison)

Re: DECORATE weapons class

Post by BouncyTEM »

Is it an easy fix? I tried getting it to be fixed and it didn't work at all. The extra code required caused no difference whatsoever, so I simply removed it. :?

As for the question...I'd probably use the design we just experimented with for both weapons, since it feels more satisfying to have your own method rather than the really, really simplistic sisterweapon (which has given me trouble before on multiple occasions)

At least if something screws up with this experimental design, it's easier to understand why it screwed up.

Not to mention, specifying a weapon once rather than twice is so much more nice.

Edit: Yeah, I don't see how this is an easy fix when A_Jumpifinventory doesn't allow you to actually check for if you DON'T have something. (from what I know, since 0 never works for that...)
Do explain how it's an easy fix, I'm clearly unaware of the trick needed here. :(


Edit 2: Nevermind, figured that out. Wow, so simple...*facepalm*

Ah well, my screw up's excusable. I haven't written a new weapon in DECORATE in well over a year!

Updated accordingly.
Attachments
LichStaffWeapon.zip
Yaaay, flawless version.
(55.97 KiB) Downloaded 28 times
User avatar
ThatOneZDoomer
Posts: 225
Joined: Sun Jun 01, 2008 1:33 am
Preferred Pronouns: She/Her
Location: Where I'm at of course

Re: DECORATE weapons class

Post by ThatOneZDoomer »

*raises hand* I think I see where you're going with this Mr. DoomRater, Looking for alternate ways to do stuff while using as clean and little code as possible. This especially goes with avoiding repeated code, like seen in the touch up you did for my answer. This could allow that same code to be easily re-used, like say, if the weapon had multiple attacks and they reused similar code, like with my weapon, both used the same delay after the shot.

As for the usual way of using SisterWeapon and and using state jumps, I say they both have their uses, depending on what you're doing, although if you want, you could just bypass SisterWeapon completely. I never actually used SisterWeapon myself before. If it's something really simple like in my case of just changing the firing state while using the same amount of ammo, I think it's a lot better just to use a state jump. It'll save down on extra code and trouble if you decide to edit something without changing the normal and powered up versions of the weapon. The only flaw (which may have a way around) I see is that you wouldn't be able to have a powered up form through state jumps that use up a different amount of ammo for firing without a little bit of trouble. For example, if I wanted my powered up rifle to drain more ammo, the only way I can think of through state jumps is to manually check and take away more ammo. This wouldn't be infinite ammo friendly. I do know you can call an ACS script that calls a function to check if the infinite ammo flag is on, but that might make it too complex.

Seeing Bouncy's solution reminded me of something. With creative use of state jumps, you could, in theory, have one weapon that has the functions of several built into it. While Bouncy's solution works just fine, every state (aside from Spawn) is changed. Using SisterWeapon in this case may or may not have made it more complex, although it sounds like Bouncy ran into some trouble from using SisterWeapon in the past. I may have used SisterWeapon in this case due to most of the states being different rather then one or two, depending if I ran into any noticeable bugs with SisterWeapon or not. The way I see it, state jumps may work better for simpler changes like I did, while SisterWeapon may work better for more complex changes like Bouncy did. I'm not saying Bouncy's way is wrong, just a different correct answer.

Speaking of state jumps, back in my somewhat early Decorate editing days (late 2007), I actually made one weapon that had many weapons built into it with a bunch of state jumps, with each jump counted by hand instead of using custom states. Had I known about custom states, this would have cut down on some pain. I also used a rather hacky way of changing weapons through inventory checks since normal weapon switching wouldn't have worked. In other words, while a working mess, a mess that best might be avoided in favor of just simply using extra weapons (which is what I later did).
User avatar
DoomRater
Posts: 8270
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ
Contact:

Re: DECORATE weapons class

Post by DoomRater »

The "aha!" moments true teachers dream of.

In fact, the point about a weapon that has multiple functions built in was the next thing I wanted to play with: Imagine a weapon that has different but cumulative effects when using a Tome or Berserk. But I think by now that'd just be busywork (unless you're not sure how that would look!) because the point of the lesson was to get you to think about weapons with multiple functions, as well as to realize what really makes powered weapons work is an inventory item we can check for.

I think it's time to take a page out of a gun I've already done and see if you guys get how the effect is done. Before SBARINFO there weren't many ways to display data from inventory items, but it actually COULD be done. As usual, A_JumpIfInventory() is critical to checking the data for a specific value, but with its pitfalls one might think it's actually not possible. Let me assure you that it is a giant pain in the ass to write so I won't expect any weapons that have crazy stuff like 30 different values to display on the screen, but it should be independent from the rest of the gun.
User avatar
DoomRater
Posts: 8270
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ
Contact:

Re: DECORATE weapons class

Post by DoomRater »

Well, maybe it's because it's the weekend, or the project is not well understood (or just too damn time consuming), I think I should move on and start another concept.

A_WeaponReady as we all know is responsible for the bobbing movement of weaponry. It is also responsible for allowing the player to change weapons and execute fire and altfire attacks internally. But if you add in +NoAutoFire, the weapon will only recognize new button presses, not when you hold it down as it comes across A_WeaponReady. This has been used to make semi-auto weapons, but you can also use it to trigger additional attacks within a weapon. The only downfall is if the player tries to select a different weapon at this point, because it will jump to deselect if he does...

If switching to another gun and then back is slower than the effect you were going for, and doesn't break anything, it's worth checking out. Try making a semi-auto gun that can be fired faster by pressing the trigger rapidly.
User avatar
ThatOneZDoomer
Posts: 225
Joined: Sun Jun 01, 2008 1:33 am
Preferred Pronouns: She/Her
Location: Where I'm at of course

Re: DECORATE weapons class

Post by ThatOneZDoomer »

While I haven't done anything like it myself, I think I have a possibly idea of how to show a fake HUD with a weapon, although it could be a major pain to do if the way I have in mind actually works. There's a very small chance I might take a crack at trying what I think might work for a fake HUD based on the weapon itself.

As for the semi-automatic weapon firing faster by pressing it more, I think I can easily attempt this one.
Locked

Return to “Editing (Archive)”