Trying to make a equippable torch for Hexen

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
User avatar
Colerx
Posts: 171
Joined: Thu Feb 11, 2021 6:16 am

Trying to make a equippable torch for Hexen

Post by Colerx »

Hey there guys,
I state that I'm completely noob in zdoom scripting, I just started snooping around in this beautiful world and this is the very first attempt to, more than create, make standalone something that already exists but just in other complete mods,
I borrowed the torch weapon from Forgotten Realms wad of wich I thank a lot the creator.
With all these graphics improvements nowadays I just cannot use anymore the vanilla Hexen torch wich makes the whole map bright, so I would like a local dynamic light.

How far I have come here is at this Link TorchTest.pk3

I have a few problems, the first one is that the light wich is supposed to light up the place won't show up even using the original package, same was happening with BrutalHexen mod, I guess that the problem could be here in "\Decorate\Weapons\torch.txt" if I'm not mistaken:
Spoiler:
I tried to get informed about these TNT things but mmh... wich code could make a beatiful but not too much bright light? 8-)


Question number two:

I saw that the first way to add a weapon to a class, is to create a new one with StartItem stuff, wich is what I've done (well, FR creator did).. I was wondering if there is an way to add it to any class of the WAD I'm currently playing, instead of replacing them.. maybe using Playerpawn could it be?
In the end my goal is to make this torch loadable universally with any mod wich most probably would already have custom classes (oh, and make it working in co-op of course), but for the moment I'd better make it lighting up something. :D

Thank for your time guys.
User avatar
Cherno
Posts: 1309
Joined: Tue Dec 06, 2016 11:25 am

Re: Trying to make a equippable torch for Hexen

Post by Cherno »

I have attached an updated versionf ro you.

Things I changed:

Removed custom player classes from DECORATE (deleted KEYCONF altogether), so the torch is usable with any playerclasses.
Deleted TorchLight object from GLDEFS
Added an ACS script that gives a player a torch when entering a map
Editir the TochLight's DECORATE definition so it uses A_AttachLightDef and A_RemoveLight, and shortened the frame definitions. As an added benefit, it is now possible to switch to another weapon while the torch is lit, and if so, selecting the torch again from another weapon will make it come up lit again. I feel this is much more user-friendly than having to switch the torch on or off all the time (which is still possible, of course).
TorchTestCherno.pk3
(97.86 KiB) Downloaded 27 times
As a side note: If you do plan on diving into gzdoom modding, I strongly suggest using zscript instead of DECORATE, it will make things much easier in the long run, and prevent messy actor definition like the torch's with dozens of 0-duration frames, and using dummy inventories as "variables".
User avatar
Colerx
Posts: 171
Joined: Thu Feb 11, 2021 6:16 am

Re: Trying to make a equippable torch for Hexen

Post by Colerx »

^^ hey how could I thank you enough? I really appreciate your help and definetly like your customizations, Gonna try it once got home from work and have a snoop inside to see what have you written!

And thanks for the suggestion!

EDIT:

Looks great my friend, playing with HD Mod by AndrewMRX

https://i.ibb.co/TH16PLM/torchoff.png

https://i.ibb.co/b68XDkf/torchon.png


and feels much more confortable, let's see if I can improve something just for start learning, Maybe first I'll update the artitorch to light up the same way, but meanwhile you can use weapons!

Thank you very much
User avatar
Colerx
Posts: 171
Joined: Thu Feb 11, 2021 6:16 am

Re: Trying to make a equippable torch for Hexen

Post by Colerx »

Hope not bothering again with this I promise it's my last asking for help!

I've made the Artitorch working with the same light effect but of bigger in size and less flickering. and that's already good for me... Maybe I'll play around with GL numbers and colors later.
I've fixed a little problem caused by the torchweapon sprite names wich were overwriting the artitorch pickup and icon ingame, showing up a burning flame :lol: .
TorchTest2.pk3
(98.95 KiB) Downloaded 22 times
BUT: I'm not sure if it has a duration I think it's going on lighting up forever, I tried to insert some timer with "wait" and "stop" after "Use: TNT1 A 0 A_AttachLightDef("torch","torchlight3")" but surely it's not the right way..

As last thing I would like to add an effect, such when switching off the Torchweapon the light size gradually but quickly decreases to zero like a "shrinking circle".
If there's no a ready-to-use effect like that, I could build it my self with multiple frames, decreasing the light size manually.

Same as I would like to do with the artitorch, once solved the timer thing, that in the last few seconds before it times out (like when in vanilla starts blinking) . but more gradually and slowly.

