How To Make An Oblige Lua Script, Squishing Bricks Edition

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.
User avatar
Kate
... in rememberance ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

How To Make An Oblige Lua Script, Squishing Bricks Edition

Post by Kate »

I was going to post this in Squishy's thread, but since this is good general knowledge material, I'm posting it here for archival purposes.

Since Oblige 3 has NO kek'n documentation whatsoever because the Earth is indeed flat and NOT round (God Damnit J.K.Rowling), I'm going to show you how to make a module myself. We'll start with the basics.

THE MODULE INDEX
We'll assume you made an empty file for this, because there is no better way to do it than to do it yourself. The first thing that's going to be required is the actual module's summary index. We'll toss it at the end of the file, like so:

Code: Select all

OB_MODULES["squishy_two_monsters"] =
{
    label = "Squishy Monster Cake 2",
    for_games = { doom2 = 1 },
    for_engines = { zdoom=1, gzdoom=1, skulltag=1 },
}
This is all that you will need for the most basic module, but it is very required, because we'll be adding to this for every new section we make. The key name (between the [ ] brackets) is an identifier (that means lowercase letters and _ only!) which is UNIQUE to your module. It needs to be different from any other module that it will co-exist with.

The Label field is the name of your module. Make it short but descriptive, it is usually the name of your mod. This is what people will see when they load up your script into Oblige. If you cuss here, other people will see it and know who to blame.

The for_games field is 100% self-explanatory. It names the games that your mod supports, in this case Doom II. The for_engines field is also self-explanatory, in this case which ports the mod runs with. In this case, ZDoom, GZDoom, and Skulltag.

MONSTERS
Now let's do the most basic of basics, and tell Oblige about our cool new monsters, otherwise they won't show up in maps and it'll be normal! There must be so many new monsters that I cannot see the regular monsters anymore! First we need to make a MONSTERS table, and put at least one monster in it. Let's take the, hmm, Dimensional Master first.

Code: Select all

SQUISHY_MONSTERS =
{
    dimensional_master = -- Monster's identifier. This must be unique per monster, obviously, just like in Decorate.
    {
        -- Chance of appearing per room. 20 makes them fairly rare.
        prob = 20,
        -- Total health of our new monster, in HP. This sucker has so much HP it makes the Cyberdemon blush.
        health = 12000,
        -- Damage our monster does. Note that this is *per second*, so it can be higher than the basic attack's damage if it attacks more than once per second (eg. Chaingunners). He'll kill you just by looking at you.
        damage = 700,
        -- The type of attack our monster uses. Choices are "missile", "hitscan", or "melee". We only tell Oblige about the most likely attack it is to use. Never use melee unless there are really no ranged attacks at all. Missiles are easier to dodge, and thus less damage is done overall.
        attack = "missile",
        -- The amount of monsters that may appear in any given room. 1.0 spawns about 4 or 5 in every room, 0.1 makes them appear only once every 4 or 5 rooms. We want this sucker to be very alone, because he is very powerful.
        density = 0.1,
        -- A special field for annoying and powerful monsters. This is the chance out of 256 that they will just *not* appear at all in a level. We don't want to see dimensional masters very often, especially NOT every level because he is just that bad, so we make the skip chance rather high.
        skip_prob = 150,
        -- This is also special, this prevents the monster from being used more than any other monster in the level, a special case oblige tends to make on one monster for each level. We don't want to be taking on more than one dimensional master per room if it DOES appear, so let's be forgiving.
        never_promote = true,
        -- Tells Oblige that this monster gives ammo when you kill it. Ammo is the name and count is the amount of that ammo it gives. Note that it is also an array, so if a monster drops multiple ammo types, oblige will know and adjust accordingly.
        give =
        {
            { ammo = "dimensional_ammo", count = 1 },
            { ammo = "ethereal_ammo",    count = 1 },
            { ammo = "light_ammo",       count = 1 },
            { ammo = "dark_ammo",        count = 1 },
        },
    },
}
After we're done filling the array with 6 pages of monsters, we'll want to tell oblige critical information for putting the actual things for the monster in maps. We create the THINGS table just for this exact purpose.

Code: Select all

