Ask a simple question, get a simple answer
- AndakRainor
- Posts: 674
- Joined: Thu Nov 20, 2014 5:18 pm
Re: Ask a simple question, get a simple answer
I would like to make monsters burn ! Does any one know the condition to apply ? I didn't find it among the champions conditions listed in the current documentation... https://github.com/JKos/log2doc/wiki/Conditions
Re: Ask a simple question, get a simple answer
That list only has champion conditions (as implied by the name), not monster conditions. You can set a monster on fire in two different ways:
1. MonsterComponent:setCondition("burning",[duration])
2. GameObject:createComponent("BurningMonster")
I don't know which one is "correct".
1. MonsterComponent:setCondition("burning",[duration])
2. GameObject:createComponent("BurningMonster")
I don't know which one is "correct".
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
- AndakRainor
- Posts: 674
- Joined: Thu Nov 20, 2014 5:18 pm
Re: Ask a simple question, get a simple answer
Thanks !
I tried both methods (they work) but even with the BurningMonsterComponent:setCausedByChampion(number) function with the champion's ordinal number, I can't get the XP when the monster dies. Any idea what's going on and how I could force it ?
I tried both methods (they work) but even with the BurningMonsterComponent:setCausedByChampion(number) function with the champion's ordinal number, I can't get the XP when the monster dies. Any idea what's going on and how I could force it ?
- TheLastOrder
- Posts: 104
- Joined: Wed Oct 17, 2012 1:56 am
Re: Ask a simple question, get a simple answer
Hi guys!!
My mod crashes when, after defeating a warden (guardian imported from LoG1) I try to save at any healing crystal. All the time.
Any idea what´s going on????
Edited: could it be related with the fact that this monster is spawned from 0 and it doesn´t exist at first???? here´s the code:
Thanks a lot for your help+support!!
My mod crashes when, after defeating a warden (guardian imported from LoG1) I try to save at any healing crystal. All the time.
Any idea what´s going on????
Edited: could it be related with the fact that this monster is spawned from 0 and it doesn´t exist at first???? here´s the code:
Code: Select all
spawn("ice_warden", 7, 15, 14, 3, 0, "Bertolucci")
spawn("teleportation_effect", 7, 15, 14, 0, 0)
boss_fight_water.bossfight:addMonster(Bertolucci.monster)
boss_fight_water.bossfight:activate()
Bertolucci.monster:addConnector("onDie", "tomebertolucci", "tomebertolucci")
Bertolucci.monster:addConnector("onDie", "dungeon_door_iron_2", "open")
activatebertolucci.floortrigger:removeConnector("onActivate", "script_boss_fight_water", "startBertoFight")
Re: Ask a simple question, get a simple answer
First thing to do is check the error log file; in the game's install folder. This will list an error.
- TheLastOrder
- Posts: 104
- Joined: Wed Oct 17, 2012 1:56 am
Re: Ask a simple question, get a simple answer
Great, here it isIsaac wrote:First thing to do is check the error log file; in the game's install folder. This will list an error.
=== Settings ===
Render Engine: d3d9
Audio Engine: xaudio2
Steam: true
Resolution: 1920 x 1080
Display Mode: fullscreen (1)
Vertical Sync: enabled (2)
Texture Resolution: medium (2)
Texture Filter: anisotropic (3)
Shadow Quality: high (3)
SSAO Quality: high (3)
Rendering Quality: high (2)
Difficulty: normal
Oldschool Mode: false
Loading save game C:\Users\NOOBERTO\Documents/Almost Human/Legend of Grimrock 2/savegame49.sav
Loading dungeon The Mountain by The Last Order
Game loaded
=== Software Failure ===
[string "Script.lua"]:0: attempt to concatenate field 'id' (a nil value)
stack traceback:
[string "Script.lua"]: in function 'saveValue'
[string "Script.lua"]: in function 'saveState'
[string "GameObject.lua"]: in function 'saveState'
[string "Map.lua"]: in function 'saveState'
[string "GameMode.lua"]: in function 'saveGame'
[string "SaveGameMenu.lua"]: in function 'update'
[string "GameMode.lua"]: in function 'update'
[string "Grimrock.lua"]: in function 'display'
[string "Grimrock.lua"]: in main chunk
I´m starting to believe that is related with spawning enemies that are not in the SAME level as the bossfight; this problem happened as well with another enemy from LoG2, but not with a 3rd one whose invocation was only teleporting him in the same level (in a one-square closed area) where the fight has to happen.
Thank you so much!
Re: Ask a simple question, get a simple answer
I think that you have a typo in the path you give ~somewhere. Check where you are adding an id to a string.
Re: Ask a simple question, get a simple answer
http://www.grimrock.net/modding/save-ga ... variables/
This error will occur if you save while a ScriptComponent* is storing a reference to a GameObject. Only plain tables, strings, functions, numbers, and booleans may be saved. You should avoid having any references to GameObjects, Components, or absolutely anything else not in that list, during the part of each frame where the user can save. Use the "local" keyword in functions and other blocks so that references go out of scope when they end. If you need to store one of these references outside of any block, be sure to set it to nil (or a serializable type) on the same frame after you're done with it.
Normally a serialization error will give a "can't serialize field of type X" message. But it seems that with GameObject references the save code looks at them, sees "oh, that's a GameObject" and tries to serialize it as a GameObject, even though it's just a reference - which means it won't have an 'id' field (or any of the other fields that need to be serialized).
Now you may notice I said that references can't be serialized, but table, string, and function references won't cause an error (thank god). However, the environment of a function can potentially change when it is serialized if there are multiple references to it. I assume the same thing could happen for tables/strings, except I don't think the environment is ever meaningful for the tables you are allowed to have references to anyway.
*(or probably one of the global tables, if you modified those for some reason)
This error will occur if you save while a ScriptComponent* is storing a reference to a GameObject. Only plain tables, strings, functions, numbers, and booleans may be saved. You should avoid having any references to GameObjects, Components, or absolutely anything else not in that list, during the part of each frame where the user can save. Use the "local" keyword in functions and other blocks so that references go out of scope when they end. If you need to store one of these references outside of any block, be sure to set it to nil (or a serializable type) on the same frame after you're done with it.
Normally a serialization error will give a "can't serialize field of type X" message. But it seems that with GameObject references the save code looks at them, sees "oh, that's a GameObject" and tries to serialize it as a GameObject, even though it's just a reference - which means it won't have an 'id' field (or any of the other fields that need to be serialized).
Now you may notice I said that references can't be serialized, but table, string, and function references won't cause an error (thank god). However, the environment of a function can potentially change when it is serialized if there are multiple references to it. I assume the same thing could happen for tables/strings, except I don't think the environment is ever meaningful for the tables you are allowed to have references to anyway.
*(or probably one of the global tables, if you modified those for some reason)
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
- TheLastOrder
- Posts: 104
- Joined: Wed Oct 17, 2012 1:56 am
Re: Ask a simple question, get a simple answer
Isaac wrote:I think that you have a typo in the path you give ~somewhere. Check where you are adding an id to a string.
Awesome!minmay wrote:http://www.grimrock.net/modding/save-ga ... variables/
This error will occur if you save while a ScriptComponent* is storing a reference to a GameObject. Only plain tables, strings, functions, numbers, and booleans may be saved. You should avoid having any references to GameObjects, Components, or absolutely anything else not in that list, during the part of each frame where the user can save. Use the "local" keyword in functions and other blocks so that references go out of scope when they end. If you need to store one of these references outside of any block, be sure to set it to nil (or a serializable type) on the same frame after you're done with it.
Normally a serialization error will give a "can't serialize field of type X" message. But it seems that with GameObject references the save code looks at them, sees "oh, that's a GameObject" and tries to serialize it as a GameObject, even though it's just a reference - which means it won't have an 'id' field (or any of the other fields that need to be serialized).
Now you may notice I said that references can't be serialized, but table, string, and function references won't cause an error (thank god). However, the environment of a function can potentially change when it is serialized if there are multiple references to it. I assume the same thing could happen for tables/strings, except I don't think the environment is ever meaningful for the tables you are allowed to have references to anyway.
*(or probably one of the global tables, if you modified those for some reason)
So basically, the problem is that I´m not using the local keyword in the scripts to isolate those references I use once they've finished.
I'm going to re-review all the scirpts!
Really good explanation, thanks a lot to both, Isaac and minmay!!
Re: Ask a simple question, get a simple answer
Well Isaac's post is just completely wrong, actually. The error has nothing to do with a concatenation that you're performing.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.