+++ DYNRPG - THE RM2K3 PLUGIN SDK +++

Posts

This is a good start.

http://www.cplusplus.com/doc/tutorial/

What has made DynRPG quite a bit harder is that the code is sorta just explained as a "one-byte version" rather than giving examples in context. Anyway this should make things substantially more simple However, in the above code

int eax = (int)RPG::actors[HeroId];
int edx = EquipSlot; //starts with zero: 0|1|2|3|4
int ecx = ItemId; //zero to unequip
asm volatile("call *%%esi"
:
: "S" (0x4B7DB4), "a" (eax), "d" (edx), "c" (ecx)
: "cc", "memory");
//equips ItemId (or unequips current Item) in specified EquipSlot of an Actor

*%%esi and 0x4B7DB4 are not native C++ code. They're basically what you need a degree in computer science for. I, on the other hand, have a degree in history so yea. The second is a hex address, the first I don't know.

bugmenot, can you help me with something? I have this code above:

if(!cmd.compare("scan_file"))
{
//Attempt ONE to scan the file for a string
//this one works by turning on a switch if the string is found
FileName = parsedData->parameters[0].text;
ifstream myfile;
myfile.open (FileName.c_str());
scanfile = parsedData->parameters[1].text;
for(std::string temp;!myfile.eof();std::getline(myfile,temp))
{
if(temp.find(scanfile)!=std::string::npos)
{
RPG::switches[parsedData->parameters[2].number] = true;
//Turns on the switch if the string has been found in the file
//ideally, I'd want to save a new name using the scanfile, but I can't figure out how to copy it
}

}
myfile.close();
return false;
}

All of this works fine for how I'm using it. However, the scan file command kinda scans even if the file is missing. This causes the game (and the entire computer, because it's an infinite loop) to freeze. I need it to skip if the file isn't there.

There were incompatibility issues with DirectMenuPatch and VisuMenuPatch. Replace the old VisuMenu.ips file with this one:

download VisuMenu(fix)


@above me:
I know less about C++ than you. Try google
... I doubt a degree in computer science would help much with what those numbers I posted mean.
It might help with getting started, though. Since it's extended inline assembly.
How can you understand assembly but be hopeless at C++? That's backwards.

Also, I seriously doubt that. That code was pretty much lifted from another code and adapted to DynRpg.

Best I can find is these codes:

void onNewGame () {
// FindFirstFile function load
WIN32_FIND_DATA lpFindFileData;
HANDLE hFind;
// Find saves that begin with "save," and end with ".lsd" with any numeric value inbetween
hFind = FindFirstFile("Save??.lsd", &lpFindFileData);
if(hFind != INVALID_HANDLE_VALUE) {
// default switch value = 4005
RPG::switches[confDetectSwitch] = true;
FindClose(hFind);
} else {
RPG::switches[confDetectSwitch] = false;
}
}

From PepsiOtaku for detecting save files. Not sure how to pull the previous file name, but I'll look into this.

And you apparently can use .good() to check if a string or file is a good one. I'm unsure if this checks for the file's existence or its contents though.

http://www.cplusplus.com/forum/beginner/80680/

Seems to be what I need.
author=bulmabriefs144
How can you understand assembly but be hopeless at C++?
Because I stopped delving further into C++ when I realized I can pull all desired values or call (yet) inaccessible RT functions from memory. Also I don't use 2k3, so there's no real reason yet.


.good()
If it was just save.lsd files you wanted to check for.
edit: I know a simple way:
int eax = ( *reinterpret_cast<int **> (0x4CDF20) )[0];
int edx = SaveId;
int out = 0;
asm volatile("call *%%esi"
: "=a" (out)
: "S" (0x4A5484), "a" (eax), "d" (edx)
: "cc", "memory");
RPG::variables[ID] = out; //0|1 = false|true existence
Should compile into less code than using Pepsi's method. Doesn't really make a difference though.
Probably shouldn't execute that when inside of any of the save/load screens.

I just (pre-edit) noticed that this RT-internal function returns a boolean value for the (non)existence of save files. I can backtrack it to whatever checks for a certain filename. But I'm dead tired now. I'll come back to that later. (if you find a solution by then, ignore what I said.)
Actually, I needed the code because it was the closest thing. I'm actually using .txt files. It seems to work like a charm! Skips the file, and I made a code that turns a switch ON/OFF based on the presence or absence of a file.

There is one bug, I had create_file "awards.txt", "GamePlusAwards" and then later I did scan_file "dynstore.txt", "GamePlus", 382. It turned switch 382 (Game Plus) on because the scan_file wasn't very careful.

I renamed it to NewGame for the award, and removed the check until you restarted the game. I think it's some spillover or something. Whatever. It's working without crashing the game, so I'm cool with it.

