Page 2 of 2

Re: virtual Money [Script]

Posted: Tue Feb 27, 2018 10:48 pm
by Isaac
TheAdder wrote: Secondly, how do I actually add coins into the game for the player to pick up? There seems to be no new objects I can find in the editor objects pane, but then I don't know what I'm looking for!

Thanks in advance.
Custom objects have to be manually defined. There are blank scripts in your project's scripts folder. You would usually open the items.lua file and add your item definition.

The easiest way to learn how to make your own items, is to read through the official item definitions, to see how they are defined.

You get these in the game's asset pack; available here: http://www.grimrock.net/modding/grimrock-2-asset-pack/
This is a zipped copy of most of the game's default assets. Extract it somewhere convenient, and you'll have the definitions for all of the objects in the game.

You can copy/paste definitions from the asset pack into the scripts in your mod's scripts folder. and any changes you make will be reflected in the mod; when loaded.

A reasonable example for a coin, is to copy the definition of a gemstone, and change it to suit.

This is the definition of the green gem in LoG2.

Code: Select all

defineObject{
	name = "green_gem",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/green_gem.fbx",
		},
		{
			class = "Item",
			uiName = "Green Gem",
			gfxIndex = 119,
			weight = 0.2,
			traits = { "gem" },
		}
	},
}

Here is an altered gem definition for a coin:

Code: Select all

 --two dashes in front, means to skip the rest of the line.
defineObject{
	name = "glass_coin",           --changed object item name
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/green_gem.fbx",
		},
		{
			class = "Item",
			uiName = "Glass Coin",  --changed in-game item name
			gfxIndex = 119,
			weight = 0.2,
			--traits = { "gem" },  --removed gem trait
		}
	},
}

Open the item.lua file, and copy/paste the above code into it; and save the file. Reload your editor project. You should now see a glass coin object in the editor item list. For the moment, it looks the same as a green gem, but you can place it on the map, or in sacks, and have the party pick it up.

To make it actually look like a coin, you will have to create the two artwork files for it. One is a 3D model of the coin, and the other is either a 2D drawing of the coin, or a render of the 3D coin.

Re: virtual Money [Script]

Posted: Wed Feb 28, 2018 4:07 am
by Eleven Warrior
The coins can be found in Minmays G1MP on Nexus. The are the dm coins or I have another set of coins if you would like them. So you wont need to create any models or textures.

G1MP can also be found here in the forum just type it in the search engine.

Re: virtual Money [Script]

Posted: Wed Feb 28, 2018 2:00 pm
by TheAdder
Thanks everyone, I'll have a play with this.

My main issue at the moment is memory, which puzzles me quite a lot. I load a mod into the editor that someone else has written, which is considerably more complex than my own dungeon and has 36 levels or something, or load my own dungeon which has only 10 levels, and I get out of memory crashes in the editor pretty much 80% of the time just running them or at random times while running. Yet I have a 5K iMac with 8 gigs of memory.

I know that 32bit programs can only use about 1.5gigs of memory each, but my main question is: How come the people who write these mods don't have memory errors developing them if I do loading the same mod on a modern iMac with 8gigs, which surely must be a better or equal spec to the machine they were developed on, and not particularly relevant anyway if you only need 1.5gigs to run it. I can't help wondering if it is something to do with the sandboxing system Apple uses to ensure that every application thinks it is running on its own computer and can't spread viruses and interact with other running applications. Does the machine allocate memory at application startup and windows does something different? I'm at a loss as to why my high end system seems incapable of loading anything into the editor without memory problems and yet the modders clearly had no problems developing the mods - or at least, don't say anything about it!

Re: virtual Money [Script]

Posted: Wed Feb 28, 2018 3:20 pm
by AdrTru
Hi,
Reaction on mouse click is limmited becouse this defined money are only virtual.
If you want to use real money models, you must change Money.lua definition of this currency. ( definition table near strat script ). There is deffinition for Ruby gem used as currency for example.
Try to put ruby gem by mouse to vallet and back.
If you will deffine real money from game its nessessary to change its deffinition like ruby gem ( with true in variable - convertible ). Try it.
There isnt problem to make special exchange rate and items.

Re: virtual Money [Script]

Posted: Wed Feb 28, 2018 5:46 pm
by TheAdder
Excellent. Thank you. I'm going to have a lot of fun with this, I can tell!

By the way, just FYI, I've seen a lot of people using the word "vallet" in regard to this mod on forums and just thought you'd want to know. I'm pretty sure the word you want is "wallet", since that is a thing you put coins, banknotes and credit cards in. As far as I know, vallet is a place in France lol :)

Re: virtual Money [Script]

Posted: Fri Mar 02, 2018 2:11 pm
by AndakRainor
Hi!
TheAdder wrote:I load a mod into the editor that someone else has written, which is considerably more complex than my own dungeon and has 36 levels or something[...]
Memory usage is about the same in Magic of Grimrock as in the original Isle of Nex. It is a bit heavier since it includes the spell pack (a few Mb), a few other scripts and the ice lizard from Grimrock 1 (the worst part). As the original Isle of Nex is near the memory limit of what the game engine can handle, you could say that Magic of Grimrock plays with fire! (but also air, water, earth and arcane :P )
TheAdder wrote:How come the people who write these mods don't have memory errors developing them if I do loading the same mod on a modern iMac with 8gigs, which surely must be a better or equal spec to the machine they were developed on, and not particularly relevant anyway if you only need 1.5gigs to run it.
I use the 4Gb patched version of the game on windows to mod. That said I heard here that the mac version did not have the 2Gb limitation???
TheAdder wrote:[...] and yet the modders clearly had no problems developing the mods - or at least, don't say anything about it!
That's right, never had a memory problem while modding Magic of Grimrock. It looks like something else is wrong for you, you should have no problem modding on your Mac.
TheAdder wrote:Perhaps something from another mod asset is interfering or redefining the party after I've already done it. That would be my guess.
Yeah, party definition is definitely THE thing that forces modders that would prefer to avoid lua code to dirty their hands... If you look at Magic of Grimrock, you will see 2 definitions of the party object; one is in the init file of the spell pack, the second is in the init file of the mod itself. The second erases the first, you can see that it includes everything written in the first definition, and adds some more code to handle different systems specific to the mod. Also, it already implements onDrawGui as it needs it (so you can already use hooks on it). When you want to have different scripts, systems, from different sources that all work together you have no other choice than merging their party definitions into one. Note also that the spell pack supports the hook framework with a settable flag. The other systems of Magic of Grimrock do not :roll:

Re: virtual Money [Script]

Posted: Fri Mar 02, 2018 10:01 pm
by TheAdder
Magic of Grimrock is a particularly amazing mod, I really like the fact that I can import my party into it and they all level up as though they're a new party, as I've never understood why people spend 30 hours building their dream party in a game and then instantly throw them in the bin and start all over again with a mod. I'd love to have some sort of global standard format (like the D&D rules) where a party from any game ever can be imported into any other game by any company and the game just adapts the enemies to match. If I could have a level 1000 party with 100% everything I'd just always use them, the games would just have to give me level 1000 monsters!!!

Anyway, I'm playing with the Magic of Grimrock mod and editing the hell out of it to try to create a sort of "Grimrock: The Nex Generation" (!) with the same base island but with everything different (Keelbreech bog cleaned up, new areas, play through in a different order with new enemies, etc), mainly just to see what I can achieve. It's fun so far, if it weren't for the fact that I can edit all I like in the editor but then get memory issues when I press "play". I can still compile the game without a memory issue during compilation, so at least that's something...