Topic: [3.63] URW Mod Extender v0.0.3  (Read 15485 times)


Night

« on: February 15, 2021, 06:43:53 PM »
[3.63] URW Mod Extender v0.0.3
(UnReal World Mod Extender)

This project is aimed at extending the capabilities of the current modding system and adding additional functionality to the game to provide players and mod makers with a much broader range of content than currently available. The scope of this project is quite large, with a variety of different byproducts resulting from its completion including QoL improvements to general gameplay, extended recipe syntax, events with scriptable conditions/actions, fully customizable hotkeys with assignable functionality, extended menudef_ handling, extended read/write of game data (player, npcs, items, world data), a lightweight C# wrapper for URW data management, and much much more as this develops.

In its current state, the project will start with an initial beta testing/bug fixing phase, whilst constructing the base minimum functionality to consider the project stable, useful, and fun for the player base to use, with little to no irritable drawbacks.

The initial beta release will be most appealing to current mod-makers who wish to extend their recipe's functionality and bypass the menudef_ limit, as there are no mods that currently make use of this(yet) there will not be many(if any) extended mods until they are made/tested/released as an extended mod.

Installation, running, exiting
Spoiler: show
Extract contents of the zip folder anywhere, but for easier management I suggest extracting it to your UnRealWorld folder. (mine is C:\Program Files (x86)\Steam\steamapps\common\UnRealWorld). After you extract URWME.exe and URWME_Files somewhere (must both be in the same folder), running URWME.exe will handle the rest. If the game is already running, it will use that instance of the game as its target process, if the game isn't already running, it will attempt to run the game in this order:
  • Current directory - runs urw.exe from the folder you ran URWME.exe in
  • Steam directory - Checks to see if you have steam installed via registry keys, then attempts to run the game from your default steam directory with the default game path
  • Steam shortcut - Attempts to run the game via URW's steam URL (steam://rungameid/351700)
Keep this in mind if you're using old game versions/non-steam directories. (designating path from URWME_Config.txt is planned for an upcoming patch)

To exit the program, either close UnReal World or the application itself through the main form. diy_ModExtender.txt and menudef_ModExtender.txt should automatically be deleted when this happens, but incase they don't, it is recommended to manually delete them.


Assigning and using extended menudefs
Spoiler: show
Extended menus can be assigned inside of the URWME_Config.txt file; to do this, simply open the file in notepad and insert the what you would normally put in a Menudef_ file, under [Menuhotkeys] on a new line.

The only additional bit you will need to add is the key / key combination you would like to use to activate this particular menus when using the Menu Manager. Below is an example of how this section of the config will look:

When accessed in game via the Menu manager, (~ key by default) you will be presented with a UI showing you the menudefs with their respective hotkeys, pressing the key/keys for the desired menu executes the following process:

  • key pressed ->
  • assigned keys menudef_ is written to UnReal World's folder as menudef_ModExtender.txt ->
  • mod extender macros the appropriate keys to reach the menu (shift+m+z) ->
  • menu manager is minimized and the menu is now open with affiliated diy_ recipes.

Here is what the UI looks like with the above configuration:

Make sure the menu manager is focused/active when you're attempting to access a menu. (by default, it opens focused)

Important Idiosyncrasies:
Any menu you add as an extended menudef to the config, should not be defined in a regular menudef_, and should not use  hotkeys used by regular menudef_ menus, as this will conflict when menudef_ModExtender.txt is written to. Any custom menudef_ defined within the config file may ignore this rule and use the same key. (-Z- was used in my example). Defining recipes for the menu may be done in either regular diy_ files or custom ext_ files.


Defining ext files & using new syntax
Spoiler: show
ext_ files work exactly like diy_ files, except they're processed into a master diy_ModExtender.txt file whenever the user is about to use the crafting menu. When the crafting menu is accessed, a function is triggered that reads each ext_ file defined within UnReal World's folder, the recipes are organized into a dictionary of submenu's and their respective recipes. each submenu is iterated through and each recipe within that submenu is read line by line checking for extended functions. When a line contains one of these extended functions, that particular function is executed and returns a true or false value, depending on whether the conditions of that functions were met, or not, which in turn determines if the recipe has all the requirements needed to use it. Multiple functions can exist within a single recipe, creating a much richer crafting system with more complex concepts and ideas emerging with each new function I am able to add and implement.