SQUISHY_THINGS =
{
    dimensional_master = -- This MUST be the same as the monster's identifier in the MONSTERS table.
    {
        -- ID is the DoomEdNum of the creature, after its' class name in the Decorate.
        id = 9397,
        -- The type of object. This is a monster.
        kind = "monster",
        -- The size of the monster, in (R)adius and vertical (H)eight.
        r = 20, h = 56
    },
}
Now Oblige needs to know what the new tables are called:

Code: Select all

OB_MODULES["squishy_two_monsters"] =
{
    label = "Squishy Monster Cake 2",
    for_games = { doom2 = 1 },
    for_engines = { zdoom=1, gzdoom=1, skulltag=1 },

    tables =
    {
        "monsters", SQUISHY_MONSTERS,
        "things",   SQUISHY_THINGS,
    },
}
WEAPONS
What's a mod without new weapons? I've heard at least ten people complain on this forum alone that they hate the original weapons by now, so let's mess with them for kek'n science!

The first vital thing is to know how to remove weapons. Since we want to nuke ALL of the weapons from the regular maps, let's just name all of the doom weapons:

Code: Select all

SQUISHY_WEAPONS =
{
    berserk = REMOVE_ME,
    saw = REMOVE_ME,
    shotty = REMOVE_ME,
    super = REMOVE_ME,
    chain = REMOVE_ME,
    launch = REMOVE_ME,
    plasma = REMOVE_ME,
    bfg = REMOVE_ME,
    pistol = REMOVE_ME,
}
That's it! The special value REMOVE_ME tells Oblige that the weapon doesn't exist anymore and it should not consider ever using it. It is permanently removed from the game as far as the generated maps are concerned. They can still appear in pre-built maps, which are instantly recognizable.

Now, let's add some new weapons. Below the slew of remove-me's is where the new weapons go. Now let's look at a definition:

Code: Select all

ultraslow_plasma =
{
    -- Weapon preference. This is how much we prefer to give ammo for this weapon over other weapons.
    pref=85,
    -- Probability of adding. The higher this is, the earlier and more likely the weapon is to appear in the middle of the level. If we omit this, we will not consider putting it down in the middle of a level.
    add_prob=20,
    -- Same thing as above, but this is how likely the weapon is to show up in the start room with you. If we leave this out, Oblige will refuse to put this weapon in the start room.
    start_prob=10,
    -- Rate and Damage are linked. Rate is how many shots you can take in a second, and damage is how much damage each shot does directly to one monster. The total damage you can do with this weapon is basically (rate * damage), assuming perfect accuracy. Oblige knows better though.
    rate=1,
    damage=70,
    -- This is a special sort of field. If the gun has the ability to inflict damage upon more than one monster at once, this tells Oblige about it.
    splash={60,45,30,30,20,10},
    -- The kind of attack.  Choices are "missile", "hitscan", or "melee". It's the same field as in monster definitions above. Again, we only take the most powerful offensive attack into account, and ignore the alt-fire if there is one.
    attack="missile",
    -- The ammo that this weapon uses. This will be discussed a bit later.
    ammo="cell",
    -- How much ammo each shot of this gun uses. For example, one shot of the BFG uses 40 cells.
    per=10,
    -- Rarity is a special field. It is similar to skip_prob for monsters, in that it makes a weapon not appear in a level. This is a divisor though, so a weapon with rarity 5 will only have a 1 in 5 chance of appearing in any given level.
    rarity=2,
    -- How much initial ammo the weapon's pickup gives. Feel free to omit this if you start with the weapon.
    give={ {ammo="cell",count=20} },
},
Notes: If there's no add_prob and no start_prob, then Oblige will NEVER put this weapon down in a level. Period. This is useful for weapons that the player already starts with, like the fistol (It's like a pistol that fires fists!).

Now let's tell Oblige that we have a new starting weapon as we removed the pistol:

Code: Select all

SQUISHY_PLAYER_MODEL =
{
    doomguy =
    {
        stats   = { health=0, bullet=0, shell=0, rocket=0, cell=0 },
        weapons = { fist=1, ultraslow_plasma=1 },
    }
}
Special case note: If we have more than one class with different start equipment, we tell the generator that we have all classes' starting weapons, this will make it put down starting ammo for all of them.