Just a little help to get in the right direction, Thanks and I promise that I won't bother anymore with these easy things, I will study :D
User avatar
Cherno
Posts: 1309
Joined: Tue Dec 06, 2016 11:25 am

Re: Trying to make a equippable torch for Hexen

Post by Cherno »

I will try to get back to you within the next two days.
User avatar
Colerx
Posts: 171
Joined: Thu Feb 11, 2021 6:16 am

Re: Trying to make a equippable torch for Hexen

Post by Colerx »

Big thanks Cherno, take your time
User avatar
Colerx
Posts: 171
Joined: Thu Feb 11, 2021 6:16 am

Re: Trying to make a equippable torch for Hexen

Post by Colerx »

Meanwhile I've almost did the other basic edits I wanted. not as perfect as I hoped but as proof of concept should be ok,

yeh increased light size again and adjused its position,
I've removed the "off" state of the torch, even if nice, in the end was quite useless.
speeded up the lowering and added the keybinding in controls menu, unfortunately works only for selecting it and not for deselecting.
if pressing fire button while equipped, switches automatically to the highest priority weapon in inventory (also here I preferred to switch to last weapon used but was too complicated for me)

This is it:
TorchTest3.pk3
(99.37 KiB) Downloaded 21 times
I managed also to attach the sprite of the walltorch to the player when the torch is active (later maybe for the artitorch as well), I tought that would be nice to see it when playing in co-op.
but I couldn't do anything nice, any offset I tried to apply to the sprite just didn't want to move and remains inside the player and for some reason it wanted to show only the first frame of the burning torch , plus when moving is not looking very good.. maybe I'll just forget about this little thing for the moment, but I'll attach it anyway. :
TorchSpriteTest3.pk3
(100.05 KiB) Downloaded 22 times


Next thing I'll try is to add burning sound effect and maybe a little bright light to it, for the moment this is all I can do :)
User avatar
Cherno
Posts: 1309
Joined: Tue Dec 06, 2016 11:25 am

Re: Trying to make a equippable torch for Hexen

Post by Cherno »

Hello again,

I won't have time to work on this in the next three weeks.
User avatar
Colerx
Posts: 171
Joined: Thu Feb 11, 2021 6:16 am

Re: Trying to make a equippable torch for Hexen

Post by Colerx »

No problem my friend you did a lot already, no hurries and no obligation :)
User avatar
Colerx
Posts: 171
Joined: Thu Feb 11, 2021 6:16 am

Re: Trying to make a equippable torch for Hexen

Post by Colerx »

Ok I made some improvements, borrowed from BrutalHexenRPG so I thank a lot its authors.
Essentially now it's just the standalone torch of that that mod, anyway I write down the improvements:

Since without an offensive fire mode was quite unconfortable to switch everytime to a weapon I added it.
Added sounds and adjusted graphics effects, with the switching off when diving in water
Some minor tweaks.

Now I'm trying to finish the ArtiTorch and then I try to put in Resource section.

Torch.pk3
User avatar
Colerx
Posts: 171
Joined: Thu Feb 11, 2021 6:16 am

Re: Trying to make a equippable torch for Hexen

Post by Colerx »

Hey sorry again guys and dear Cherno ,
I came back to this after a month trying to finish the basic version of it, the torchweapon I think is almost done except for the light effect I tought about before, but that comes later,
I'm just stuck on how to set the timer for the artifact torch, I thinked to do the simplest thing as inserting many "dummy" frames to let the desired time to pass and then switch it off but I don't know how to do that, seems every TNT1 A "X" frame I insert it jumps directly to the removelight and stop burning sound. thinked about the "wait" Flow control but didn't got how it works.. probably similar to loop
it's the "\Decorate\Artifacts\artitorch2.txt" in the pk3 of the post above, many thanks

PS: oh another thing, wanted also to attach a little light to the spawn state of it, like mana does, then after pickup I want the light to disappear with the despawn of the torch, I already got rusty with this after a month :oops:
User avatar
Cherno
Posts: 1309
Joined: Tue Dec 06, 2016 11:25 am

Re: Trying to make a equippable torch for Hexen

Post by Cherno »

Sorry, I don't have time to help you with this.

Feel free to join the Discord for real-time coding help.
User avatar
Colerx
Posts: 171
Joined: Thu Feb 11, 2021 6:16 am

Re: Trying to make a equippable torch for Hexen

Post by Colerx »

allright, thank you btw :)
Post Reply

Return to “Scripting”