Here is an example of what an ext_file.txt looks like:




Here is the resulting diy_ModExtender.txt file after the functions have been executed and handled:



The current functions implemented consist of the following: (green fully working, yellow WIP)

  • IsNearNPC(string Name); - returns true if an NPC within 1 square has the designated text within their name
  • RecipeKnown(string Name); - returns true if an item with the designated name has been set as a 'recipe' via the [SKILL:recipe] tag (used to restrict an item if a recipe has not been learned yet)
  • RecipeUnknown(string Name); - returns true if an item with the designated name is not found/has not been set to a 'recipe' using the [SKILL:recipe] tag (used to 'learn' a recipe)
  • HideWhenFalse(); - removes the recipe from the crafting menu if any custom syntax is false, otherwise the recipe is shown.
  • {[TILE:FunctionName]} +'Descriptor' - any [TILE:] placed right after a function with the function name as the tile will act as a placeholder for the crafting system to use. This line gets replaced by a passing or failing requirement depending on its relative functions success or failure. Additionally acts as a descriptor for the function
  • [SKILL:recipe] - designates this item as a recipe, when a recipe is found in the players inventory or on the ground it is automatically removed from the game. Using RecipeUnknown(name) with the recipe's name as the parameter will hide the recipe once it has been crafted/learned for the first time when used in conjunction with HideWhenFalse(). Currently I have not implemented an 'unlearn' function yet, but it is a possibility if requested/needed.
  • PlayerIs(string variable, string comparator, string value); - returns true if the variable compared using a specified comparator with the value is true. Example: PlayerIs(Fatigue,>=,20) (partial implementation/untested)

Unimplemented but planned functions include:
  • WorldIs(string variable, string comparator, string value); - same as PlayerIs(), but for world data.
  • LastInputIs(string variable, string comparator, string value); - same as PlayerIs(), but for custom player input.

Important Idiosyncrasies:
All functions and data are case-sensitive, functions must end with );. Parameters are separated with a , with no spaces IE: (param1,param2,param3) spaces will be considered part of the parameter if you use them (which may be necessary, in some cases). Most functions require a [TILE:FunctionName] tag to be used on the next line as a placeholder ingredient, with the exception of a few special cases (so far, just HideWhenFalse();)


I have attached an example mod to be used with the Mod Extender for demonstration/learning purposes, includes IsNearNPC, RecipeKnown, RecipeUnknown, and [SKILL:recipe] usage. If you have any questions please post below.

Version History:
  • v0.0.3 3/10/21
    - Added functions: RecipeKnown(), RecipeUnknown(), [SKILL:recipe]
    - Automatic removal of items marked as a recipe from ground and inventory.
    - Automatically move files from Images\truetile to URW's truetile folder (does not overwrite)
  • v0.0.2 2/~/21 - Improved UI, improved game detection/start, organized folders/files
  • v0.0.1 2/15/21 - Initial beta release

Please report any bugs to me via this thread, my PMs, or contact me directly on steam:
https://steamcommunity.com/id/Nightipoo/

Download attached to thread.

Credits:
   Night - Creator/Programming.
   Jiggie - Reviewing code.
   Unrealworld.fi/forums - Multiple ideas from multiple forum users.
   Enormous Elk - Unreal world.

Requires Microsoft .NET Version 4.6 or later. (Usually already installed)
« Last Edit: March 11, 2021, 12:16:35 AM by Night »
URW Character Menu - Cheating menu by a player, for the players.
URW Character Designer - Design your characters sprite!

Night

« Reply #1 on: February 15, 2021, 06:44:18 PM »
Reserved
URW Character Menu - Cheating menu by a player, for the players.
URW Character Designer - Design your characters sprite!

Privateer

« Reply #2 on: February 15, 2021, 09:51:29 PM »
 On initial load it generated the error and detail attached. So I quit out.

On re-running there was no error but it was running URW from my steam version 'NOT' the private version (non steam) directory where URW and the URWME (and files) reside.

 I'll have to clean up my steam directory before I can test there (by just letting it run).
