[TOT] Fading Lights 2 Concepts Page (Medievel Nerds Wanted and Welcome!)

Discussion in 'Civ2 - Scenario Creation' started by Konig15, Sep 7, 2021.

  1. Konig15

    Konig15 Warlord

    Joined:
    Nov 4, 2007
    Messages:
    221
    Also while I have neglected on working on the map I have been doing research and it turn out Kings and Generals have been doing quite a the series on this time frame! and just been releasing videos so I got the wind in my back.

    Can you get units to spawn with no movement points on their first turn? Cause it's important for piracy patrol, If you're good at your job, you can intercept them before they can ravage your unit generators (and YES this makes patrol much more important). But I need both pirates and unit generators to not be able to move first turn so the logistics of a coast guard as well as a navy come into play. A huge part of the sapping of the Byzantine economy, and while the Niceans desperately needed a Navy to defend against the Italian Republics in order to throw off their economic dominance they also needed an anti-piracy force to not have to ask for Italian help in not being robbed by often Italian pirates. They needed time to do that and they ran out historically.

    But this requires spawning in units with zero movement first turn.
     
  2. Prof. Garfield

    Prof. Garfield Deity Supporter

    Joined:
    Mar 6, 2004
    Messages:
    3,709
    Location:
    Ontario
    The way TOTPP Lua works is that there are certain points "execution points" in the game where the Lua interpreter checks if there is any code to to run, and, if so, runs the code.

    The "goal" of an events.lua file is to register the code for an execution point. For most execution points, there is a command civ.scen.onTrigger to register a "function" (set of instructions), though some execution points in the Lua Scenario Template don't have their own register, but simply rely on another civ.scen register. Part of the reason for the template is to hide those details from the designer.

    In order to register a function for civ.scen.onTrigger, you have to have that function written. This will either be written before civ.scen.onTrigger, or within the civ.scen.onTrigger command, but not after (well, with some cleverness, it could be written after, but there isn't much point). We'll call this function the "onTriggerFunction".

    The onTriggerFunction is probably big and complicated, so it has "helper functions" to handle part of the code. These helper functions must also come before onTriggerFunction. In fact,importantHelperFunction might come far before onTriggerFunction, since it is also used for onOtherTriggerFunction, which has been defined in the events before onTriggerFunction.

    In some sense, what this means is that if the events are in a single file, the "big picture" stuff is towards the bottom, while a lot of disjointed details are closer to the top. If the events are spread out over multiple files, the "top of the file" is likely to include multiple other files.

    Why don't we start with a different real example? In my original lua lessons and the re-write I started I start with empty events and build up from there, explaining what I'm doing.

    I would hazard to guess that we didn't reject advice out of hand. I have written lessons attempting to explain how to program, starting from basics. Maybe I did a poor job, but you don't seem to have even tried to use the resource. At the very least, you haven't asked for an explanation/clarification on anything there. Instead, you're looking into scenarios which weren't written with teaching new people in mind (Boudicca's a bit of an exception, but still not a good place to start), and complaining you don't understand stuff. Just as Knigttime predicted:

    Sorry, but I'm not willing to give you personal audio lessons. I've suggested a video tutorial, and even a different programming environment when you had trouble installing the one recommended in the video. I think we're at the point that if you don't like my advice, you're going to have to find some way to learn some Lua on your own, and later we can talk about the specifics of Civ II Lua once you have the basics. Or, you can design your scenario in the macro system, and ask someone to do a couple of Lua events for it when it is otherwise complete.
     
    Dadais, Knighttime and Civinator like this.
  3. Knighttime

    Knighttime Prince

    Joined:
    Sep 20, 2002
    Messages:
    312
    I can't speak for anyone else, but personally I have taken quite a few semesters of college courses in computer programming, and writing scripts has been a major part of my job for years -- it's not just a part-time hobby. I had never used Lua until I learned it for Civ2, but it's far from my first programming language... maybe about the tenth or so?

    My point isn't to give myself an award, but to say that your expectation of being able to read through and understand the Napoleon events probably isn't reasonable at this point. That's OK, and this isn't an insult in any way whatsoever -- I'm just saying that you're not being fair to yourself, by tackling that as a first step.

    I think I could sit down with a second- or third-grader and explain Macbeth to them, line by line, and they would eventually understand most of it. But that doesn't mean it's appropriate reading material for them at that point in their education. Again, this isn't a put-down -- I'm trying to help you recalibrate your expectations so you end up less frustrated and begin enjoying the process of writing basic scripts, because that's the foundation you need. The Napoleon events will make a lot more sense to you later, if you follow the recommendations we keep repeating about starting with the lessons from Prof. Garfield, or seeking out other sources of material intended for people who are new to programming.

    If you're creating the units yourself in a Lua event, sure -- it only takes one extra line of code, inserted right after you create each unit, something like:
    unit.moveSpent = unit.type.move

    If you're talking about barbarian units that spawn automatically (driven by the default game engine) then this is still possible, but it's going to be a little trickier. The command you'll use is the same, but finding the right unit(s) to apply it to will be the bigger challenge.
     
    Last edited: Oct 29, 2021
    Civinator likes this.
  4. JPetroski

    JPetroski Deity

    Joined:
    Jan 24, 2011
    Messages:
    4,077
    I would just throw in there that even though I believe I was one of the first non-coding people to really embrace this system (I think 3 or 4 years ago at this point), I still routinely reach out here or privately for advice. I have reached a point where I can occasionally build something "from scratch" that isn't too complex, but I'm still an absolute novice in the grand scheme of things. This is not an easy thing to grasp. As Knighttime said, do not let yourself get discouraged. Really it wasn't until Cold War that I finally felt like I was getting the hang of things (and that was after working on Caesar, Midway, and OTR -- well, following along really with OTR and Caesar, but trying to "add value" and usually messing something up along the way). It's going to take you some time.

    I will admit, when I was first learning, I had to be gently reminded by Prof. Garfield that I should look at his lessons in more detail. I can be honest with everyone here - I wanted to jump right into the exciting stuff and not go through it. That was a mistake on two levels:

    1. The lessons actually are quite helpful, especially once you get two or three modules in.
    2. If I wasn't willing to utilize the resource folks had put considerable effort into before asking questions, why then should they put even more effort into answering other things?

    At one point (sitting at a boring kids party lol) I decided to crack open my phone and really start reading through them. This provided a good baseline and also gave folks confidence that I'd put in the effort on my end.

    I would definitely suggest you put yourself through the lessons before anything else. It may open doors for you.

    More importantly however, starting with lua is kind of putting the cart first. How is the scenario itself coming? They are not that easy to build in the first place! I'd start there and then on paper organize what you roughly want the events to look like and then after doing the lessons, if you gave us a blue print, we might be able to show you the template and give you a better idea of where to plug things in, as well as some examples from prior works to get you started. Most of your events (aside from turn/text I suppose) are going to be purely academic until you have an otherwise working scenario, anyway.
     
    Civinator likes this.
  5. Konig15

    Konig15 Warlord

    Joined:
    Nov 4, 2007
    Messages:
    221

    Oh terrible. RL issues, namely a busted-ass mattress and back pain and constant sleep deprivation for months have screwed everything up! BUT the new Purple came last night and I see the Good Professor posted the first lessons so MAYBE I can make a go.

    I got that BEAUTIFUL map, I can't do anything with it on a first draft. I'm gonna have to "learn to code" and basically experiment on the pre-built Basil II map which I'm gonna have to tear down and rebuild from the ground up as far as units and tech tree but that's OK.

    See the thing is, I tried the Beyond Earth Demo and I loved it and I realized I halfway want to rebuild Civ 2 mechanics, and it's absolutely necessary to do the Fading Lights period justice. This is a society being cherry-tapped to death, and you can't have easy logistics and understand the fall of the Byzantine Empire. Short of making the AI extra pillage-y and it will pillage anything it comes across as top priority I need to build a logistics system dependent on a lot of harvesting units. And frankly, this is an important concept going forward the Fallout and World War II scenarios because of raiders and partisans respectively.

    A lot of this stuff would be easier to do in Civ 5, maybe Civ 4 but I haven't played it but here I have Lua, a guy who can make eath maps right quick and a four map structure. Also, a base that LIKES scenarios, which I'm not sure exists for Civ 5, but I know exists for Civ 4. But right now the four map structure is DEFINATELY the best selling point.
     

Share This Page