We add the new tables to the module index with the following lines:

Code: Select all

    tables =
    {
        "monsters", SQUISHY_MONSTERS,
        "things",   SQUISHY_THINGS,

        "weapons",  SQUISHY_WEAPONS,
        "player_model", SQUISHY_PLAYER_MODEL,
    },
AMMO AND POWERUPS
But wait! We told Oblige earlier that there are new ammo types! We'll need to alert the generator about what these ammo types or it'll be all confused and weird-like! Let's make an AMMOS table for immediate rectification of this emergency.

Code: Select all

SQUISHY_AMMOS =
{
    dimensional_ammo = { start_bonus = 5  },
    ethereal_ammo    = { start_bonus = 5  },
    light_ammo       = { start_bonus = 20 },
    dark_ammo        = { start_bonus = 10 },
}
Start_Bonus is a required parameter, it means “If we put down this sort of weapon in the start room or the player has this weapon at the start, we want to put down this much ammo for it so they won't be stuck and unable to kill” (and then the radio crackered to life...)

And since we changed the ammo that the player can has, we tell the game about it by changing the stats accordingly.

Code: Select all

SQUISHY_PLAYER_MODEL =
{
    doomguy =
    {
        stats   = { health=0, cell=0, dimensional_ammo=0, ethereal_ammo=0, light_ammo=0, dark_ammo=0 },
        weapons = { fist=1, ultraslow_plasma=1 },
    }
}
We actually lie and say the player has no health or ammo so that the generator will place down the ammo bonuses and some extra medikits in case the player started the level with 2HP and no ammo and needs some quick healage and upgrades.

Now we'll need to do some maintenence to tell Oblige more about these ammo types, particularly how we acquire more ammo from the map. We update the THINGS table to add their physical devices. Let's assume there are two dimensional ammo pickups, big and small, which give 5 and 1 respectively, their doomednums being 9021 and 9022.

Let's also make a new powerup and call it the LOLSphere. It has doomednum 31337.

Code: Select all

    dimensional_ammo_big =
    {
        id = 9021, kind = "pickup", r = 20, h = 24
    }
    dimensional_ammo_small =
    {
        id = 9022, kind = "pickup", r = 16, h = 16
    }
    lolsphere =
    {
        id = 31337, kind = "pickup", r = 20, h = 56
    }
Note how I now use "pickup" as the type.

And now, powerups! This is a truly gross hook--err hack. Since Oblige doesn't properly support placing down powerups as secondary search items, we will tell Oblige that they're worth health! I know, it's a very ugly method of doing things, but it works! Because typically those powerups are gonna save us health anyway by allowing us to kill enemies or evade their attacks better, so it's true.

NOW we will make a new table called PICKUPS to handle stuff we can grab off of the floor, how disgusting. Let's tell Oblige about all three of our super duper pickups.

Code: Select all

SQUISHY_PICKUPS =
{
    dimensional_ammo_big =
    {
        -- The probability that this pickup will be used over other pickups that give the same ammunition.
        prob = 10,
        -- The main statement. This is what the pickup is expected to give you. Possible choices are ammo and health. Both are self-explanatory.
        give = { { ammo = "dimensional_ammo", count = 5 } },
    }
    
    dimensional_ammo_small =
    {
        prob = 40, -- Prefer small pickups over large ones
        -- This makes oblige prefer to put down this many pickups in a row, rather than just spreading them all over the room willy-nilly. the syntax is { min, max }, which makes oblige only put down between min and max items per spot.
        cluster = { 1, 4 },
        give = { { ammo = "dimensional_ammo", count = 1 } },
    }
    
    lolsphere =
    {
        prob = 2 -- Powerups should always be RARE.
        -- If this is true, then the item will be treated like a powerup and placed in the center of the room if possible instead of being thrown to the side like ammo where it's harder to pick up.
        big_item = true,
        -- If this item gives health, then we need to know if it can save us if we have *no* health. If armor is true, then we will prefer to not use this item when the player is guaranteed to have low health. Generally you want this to be true for powerups unless it can actually save you from imminent death, like Invulnerability.
        armor = false,
        -- Let's pretend this item gives you 120% extra HP. Note that this will make health NOT appear normally otherwise, so be sparing with it. Higher values will make the item more rare along with prob, so it will take tweaking to make a good powerup.
        give = { { health = 120 } },
    }
}
Now that we have the fields needed to tell the game we have new pickups, let's tell Oblige of the new tables.