« Last Edit: February 25, 2021, 08:11:16 PM by Privateer »
To help is it's own reward.
Mods:
https://www.unrealworld.fi/forums/index.php?action=profile;area=showposts;sa=attach;u=10 Player Quests, Arrow quiver, Bee hives honey & mead, Massive menus, Fish Farmer, Combat trainer, Player made markers, Weaving, Wood stacks, Chicken coop Fish cuts, string&bone.

Night

« Reply #3 on: February 16, 2021, 03:41:44 AM »
On initial load it generated the error and detail attached. So I quit out.

On re-running there was no error but it was running URW from my steam version 'NOT' the private version (non steam) directory where URW and the URWME (and files) reside.

 I'll have to clean up my steam directory before I can test there (by just letting it run).

- Patched/improved process detection, included in next update.
URW Character Menu - Cheating menu by a player, for the players.
URW Character Designer - Design your characters sprite!

Night

« Reply #4 on: March 11, 2021, 12:31:57 AM »
~Updated to v0.0.3
URW Character Menu - Cheating menu by a player, for the players.
URW Character Designer - Design your characters sprite!

« Reply #5 on: May 06, 2021, 03:43:39 PM »
Would this allow the implementation of dynamic character sprites?

Night

« Reply #6 on: May 06, 2021, 08:21:21 PM »
Would this allow the implementation of dynamic character sprites?
I can pretty much do this, the problem I run into is at the end, after changing all the data, the user is forced to press F9 to reload the games images from the truetile folder. Normally this wouldn't be too much of a problem because I could program it to send the F9 key when it detects new sprite changes, but F9 tends to be a bit buggy and can cause the game to crash.

The alternative method is generating every possible sprite combination and putting them all in the truetile folder before starting the game, which would keep them all available without using F9, but then you run into the problem of having thousands of sprite sheets for tiny changes.

URW Character Menu - Cheating menu by a player, for the players.
URW Character Designer - Design your characters sprite!

« Reply #7 on: May 06, 2021, 09:05:08 PM »
I see. Hopefully it can work out in the end! I'd totally be willing to even donate a bit of money for it.
What about adding new animals? I wouldn't mind seeing some more variety in wildlife.

Night

« Reply #8 on: May 06, 2021, 11:22:01 PM »
I see. Hopefully it can work out in the end! I'd totally be willing to even donate a bit of money for it.
What about adding new animals? I wouldn't mind seeing some more variety in wildlife.

I can copy/paste animals and modify their sprites pretty easily, and I can insert them into the map. I haven't done much testing on how their AI handles itself though, and theres alot of data I haven't mapped, so full editing isn't something I can currently do, but sprite, some weight values, names, vocals and attack text I can edit, and acouple of other things. Most likely I can just copy current NPCs and overwrite the sprites and such, and it will probably inherit the rest of the original NPCs functionality, so ideally you could just base new NPCs off of old ones as far as aggression/leashing/AI stuff goes.

here is what I have currently mapped for NPCs (data i know for sure (okay maybe not for sure but pretty sure) does the intended effect)
Code: [Select]
                ClassID = 0x0,
                CreatureID = 0x4,
                Name = 0x8,
                Nickname = 0x30,
                Portrait = 0x49,
                Sprite = 0x2B6,
                Vocals = 0xA8,
                //Vocal2 = 0xB2,
                Attacks = 0xDE,
                //Attack2 = 0xEA,
                Skills = 0x115,
                Items = 0xB4,
                MeatWeight = 0x94,
                IndexID = 0x52C

A minor test I performed a long while ago where I changed a cow's name to 't-rex' and butchered it showed that by products of the new 't-rex' inherited its name appropriately, IE: t-rex cuts, t-rex fat, etc.

I can also, to a limited degree, control their x, y, and direction, but game code still affects NPCs when time passes so, I've no idea how their AI will try to react until I run more tests. Ideally looping x/y/direction would allow me to lock their position, if I needed to.


I've got a few things going on in the project currently, but I think next update will be focused on adding containers to the game so we can store larger quantities of items in our home areas.
« Last Edit: May 07, 2021, 12:10:53 AM by Night »
URW Character Menu - Cheating menu by a player, for the players.
URW Character Designer - Design your characters sprite!

 

anything