Page 157 of 396
Re: Ask a simple question, get a simple answer
Posted: Sun Oct 09, 2016 11:46 pm
by minmay
It still works with current Blender versions, the imported object rotation/scale are just wrong sometimes but this is not
too annoying to fix.
To get the correct layout in Blender to export a Grimrock model, import an existing model, look at the object hierarchy, and match it (I often do so by importing a model, deleting the existing mesh, and copying my own mesh object into it). Your object hierarchy should look something like this:
If you have a rig then it's a little more complicated:
The Blender plugin uses empty objects for nodes; every empty object except game_matrix will turn into a node, as will every mesh object.
Re: Ask a simple question, get a simple answer
Posted: Mon Oct 10, 2016 12:17 am
by Eburt
Thanks again minmay and Isaac. I think I understand where I was going wrong now.
Re: Ask a simple question, get a simple answer
Posted: Mon Oct 10, 2016 9:57 am
by AndakRainor
Is it possible to add a function to a script entity with a console command?
Re: Ask a simple question, get a simple answer
Posted: Mon Oct 10, 2016 11:38 am
by Isaac
One would think so [ via setSource() ], but in practice it doesn't seem to work.
Re: Ask a simple question, get a simple answer
Posted: Mon Oct 10, 2016 11:54 am
by AndakRainor
I just tried many things, but it seems completely impossible.
I thought I could somehow patch the mod I shared recently, but any additional code is not allowed after the game has started:
- You can't add a function (except in the GameMode table!)
- If you ignore the compatibility warning and load your old save game file, the definitions of new objects in the new mod version are never defined, the init phase occurring only once.
- You can't spawn a script_entity and set or load its source, it will never execute.
- You have no way to build an object dynamically and define its components' functions.
So, I think there is something done to the lua code on the game start that can't be done later or is forbidden for some reason.
It appears all possible ways are intentionally locked.
Re: Ask a simple question, get a simple answer
Posted: Mon Oct 10, 2016 5:50 pm
by minmay
AndakRainor wrote:- You can't spawn a script_entity and set or load its source, it will never execute.
You actually can do this by calling setSource() or loadFile() before the ScriptComponent fully initializes.
Re: Ask a simple question, get a simple answer
Posted: Mon Oct 10, 2016 6:07 pm
by AndakRainor
To do this you would need an object definition with this call, and you can't define a new object when loading a save from a previous version of a mod.
But I suppose I could define a "patch" object which just does this for future updates.
Re: Ask a simple question, get a simple answer
Posted: Fri Oct 14, 2016 12:48 am
by zimberzimber
I'm having issues with id setting.
For some reason, when I place an object on the map that creates other objects and uses
self.go.id.."_p" to set their IDs, everything works fine.
But when I spawn that object with a spell, it says "invalid entity id".
Any way to work around this?
Here's the line I'm using to spawn objects through the summoned object:
Code: Select all
spawn("object_proxy", l, x, y, (f+1)%4, e, self.go.id.."_p")
EDIT: I got it. the ID cannot start with a number, so I'll just rewrite it to this:
Code: Select all
spawn("object_proxy", l, x, y, (f+1)%4, e, "p_"..self.go.id)
Re: Ask a simple question, get a simple answer
Posted: Fri Oct 14, 2016 12:59 am
by Eburt
How is "self" defined when used in the spell? My guess is self.go.id returns nil in your context.
Re: Ask a simple question, get a simple answer
Posted: Fri Oct 14, 2016 1:08 am
by zimberzimber
Eburt wrote:How is "self" defined when used in the spell? My guess is self.go.id returns nil in your context.
No, because like I said, the spell spawns an object that spawns an object.
zimberzimber wrote:when I place an object on the map that creates other objects and uses self.go.id.."_p" to set their IDs, everything works fine.
But when I spawn that object with a spell, it says "invalid entity id".
EDIT: Never mind, figured it out. Read my previous post.