Code: Select all

    tables =
    {
        "monsters", SQUISHY_MONSTERS,
        "things",   SQUISHY_THINGS,

        "weapons",  SQUISHY_WEAPONS,
        "player_model", SQUISHY_PLAYER_MODEL,

        "ammos",    SQUISHY_AMMOS,
        "pickups",  SQUISHY_PICKUPS,
    },
And that wraps it up for gameplay-modding Oblige. If you followed the comments and have everything arranged in the proper order, you should be able to save the lua script in the mods/ folder of Oblige, and it should appear in the right-hand list if all went right. Check it and make sure to build a test level to make sure everything is working before releasing your stuff and have fun.

If there are any comments and questions, feel free to post and I'll try to clarify anything that needs clarifying. This is only a basic gameplay modding tutorial and does not go over texture selection and what not, but if it is requested enough, I'll write one for that as well.
Last edited by Kate on Thu Apr 07, 2011 8:44 pm, edited 2 times in total.
P1ayer27
Posts: 203
Joined: Fri Aug 14, 2009 10:05 pm

Re: How To Make An Oblige Lua Script, Squishing Bricks Editi

Post by P1ayer27 »

WOW I don't have a reason, or enough time, to read this. But if you're posting it here for archiving purposes, wouldn't the wiki make more sense? Also, great job going into detail, from what I read at least.
User avatar
Kate
... in rememberance ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Re: How To Make An Oblige Lua Script, Squishing Bricks Editi

Post by Kate »

P1ayer27 wrote:wouldn't the wiki make more sense?
Oblige has no wiki, and this is completely inappropriate to stick in the ZDoom documentation because it has nothing to do with ZDoom.

If it were something like How to make an extended MAPINFO, then yes, it would be useful there but this just doesn't really qualify.
User avatar
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey

Re: How To Make An Oblige Lua Script, Squishing Bricks Editi

Post by Zippy »

Pink Silver wrote:
P1ayer27 wrote:wouldn't the wiki make more sense?
Oblige has no wiki, and this is completely inappropriate to stick in the ZDoom documentation because it has nothing to do with ZDoom.

If it were something like How to make an extended MAPINFO, then yes, it would be useful there but this just doesn't really qualify.
It could possibly go on the Doom Wiki since Oblige is at least Doom related.
User avatar
Jimmy
 
 
Posts: 4720
Joined: Mon Apr 10, 2006 1:49 pm
Preferred Pronouns: He/Him
Contact:

Re: How To Make An Oblige Lua Script, Squishing Bricks Editi

Post by Jimmy »

The Doom Wiki is undergoing a move at the moment, though. :|
P1ayer27
Posts: 203
Joined: Fri Aug 14, 2009 10:05 pm

Re: How To Make An Oblige Lua Script, Squishing Bricks Editi

Post by P1ayer27 »

Pink Silver wrote:...it has nothing to do with ZDoom.
Off-Topic :\
User avatar
InsanityBringer
Posts: 3386
Joined: Thu Jul 05, 2007 4:53 pm
Location: opening the forbidden box

Re: How To Make An Oblige Lua Script, Squishing Bricks Editi

Post by InsanityBringer »

dropping it in a forum that autodeletes old threads? sounds like a great idea!
Gez
 
 
Posts: 17835
Joined: Fri Jul 06, 2007 3:22 pm

Re: How To Make An Oblige Lua Script, Squishing Bricks Editi

Post by Gez »

It's fine in this forum, plus everyone who makes custom oblige scripts do so to add beastiary/skulltag monsters anyway.
User avatar
Squishybrick
Posts: 190
Joined: Sat Jan 22, 2011 7:11 pm

Re: How To Make An Oblige Lua Script, Squishing Bricks Editi

Post by Squishybrick »

Okay so.. Wait.. If my pickup/ammo/monster's name has a space in it, it's supposed to be replaced with a "_"?.. That was confusing me, because I never ever use spaces with the names.. I thought that wasn't allowed or something.. :o

