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:3384
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:3384
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:217
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:3384
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:3384
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 messageGo to next 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
Re: Absurdly small code changes[message #354122 is a reply to message #353749] Mon, 23 July 2018 00:24 Go to previous messageGo to next message
Flugente

 
Messages:3384
Registered:April 2009
Location: Germany
Several things happened up to, say, r8577:

  • Fix: it was possible to create an IMP health < OKLIFE. Not a good idea, as they immediately land in a coma upon arrival.
  • When setting up autobandage, use first aid kits before using medkits. I always hated the fact that precious medkits were used up before first aid kits.
  • Fix: using a riot shield in a box fight disqualifies the boxer. Yes, this was possible before big grin
  • Fix: in rare instances, the face of the first merc hired was replaced with Skyrider. That took a while to find.
  • Fix: face gear was not shown for non-IMP mercs if their face index wasn't their profile number. Like, say, if one were to use the same face several times on a merc (now why would we do that ? cheeky )
  • Suppression now works in realtime outside of combat. This is both more realistic and is a requirement for a feature I'll pot, say, tomorrow or so.

[Updated on: Mon, 23 July 2018 23:58]




“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 #354140 is a reply to message #354122] Tue, 24 July 2018 23:51 Go to previous messageGo to next message
Flugente

 
Messages:3384
Registered:April 2009
Location: Germany
I discovered a rather annoying bug: It was possible to get the game to freeze when hovering over the savefiles in the save/load screen. This happened only in Release exes, and has me wondering why it doesn't happen all the time... anyway, fixed in r8586.



“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 #354199 is a reply to message #354140] Tue, 31 July 2018 23:03 Go to previous messageGo to next message
Toybasher

 
Messages:12
Registered:April 2018
Small change here (hence why I'm posting it here rather than make a new thread) but I think the wording of the surgery prompt ought to be changed. When I first played I (and likely other newbies) did surgery every time the game asked me and ran out of supplies.

The problem is the wording asks if you want to perform "necessary" surgery, (don't remember if it's only for multiple patients or one patient.) which implies the operation is pretty much mandatory and consequences may result if you decline.

Maybe changing the wording to something like "emergency surgery" or "field surgery" might be less confusing to new players.

Or flat out telling them "This action will rapidly restore health but is extremely inefficient on supplies. Are you sure?"

As mentioned the current wording seems to imply you have to do surgery everytime the game prompts you, when in reality it seems surgery should only be done when you are pressed for time and you need a mercs health restored as quickly as possible. (counterattack on the way, etc.)
Re: Absurdly small code changes[message #354202 is a reply to message #354199] Wed, 01 August 2018 22:22 Go to previous messageGo to next message
Flugente

 
Messages:3384
Registered:April 2009
Location: Germany
Fair enough. I've simply removed the word necessary in r8590, there was some text (on the trait description or so) that already stated it would drain supplies a lot.



“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 #354215 is a reply to message #354202] Sat, 04 August 2018 20:16 Go to previous messageGo to next message
ZedJA2

 
Messages:22
Registered:January 2018
Not sure where to post this error, so posting it here, move the post if needed.

This error was found in the latest SCI build from last Wednesday, SCI Revision 8589 on Game Directory 2430. It has probably existed for some time before this build.

In the DifficultySettings.XML file, in the TableData Folder, there is the following inconsistency:

Comments Descriptors say:

ChanceOfEnemyAmbushes : 0- false 1 - true

However, in the actual values in the various Difficulties values that are negative integers ( like -15) and positive integers (like + 5) exist.

Either the Descriptions in Comments are wrong, or we have out of range values in the various difficulties which are doing nothing of value.

Please investigate and correct either the Description Comments or the Values. Thanks.

Note: This seems wrong aka inconsistent in both the Data 1.13 folder and the Data Folder for the Vanilla version.

[Updated on: Sat, 04 August 2018 21:04]

Re: Absurdly small code changes[message #354216 is a reply to message #354215] Sat, 04 August 2018 21:51 Go to previous messageGo to next message
silversurfer

 
Messages:2312
Registered:May 2009
It's probably a copy+paste error in the description. The "ChanceOfEnemyAmbushes" modifies the chance for ambushes so it can take negative (decrease chance) or positive values (increase chance). Fixed in GameDir 2431.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Re: Absurdly small code changes[message #354217 is a reply to message #354216] Sat, 04 August 2018 22:39 Go to previous message
ZedJA2

 
Messages:22
Registered:January 2018
@ SilverSurfer

Thanks for info and the fix.
Previous Topic: New feature: additional dialogue
Next Topic: New Feature: Disease
Goto Forum:
  


Current Time: Wed Aug 15 04:14:01 EEST 2018

Total time taken to generate the page: 0.02490 seconds