Jump to content

(wip) modder diary


Recommended Posts

Thanks to this lovely community, I have learned how to do two things so far:

I can put a new item into an existing container...

COPY ~aleph4/copy/f4blunf2.eff~ ~override/f4blunf2.eff~
COPY ~aleph4/copy/f4blunf1.itm~ ~override/f4blunf1.itm~
    SAY NAME2 @1001
    SAY UNIDENTIFIED_DESC @1002

COPY_EXISTING ar2617.are override
    LAUNCH_PATCH_FUNCTION ADD_AREA_ITEM
        INT_VAR
        container_to_add_to     = 2
        STR_VAR
        item_to_add             = "f4blunf1"
    END
    BUT_ONLY

... and I can change all indoor areas to allow resting

COPY_EXISTING_REGEXP "^.*\.are$" override
    READ_SHORT 0x48 type                        //    location flags
        PATCH_IF (type = 0) BEGIN                //    all 0 = indoors with no rest
            WRITE_BYTE 0x48 (type BOR 0b10000000)    //    indoors can rest
END

Gratitude to the many authors and maintainers of mods and tools hosted here.

I welcome any feedback!

Edited by Awachi
Link to comment

Area type is a 32-bit field, interpreted as flags. That should really be a READ_LONG and a WRITE_LONG.

Fortunately, only the first seven bits are actually used - so reading 16 bits and writing 8 shouldn't actually break anything. The rest of the field is all zeros, before and after your action. At least in the standard game.

Link to comment

Far out.  I'm checking and modifying "location" in the ARE file at 48 (size 2), not "area type" at 14 (size 14).  14 does have a rest toggle, but since I have to read 48 anyway to make sure it's actually indoors, since the default position of 14 is to allow rest, but with 48 as indoors, not allowed occurs.  The weird part was converting to binary to figure out where to put the 1 for the BAND/BOR (which I also switched initially).  The example in weidu was much more confusing, though, being usability for items.

  

10 hours ago, CamDawg said:

One of us! One of us!

Congrats!

Yus. I don't know what I'm going to do with all these new powers. Probably better to start at lowest expectations.

 

Next up is cycling through Actors and only enabling rest if hostiles are part of the area (at least for a little while).  Don't want every indoor available, but the ones where you clear enemies should be.

Edited by Awachi
Link to comment

Ah, a different spot. That one's a 16-bit flag field, with only the first eight bits used. Your original code should technically work, but mismatched read and write operators are never good practice.

I do wonder what happens when the "area type" flags and the "location" flags don't match each other - which sets get used for which purposes?

As for the next thing you're trying to do ... not all enemies you fight are pre-placed actors. Spawn points in the area (aka what most BGEE wilderness enemies come from) and enemies spawned by the area script or "traps" are also a thing. As are creatures that start neutral but go hostile after a chat.

Link to comment

I saw I was editing just the first 8 bits, but luckily in this case the next 8 are present but unused.  I haven't tried setting up conflicting flags, but if it's like all the off-hand stuff in ITMs, it probably does either nothing or one is clearly the dominant.

Yeah, there's more than enough "bad guy starts neutral then attacks after dialog" that the labor to find out would be purely for academic reasons.  The goal was just to allow resting in more places, and I'll just leave it up to the player to RP whether it should happen in those less obvious instances.

i appreciate the comments!

Link to comment

Tthere are quite a few opcodes that block other opcodes, and while I think that's convenient, I wonder if it limits creativity.  Maybe I want to be able to "freeze" an enraged berserker.  What kind of opcode contortions would I have to perform in order to simulate the currently forbidden "Hold"?  Reduce movement and attacks to 0?  Should all level draining be protected against, regardless of source?  It's too bad the offensive side of these attacks weren't parsed out more finely, so that defenses against could be more flexible.  It would be cool if a spell could reduce the levels drained instead of all or nothing.

Edited by Awachi
Link to comment
1 hour ago, Awachi said:

What kind of opcode contortions would I have to perform in order to simulate the currently forbidden "Hold"? 

There are three Hold opcodes, and two movement change opcodes, I presume just for this reason. I haven’t checked specifically but I’m guessing opcode 185 can freeze a Berserker. (It’s what is used in Hold Undead, because most undead are immune to normal Hold effects.) The ‘pause’ opcode, 165, can also probably freeze Berserkers.

Link to comment

Oddly enough, a barbarian in his rage is immune to opcode 185, but an enraged berserker isn't.

However 185, like 175 has a hardcoded string and glow effect attached, and some mods that touch spells and items granting Free Action might patch those against it.

So far as I know nothing grants immunity to 165, but even though the character's animation appears frozen in place and can't act they nonetheless retain their AC and are not autohit like stunned/held/unconscious targets. Of course you can tack on whatever AC penalty you like as a secondary effect but it won't be removed by the opcode 270, unpause target if you want it to be curable, you'd need to complicate things with removal of effects by secondary type (I try to avoid this) or by opcode 321 on the EE engine.

Link to comment

I'm quite interested in not having to perform coding gymnastics. It's certainly fun to read how the modding Olympians do it, though. 

Link to comment

Reading some of the older posts. 

1. It's funny and tragic to see the rise and fall in activity of any particular modder. 2018 saw the departure of quite a few. 

2. Disagreements can lead to really good solutions, sometimes better than a dictatorial approach. It always sucks when someone takes criticism of their work personally. On the other hand, occasionally a singular vision is by far the best way to get the job finished, particularly with mods of a grander scale. 

Link to comment

One of my rules of thumb for determining if a mod will be good is whether the author is willing to listen to criticism. Someone who's taken the time to criticize--even if done harshly--is someone who's invested into your mod. It's worthwhile to engage and find out why, as it will (at the least) make you think through some parts of your mod and gradually lead to being a better modder, producing better mods.

Link to comment

I don't know the origin, but one of my favorite quotes is "imagine how much could be achieved if no one cared who got credit". Of course, that only works in Utopia, but still a nice thought about ego and creativity. 

I forsee engine problems, and probably quest breakage, but I want to try introducing disguises, both through a rogue ability and an Illusion spell. I remember the first time I played ToB, and the guards in the desert town all had unique armor. I was really excited because I thought I might get to bluff my way into the fortress by having my party don that armor. Alas, it was just meaningless detail. 

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...