Ah good, I fixed the bug. It was an else condition that shouldn't be there. It caused an overlap whenever you switched from one chest to another. Now as long as the word is found, it stays on. You will kind of need to save between treasure chests (if you quit the game, the chest will still be open), but it seems to do a good job of holding the value.
Stuff:
SkillScrollSwitch

... for disabling the use of "skill scroll" items in battle/field, e.g. if the linked Skill inflicts a regenerative/stat-doubling Condition/Buff (which should only apply inside of battle, but would normally be usable on the field as well).
author=bugmenot
Stuff:
SkillScrollSwitch

... for disabling the use of "skill scroll" items in battle/field, e.g. if the linked Skill inflicts a regenerative/stat-doubling Condition/Buff (which should only apply inside of battle, but would normally be usable on the field as well).


yeah that was kind of annoying now that you mention it.
thanks man, another awesome fix :)
author=bugmenot
Stuff:
SkillScrollSwitch

... for disabling the use of "skill scroll" items in battle/field, e.g. if the linked Skill inflicts a regenerative/stat-doubling Condition/Buff (which should only apply inside of battle, but would normally be usable on the field as well).


Nice! However, I was able to fix this using a method of my own, but I needed a duplicate version of each item.
[QuickPatches]
DefIntBuffFix=4B743B,9090908B,4B74EB,9090908B
When a skill in-/decreased DEF or INT on a hero, the effect was doubled for some reason.


edit:
RPG_RT2k3 v1.09:
0xAD881 set [90 90 90 8B]
0xAD903 set [90 90 90 8B]
Can you make so I can make certain skills bypass the 9999 max damage?

As in, I want the limit break to, you know, actually break the limit 9999.
How does RPG::Battler->attributes work?
Did RPG::Battler->attributes work for anyone?

At the start of the battle it returns 0 for every attribute with a list-size of 0.
After the first attack, the size of that list/array is 17, which is the number of attributes in my database. Thats fine. However, the values stay 0. If i use a skill that changes attribute-resistence, the values stay 0.

I had it once that after the first attack, the attributes-values were 1 and changed to 0 after reducing resistence, but that does not happen anymore.
Changing the attribute-settings of the monsters in the database does not change anything.
I think it's had some use in animated_monsters or the status_icons or something like that. Never really worked with it personally.
Righ now it seems to work slightly better, at least i get changing numbers.

My guess: RPG::Battler->attributes returns 0,1,2. 1 means standard resistence. 0 = reduced resistence, 2 = increased resistence.
wait...
author=Bugmenot
Also, you don't need multiples of a weapon just to have elemental properties.
**Dyn.30 added DArray<bool> RPG::Item::attributes. Just set new values and you are done.

is there actually a plugin that does that, or it was just hipotetical ?
I don't know of any plugin that does that.

Tell me exactly what you need and i'll look into it.
author=Corti
I don't know of any plugin that does that.

Tell me exactly what you need and i'll look into it.

well, basically what i'm looking for is a way to change the attack attributes of a weapon (along with special property - preemptive strike, attack twice, attack all) according to some "weapon mod"that the player can use in game; now normally i would make like X copies of that weapon with different properties and equip them accordingly, but if i understood correctly with dyn.30 this is no longer required because it can be done via plugin (assuming someones compiles it).

my idea would be inserting comment lines during the event, something like:
author=me
@weapom_attribute item_id, attribute_id, true/false (1/0 or whatever)

or

author=me
@weapon_property item_id, a, b, c, d, e

where a/e would be either 1 or 0 and refere to the 5 special option (from "always attack first" to "cursed")

or yet modify the mp consumed, critical bonus chance, hit rate... basically alter the stats of each weapon via comment, for those game in which the equipment evolves while progressing.

that's, of course, just hipotetical, i don't know how much of this is actually possibile
One more thing:
The database is not part of the savestate.
Means: if you change item settings via plugin, and you load a savegame, its still changed. And if you change an item, save the game and restart the game it will be back to standard values, and loading the savegame won't change it to your special values.

Could you deal with that? If you can, i will write you that plugin.
author=Corti
One more thing:
The database is not part of the savestate.
Means: if you change item settings via plugin, and you load a savegame, its still changed. And if you change an item, save the game and restart the game it will be back to standard values, and loading the savegame won't change it to your special values.

Could you deal with that? If you can, i will write you that plugin.


well i could easily add all the necessary "checks" for weapon mods etc.. after the load game event (save and load menu are also customized), so let's say i load save A were the hero #1 has the Sword with Fire damage property, the plugin should "activate" the the moment i load the game, so if i quit and load the save B where hero #1 has the Sword with Ice damage, it should load no problem.
so, yeah, i think i can work around this! :)
Hey, is there a way to rewire Miss chance?

I want it to function like "If random number is greater than (this variable) you hit, otherwise it's a miss." I could use something done through the ini, so the system is built-in, I just change the variable set, and the range and variable number is preset to work.