Is there a way to use CONs to fix minor issues?
#1 Posted 19 April 2018 - 09:30 PM
After seeing some similar fixes arise within both Nuclear Showdown and the upcoming Alien Armageddon, I'm sort of wondering how some of them were applied. Things like bumping up the Night Vision goggles visibility, making the holoduke actually work, putting a stop to the annoying trooper fakeout behavior, etc...
I know CONs were made external to allow users to sort of personalize the game. And I've been wanting to apply some of these fixes to the vanilla game for some time (for my own personal use, not for release). Unfortunately, as much as I love this game, I know less about it on the technical side versus Doom. When I want to figure out how something was done in Doom, I crack open SLADE and take a look. I can't make heads or tails of the more advanced stuff, but I've gotten a feel for both the map editor and some basic scripting through this method.
Meanwhile I open up a CON file that isn't USER and I instantly go cross-eyed.
Maybe I'm wrong and these things require something more than CONs to fix. If so, I'm still interested to know how to accomplish this.
This post has been edited by Ninety-Six: 19 April 2018 - 09:34 PM
#2 Posted 19 April 2018 - 09:55 PM
Since the advent of EDuke, CON has undergone many enhancements. It is now possible to script almost every aspect of the game, including using scripts to override what is hardcoded.
Most of the documentation for CON can be found here: http://wiki.eduke32.com/wiki/Scripting
EDIT: This document still serves as a good starting point: http://wiki.eduke32.com/wiki/Confaq42
I recommend reading through most of that page, and paying particular attention to the examples.
This post has been edited by Trooper Dan: 19 April 2018 - 10:01 PM
#3 Posted 19 April 2018 - 10:05 PM
Trooper Dan, on 19 April 2018 - 09:55 PM, said:
That's a bit rough... Right out of the gate it hits me with terms I don't fully grasp since I'm not really a programmer. It doesn't help that I tend to learn best by example, but I can't even make sense of the tutorials...
Oh boy, I'm in for a fun night...
EDIT:
Trooper Dan, on 19 April 2018 - 09:55 PM, said:
I recommend reading through most of that page, and paying particular attention to the examples.
I looked at this too, and it's sort of a similar result. I hit the CON Building Blocks section and I instantly get walled with terms I don't understand, and an example I have so many questions about
This post has been edited by Ninety-Six: 19 April 2018 - 10:10 PM
#4 Posted 19 April 2018 - 10:15 PM
It's from
#5 Posted 19 April 2018 - 10:19 PM
Trooper Dan, on 19 April 2018 - 10:15 PM, said:
It's from like 1997 and doesn't cover very much, but it breaks things down in a very simple way without overwhelming the reader or assuming you know anything.
I guess that's a better starting point... Thanks.
Though I do still wish there was some sort of way to break down and reverse-engineer some of the custom code out there since I just learn better that way, in general. But I guess that's not really an option, here...
EDIT: Yep, I'm lost again. "STATENAME is a unique number that is usually DEFINEd to be the name of the state."
This post has been edited by Ninety-Six: 19 April 2018 - 10:34 PM
#6 Posted 19 April 2018 - 11:02 PM
http://wiki.eduke32.com/wiki/State
Anyway, if you have a specific question, it's pretty easy to get help around here. If you are realizing that this is too technical and you want to forget about it, then that's fine too.
Incidentally, here is the thread where I started modding 12 years ago:
https://forums.3drea...ead.php?t=16801
I posted about every little thing I did and every single problem I had. I posted constantly in many different threads (some of them concurrent with that one) asking about how to do everything. I'm not recommending that anyone do that. But one thing that you could say for sure about me is that I was trying very, very hard to learn and I didn't give up. In general, I will help people who are trying to help themselves. If someone seems like they are trying to learn and fighting the good fight, I will take some time to give them advice and information.
#7 Posted 19 April 2018 - 11:35 PM
Learning by seeing and learning by doing when I port something over incorrectly.
It's similar here. These problems (especially the lizard troops which have ended so many runs before they began when literally every other liztroop in hollywood holocaust does the choke and I don't have nearly enough explosives) I feel are worth moving mountains for. That being said, it seems to be far more difficult to achieve what seem to be fairly simple fixes (and probably are if I get past this insanely high wall that is "basically actually programming" and the majority of my experience is a high school coding class on BASIC), especially since I really can't learn through example in this case. Even the tutorials on the wiki that actually do contain solutions to some of these issues like the night vision goggles, I'm not even entirely sure where they're supposed to be inserted into.
That's kind of the level I'm approaching this from.
Even if one of you guys gave up and just kicked the answers over to me, I'd still probably ask for the lines to be broken down so I can make sense of it. Because I would still honestly want to understand it, and in some ways that's even preferable since looking at all these individual pieces don't mean a whole lot to me. Seeing how they all interconnect with each other and how they're used in relation to each other; getting a picture of how the system as a whole works first and how it depends on the individual factors, before going into the details of each individual part... Unfortunately I'm more of a top-down sort of learner. The kind of person that takes apart toasters and controllers and other little devices and seeing how all the guts overlap first, inferencing the cycle of electricity and where it comes from and where it goes, and then pulling up the internet to identify the mystery doohickeys and add more to the "map."
It sounds counter-intuitive I'm sure, if anyone can even make sense of this rambling to begin with. I've always struggled with trying to explain things; there's probably a far simpler way to put this that I'm just not seeing.
This post has been edited by Ninety-Six: 19 April 2018 - 11:39 PM
#8 Posted 20 April 2018 - 02:24 AM
state checktroophit ifaction ATROOPSUFFERING { stopsound LIZARD_BEG sound PRED_DYING cstat 0 strength 0 action ATROOPSUFFERDEAD break }
All you have to do is change "ATROOPSUFFERDEAD" to "ATROOPDEAD".
#9 Posted 20 April 2018 - 02:52 AM
Trooper Dan, on 20 April 2018 - 02:24 AM, said:
state checktroophit ifaction ATROOPSUFFERING { stopsound LIZARD_BEG sound PRED_DYING cstat 0 strength 0 action ATROOPSUFFERDEAD break }
All you have to do is change "ATROOPSUFFERDEAD" to "ATROOPDEAD".
I actually remember finding this during my previous attempt. Funnily enough I almost tried exactly what you suggested. Almost. But I wasn't sure what "ATROOPSUFFERDEAD" truly was, and I was afraid I was going to nix the entire suffering state entirely (since I do like the idea of them potentially coming back if you fail to kill them in time, such as if you pipebomb them from beneath a window or get caught up fighting something much more urgent.)
As forewarned, I'm going to ask what this means. But I'm going to try and break this down myself first. Correct me where I screw up:
"state checktroophit" Seems simple enough. It's a check run when it's...wait. If it's checking if it's hit, but this triggers on a potential death, then how...? (At least I think that's how that's always worked?)
stopsound LIZARD_BEG
sound PRED_DYING
Stop the choking sound, play the death sound. Though I noticed this doesn't trigger sometimes. I've always wondered if that was perhaps a clue if they were going to get up, but looking at this code I suppose not?
I don't know what cstat is, so this I will cross-check... And I return with a question. What if it's a number not listed, and why are the numbers in exponents?
Strength...I would assume that would be health, and I would assume 0 means invincible, but then how can they be gibbed?
action ATROOPSUFFERDEAD. I actually tried to find the code in the GAME.CON for this one on the last go, but the sheer length of it combined with the 40 million if statements kinda made my brain melt. I was trying to figure out at what point the decision to resurrect or not was made, but I had such a difficult time deciphering the statements I couldn't be sure if it actually was, or if it called on a later function. Even now I can't seem to locate the point at which it's determined, because I was led to believe it was determined by RNG, and I don't see where the random function is... (It's probably there and I just didn't/don't know what it's called. Even if the function isn't in the con itself surely it must be called somewhere, right?).
So does this mean ATROOPSUFFERDEAD is a completely different state from ATROOPDEAD? Does that mean the RNG is called on twice somewhere that I can't find? Also is this for the green or red trooper? Or are they the same? Why does the code change allow it to be shot and dead for real, but to run its course if left alone? Or is that not what this does?
Does this code imply the irrelevant killshot was an oversight or an intentional design decision?
EDIT: I just found something.
state troopsufferingstate ifactioncount 2 { ifrnd 16 spawn WATERDRIP ifactioncount 14 { stopsound LIZARD_BEG cstat 0 strength 0 action ATROOPSUFFERDEAD break } } ends
What is this and why is it both similar and different?
This post has been edited by Ninety-Six: 20 April 2018 - 03:01 AM
#10 Posted 20 April 2018 - 03:21 AM
Ninety-Six, on 20 April 2018 - 02:52 AM, said:
It does.
#11 Posted 20 April 2018 - 03:28 AM
Fox, on 20 April 2018 - 03:21 AM, said:
So that was a clue? Where is that in the code? I don't see it, unless it's somewhere else...
This post has been edited by Ninety-Six: 20 April 2018 - 03:29 AM
#12 Posted 20 April 2018 - 03:43 AM
http://wiki.eduke32....ll_command_list
No guesswork needed!
If you understand what the commands do, the main additional thing you need to understand in this case is that "state checktroophit" is a subroutine that only executes when the liztroop has been hit by a weapon. Search the code and you will find that after the state is defined, "ifhitweapon" is always the trigger for "state checktroophit".
#13 Posted 20 April 2018 - 03:47 AM
Trooper Dan, on 20 April 2018 - 03:43 AM, said:
http://wiki.eduke32....ll_command_list
No guesswork needed!
Well I mean I did do that for a few of them, but they don't exactly answer my questions. Like strength doesn't explain what zero is or why they're gibbable.
Trooper Dan, on 20 April 2018 - 03:43 AM, said:
I don't follow.
#14 Posted 20 April 2018 - 02:04 PM
Ninety-Six, on 20 April 2018 - 03:47 AM, said:
Realistically, you have to be familiar with basic programming concepts like what a subroutine is, or else you aren't going to be able to make much progress on Duke 3D scripting. I don't know how I could make my post easier to read.
#15 Posted 20 April 2018 - 02:47 PM
Trooper Dan, on 19 April 2018 - 09:55 PM, said:
I also learnt a lot by changing hard to understand values here and there to see what happens, but I don't know if it's the best way to learn...
By the way:
Ninety-Six, on 19 April 2018 - 11:35 PM, said:
This post has been edited by Perro Seco: 20 April 2018 - 03:19 PM
#16 Posted 20 April 2018 - 03:33 PM
Trooper Dan, on 20 April 2018 - 02:04 PM, said:
What I don't understand is how it's triggered on hit instead of kill.
#17 Posted 20 April 2018 - 09:31 PM
#18 Posted 20 April 2018 - 10:00 PM
Ninety-Six, on 20 April 2018 - 03:28 AM, said:
Here:
ifaction ATROOPSUFFERDEAD { ifactioncount 2 { ifrnd 64 { resetcount action ATROOPPLAYDEAD } else { soundonce PRED_DYING action ATROOPDEAD } } }
#19 Posted 20 April 2018 - 10:20 PM
Trooper Dan, on 20 April 2018 - 09:31 PM, said:
So it calls on this both for normal hits and begging hits?
@Fox: Huh. So if they make the sound, they aren't faking it. I never knew that...
How is the outcome determined? I don't see where it calls on RNG here, unless that's done elsewhere.
#20 Posted 01 June 2018 - 03:12 PM
Trooper Dan, on 19 April 2018 - 11:02 PM, said:
https://forums.3drea...ead.php?t=16801
Good read, I can't get over the fact that you showed up on the Duke modding scene and made Weapons of mass destruction in your first 3 months, awesome. Did you have much coding experience beforehand?
This post has been edited by Drek: 01 June 2018 - 03:13 PM
#21 Posted 01 June 2018 - 03:29 PM
Drek, on 01 June 2018 - 03:12 PM, said:
I took a few programming classes as an undergraduate in the early 90's, but I never did anything useful with that knowledge. By 2006 I was at the tail-end of my grad school/teaching career and also had training in formal logic as part of the philosophy department that I was in. I still cling stubbornly to Duke modding as a hobby and have not attempted to expand my coding knowledge much beyond CON scripting.
#22 Posted 07 June 2018 - 10:36 PM
#23 Posted 07 June 2018 - 11:10 PM
Jimmy, on 07 June 2018 - 10:36 PM, said:
Holy shit, I remember reading through those examples in 2006 and finding them to be very useful (and of course they were already quite old at that time). In fact, they are the best of the old guides imo. Pity we have to use the wayback machine to read them now.