General scripting issues and questions
General scripting issues and questions
Hi and thanks for releasing the beta
I will start with a simple question.
Why doesn't this work? is it a bug or just me?
damageTile(1, dungeon_door_iron_1.x, dungeon_door_iron_1.y, 1, 1, "physical", 2)
it gives following error: attempt to index a nil value. But only if there is a monster on that tile.
full script:
function crushEast()
if (dungeon_door_iron_1:isOpen()) then
dungeon_door_iron_1:close()
damageTile(1, dungeon_door_iron_1.x, dungeon_door_iron_1.y, 1, 1, "physical", 2)
else
dungeon_door_iron_1:open()
end
end
Suggestion for scripting reference: Add simple example for every method/function, or at least to more complex ones like this, everyone loves examples for example I don't know what bit field means in lua (and google isin't helping much), is it just a integer from 0 - 256 or something like 00000001 or what? With an simple function-call example of it would have been very easy to me figure it out.
Thanks.
I will start with a simple question.
Why doesn't this work? is it a bug or just me?
damageTile(1, dungeon_door_iron_1.x, dungeon_door_iron_1.y, 1, 1, "physical", 2)
it gives following error: attempt to index a nil value. But only if there is a monster on that tile.
full script:
function crushEast()
if (dungeon_door_iron_1:isOpen()) then
dungeon_door_iron_1:close()
damageTile(1, dungeon_door_iron_1.x, dungeon_door_iron_1.y, 1, 1, "physical", 2)
else
dungeon_door_iron_1:open()
end
end
Suggestion for scripting reference: Add simple example for every method/function, or at least to more complex ones like this, everyone loves examples for example I don't know what bit field means in lua (and google isin't helping much), is it just a integer from 0 - 256 or something like 00000001 or what? With an simple function-call example of it would have been very easy to me figure it out.
Thanks.
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
- cloneObject viewtopic.php?f=22&t=8450
Re: General scripting issues and questions
Oh, this seems like a bug. The monster should receive damage just fine. Thanks for finding it out!
Bit field is something that we should probably cover in the guides somewhere. It's basically 8 bits converted into an integer. You can think of each of the bits as a true/false boolean. For example, if you would like to cause damage that the monster recoils from (bit 0) and which ignores immunities (bit 6). The resulting binary number would be 10000010 which, when you converted to an integer, totals 128+2 = 130, the number you would need to enter into the script in this example case.
Bit field is something that we should probably cover in the guides somewhere. It's basically 8 bits converted into an integer. You can think of each of the bits as a true/false boolean. For example, if you would like to cause damage that the monster recoils from (bit 0) and which ignores immunities (bit 6). The resulting binary number would be 10000010 which, when you converted to an integer, totals 128+2 = 130, the number you would need to enter into the script in this example case.
Steven Seagal of gaming industry
Re: General scripting issues and questions
Yay, about another hour for playing around with the editor.
I still would like to know if it's possible not only to read but also to set the location and orientation of a party (or any other entity), like obj:setpos(x,y,z,r). Does this work and if, how? I can read out this information, i can spawn new entities but how about altering already existing ones like your party?
Would be happy if someone could point me into the proper direction, otherwise i'll have to alter the design of some riddles i intended to implement.
Thanks...
I still would like to know if it's possible not only to read but also to set the location and orientation of a party (or any other entity), like obj:setpos(x,y,z,r). Does this work and if, how? I can read out this information, i can spawn new entities but how about altering already existing ones like your party?
Would be happy if someone could point me into the proper direction, otherwise i'll have to alter the design of some riddles i intended to implement.
Thanks...
Re: General scripting issues and questions
You can use a teleporter entity to transport items/monsters/party.
Re: General scripting issues and questions
But as teleporters only operate on a level i can't for instance let a party fall into a pit, pace a teleporter below and teleport them to the desired position one level above again. Or is this possible? If so, how?
Re: General scripting issues and questions
You can change the target level of a teleporter in the inspector.
Re: General scripting issues and questions
Okay, thanks, i did a quick test, it doesn't work fully. The teleporter isn't activated when the party is falling down. You need to leave the teleporter and reenter the field in order to get teleported. Any idea how to get this running, so that you get teleported instantly once (or even before) you hit the ground?
Re: General scripting issues and questions
I tested it bit more and this bug occurs only when damage type is "physical".antti wrote:Oh, this seems like a bug. The monster should receive damage just fine. Thanks for finding it out!
Also there is a small error in function description: damageType must be on of the following: “physical”, “fire”, “poison”, “cold”, “poison”. I believe that the 5th should be "shock".
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
- cloneObject viewtopic.php?f=22&t=8450
- Montis
- Posts: 340
- Joined: Sun Apr 15, 2012 1:25 am
- Location: Grimrock II 2nd playthrough (hard/oldschool)
Re: General scripting issues and questions
I'm currently a bit puzzled... I'm new to lua but have a bit of scripting experience, so this seems strange to me:
The following code doesn't work properly, it outputs an error in the hudPrint line (string expected). Only when I remove the "local" from the pronoun variable it will work. Is this intended, since I don't really want that variable to have a global scope.
The following code doesn't work properly, it outputs an error in the hudPrint line (string expected). Only when I remove the "local" from the pronoun variable it will work. Is this intended, since I don't really want that variable to have a global scope.
Code: Select all
if party:getChampion(1):getSex() == "male" then
local pronoun = "he"
else
local pronoun = "she"
end
hudPrint(pronoun)
Re: General scripting issues and questions
Code: Select all
local pronoun = ""
if party:getChampion(1):getSex() == "male" then
pronoun = "he"
else
pronoun = "she"
end
hudPrint(pronoun)