Also, thanks for the info, though a tad arrogant, it serves it's porpose.. I really don't know/think anyone will take after my style of modding, what with the "too lazy to map so I crack the whip on oblige's back" way I do things.. But if anyone does, they'll know where to turn to now..

Lastly, I couldn't resist..
WOW I don't have a reason, or enough time, to read this.
Then why are you even here?!
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Re: How To Make An Oblige Lua Script, Squishing Bricks Editi

Post by FDARI »

I, of all people, should know better, but:
But if you're posting it here for archiving purposes, wouldn't the wiki make more sense? Also, great job going into detail, from what I read at least.
I'll put a bookmark on this thread anyway. I'm such a non-mapper.

EDIT: The above seems unclear upon review. My intention was to reveal the purpose of the half-quoted post; I quoted the half squishy didn't quote.
Last edited by FDARI on Sat Apr 09, 2011 2:03 am, edited 1 time in total.
P1ayer27
Posts: 203
Joined: Fri Aug 14, 2009 10:05 pm

Re: How To Make An Oblige Lua Script, Squishing Bricks Editi

Post by P1ayer27 »

InsanityBringer wrote:dropping it in a forum that autodeletes old threads? sounds like a great idea!
Sorry, I didn't know those threads were auto-deleted.
Squishybrick wrote:Lastly, I couldn't resist..*
WOW I don't have a reason, or enough time, to read this.
Then why are you even here?!
*Learn some self control.
User avatar
Squishybrick
Posts: 190
Joined: Sat Jan 22, 2011 7:11 pm

Re: How To Make An Oblige Lua Script, Squishing Bricks Editi

Post by Squishybrick »

Code: Select all

  -- weapons
 BlablaGun = { id=8300, kind="pickup", r=20,h=16, pass=true },
Don't forget you gotta do the same thing with weapons that you do with monsters.. You didn't tell me/us that... That confused me for a minute..

You just add this piece of code right under your list of monsters in the things category.. The "-- weapons" is just so you can find them easier..
Do the same with ammo, and powerups..
User avatar
Squishybrick
Posts: 190
Joined: Sat Jan 22, 2011 7:11 pm

Re: How To Make An Oblige Lua Script, Squishing Bricks Editi

Post by Squishybrick »

You also didn't mention how to make a selection interface thingy so players could CHOOSE the monsters they fight, like my previous mod had..

And another thing.. The dreaded towering wall that stands in the way of anyone on the path to oblige-ness from one time to another..

LUA script error:
...oblige\oblige 3.57/monsters.lua:1615: assertion failed!


[Edit]: Not the first parts, just the "Assertion failed" part.. Which apparently can mean various things.

At first, I was completely stumped and defeated by this, seeing as chris himself from oblige could not help me.. But then after some fiddling, I found
it was linked to making a few minor mistakes.. For some reason instead of telling you these mistakes, it gives you this error..
Oblige might as well just be flipping you the bird.. >:(

The only thing I've linked it to was making case-sensetive mistakes, for example, Typing "NormalAmmo" in the things category, but then accidentally typing "Normalammo"
in any other category involving that item...

But after double-triple-quadruple checking my current work, I've exhausted the possibility of case-sensetive mistakes, so apparently something else is causing this error..
Can you explain this?
Last edited by Squishybrick on Sat Apr 09, 2011 6:11 pm, edited 1 time in total.
User avatar
Kate
... in rememberance ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Re: How To Make An Oblige Lua Script, Squishing Bricks Editi

Post by Kate »

You didn't redefine the existing player model, you used new ones. You need to name the player model "doomguy" and that is the only one that you may have. Oblige 3 doesn't actually use multiple player models yet because it doesn't have proper Hexen support (which is needed to support multiple classes).
User avatar
andrewj
Posts: 2
Joined: Sun Apr 10, 2011 3:32 am

Re: How To Make An Oblige Lua Script, Squishing Bricks Editi

Post by andrewj »

As I've said before, OBLIGE isn't ready yet for user modding.

When it _IS_ ready, then there'll be documentation about it :P

I may even pinch this tutorial :wink:
Locked

Return to “Editing (Archive)”