Home » MODDING HQ 1.13 » Flugente's Magika Workshop » Absurdly small code changes  () 1 Vote
Re: Absurdly small code changes[message #353694 is a reply to message #353657] Wed, 06 June 2018 00:00 Go to previous messageGo to next message
Flugente

 
Messages:3334
Registered:April 2009
Location: Germany
A somewhat obscure error: the stis for faces are numbered as face index.STI. If the face index is < 100, we use 2 digits, otherwise 3. But as that check was on the profile index instead of face index, if you used a profile >= 100 with a face index < 100, the game looked for, say, 051.STI instead of 51.STI, and thus found no file Bang head

Fixed in r8569.



“What are you doing?” Joffrey interrupted him.

“… can’t a man give a few last words for his son to carry?”

“…Who told you your son was making it out of this field alive?”

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #353722 is a reply to message #353694] Sat, 09 June 2018 22:44 Go to previous messageGo to next message
Flugente

 
Messages:3334
Registered:April 2009
Location: Germany
Part of the game code is a huge array that stores so called Facts. These are a sort of 'notes', mostly to store quest-related data (Did we give Madlab a video camera? Has Steve heard about us rescuing Joey? Which whores are available?). We use them in the code, in lua
Toggle Spoiler

and also in NPC scripts, set in .npc files. The important thing I want to draw attention to is that NPC conversations also set facts. This makes sense when you think about it, most NPCs have some long dialogue over several files that they never repeat. This is achieved by setting a fact.

Unfortunately, these facts set for conversation purposes are not listed inside the code. This is bad if, say, some dashing young coder comes along, codes something which needs a fact, sees in the enum that a number is still 'free' and then uses that number, unaware that some NPC conversation also evaluates that flag or sets it. Possible results range from NPC never says a few lines to I talked to Dimitri, that suddenly triggered all the rebels, and now my team is dead in the rebel basement ten minutes after gamestart.

Luckily this hasn't occured until now, Sirtech avoided that and just didn't list these numbers, the lazy gits. My code additions also don't do that, because I'm lucky awesome.

I've gone over all the stock .npc files in r8570 and added all relevant numbers to the enum in Quests.h. Below are now the known facts:

Toggle Spoiler


Q: I am a coder who wants to code new quest stuff. What does this mean for me?
A: Hu. Where have you been all these years, you lazy bastard? Whatever. Don't use the numbers already used in the array above and you're good (and add whatever facts you are introducing).

Q: I am a modder and have added new NPCs or altered existing .npc files in my mods. What does this mean for me?
A: Check whether any of your .npc files (not the one in stock, I've checked those and added what was missing to the above array) for usSetFactTrue (or called sth. similar). If that number is neither 0 nor 65535, check whether that number is in conflict with the above. If it is already in use, move it (not necessary if you replaced the original NPC that set it, duh).

Q: I am a player. What does this mean for me?
A: Nothing, unless the modder of a mod you play tells you otherwise. In case this inexplicably saddens you, here is an owl to distract you.

[Updated on: Sun, 10 June 2018 10:29]




“What are you doing?” Joffrey interrupted him.

“… can’t a man give a few last words for his son to carry?”

“…Who told you your son was making it out of this field alive?”

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #353724 is a reply to message #353722] Sun, 10 June 2018 11:19 Go to previous messageGo to next message
townltu

 
Messages:175
Registered:December 2017
Location: here
Question arises about the maximum number of such global variables in JA2?

Wiz 8 has a limit of 1000, that was overcome by madgod's dll injected code,
it makes the game read a fact's byte value instead of the simple 00h/01h on/off function,
for npc scripts it means 1 fact allows more fact conditional operations
than all the 193 remaining free slots in Wiz8 npc.dbs did before.
(his code also extended the .dbs limit, but only partially for not_alive_npc)
Additionally a modder desperatly needing more facts
could revamp the vanilla use_only_npcScript facts to free more fact slots for alive npcs.



Btw, whoever worked with madgod's Cosmic Forge Wizardry 6/7/8 Editor
will agree that the ja2 editor is an incompetent tool and modding even merely JA2 content is a mess.
Re: Absurdly small code changes[message #353725 is a reply to message #353724] Sun, 10 June 2018 12:48 Go to previous messageGo to next message
Flugente

 
Messages:3334
Registered:April 2009
Location: Germany
Eh... what? I didn't get half of that tbh.

The fact array currently has size 500. But I can simply increase the savegame version, expand that array and add a savegame conversion, as I've done dozens of times. This is no problem.



“What are you doing?” Joffrey interrupted him.

“… can’t a man give a few last words for his son to carry?”

“…Who told you your son was making it out of this field alive?”

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #353747 is a reply to message #353725] Mon, 11 June 2018 21:18 Go to previous messageGo to next message
Flugente

 
Messages:3334
Registered:April 2009
Location: Germany
As of r8571, facial animations are only deactivated if all 4 offsets (both eye and mouth) are 0. Up to now, animations were deactivated if <usEyesY> or <usMouthY> were 0, which isn't really a good enough reason in my book.



“What are you doing?” Joffrey interrupted him.

“… can’t a man give a few last words for his son to carry?”

“…Who told you your son was making it out of this field alive?”

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: Absurdly small code changes[message #353748 is a reply to message #316795] Mon, 11 June 2018 21:19 Go to previous messageGo to next message
sob1

 
Messages:12
Registered:June 2018
the logic strikes again! big grin

(I have to post a few inane messages before I can share my new IMP and other contribs in a Magika WS thread)



Dr. Phil as a playable comedy IMP: http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=353751&#msg_353751

Lawrence of Arabia as an IMP:

http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=353801&#msg_353801
Re: Absurdly small code changes[message #353749 is a reply to message #313946] Mon, 11 June 2018 21:20 Go to previous message
sob1

 
Messages:12
Registered:June 2018
Very interesting implications for crew-served weapons!



Dr. Phil as a playable comedy IMP: http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=353751&#msg_353751

Lawrence of Arabia as an IMP:

http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=353801&#msg_353801
Previous Topic: New (unofficial) mercs: The Ryder twins (Mass Effect: Andromeda)
Next Topic: Expanded Feature: Move militia in strategic map, part 2
Goto Forum:
  


Current Time: Mon Jun 18 18:00:15 EEST 2018

Total time taken to generate the page: 0.02347 seconds