spawn a key at the party's position
Posted: Thu Oct 29, 2015 8:21 am
I'm sure this answer is somewhere on the forums, but i've been searching and can not find it.
I'm pretty sure I ight have asked this question already, but I forgot which thread it was in.
I want to spawn a key where the party is standing when they kill a boss.
I alreayd know how to spawn a scroll and set the text, but I have been using floor triggers for that which don't move, so I always know that when the party steps on the trigger, I know exactly where the party will be, so I know where to place the scripting entity since the scroll will pop out of the entity.
but I have 3 bosses in 3 different spots on the map, and i have a counter set up so that when all 3 die, it runs a script to spawn a key. but I want the key to spawn in front of the party.
so this way, the party can tacke the 3 bosses in any order they wish, and when they kill the last one, a key spawns.
i tried
as a test, i did not mess with counters, i just connected a mummy up to the script
and the editior Crashed to desktop, and a white window appeared saying a bunch of stuff, (i don't remember what it said) and I lost some progress, it seems like it rolled my mod back to an point 10 minutes earlier.
I'm sure there's more to the code, and I did something drastically wrong, but how do I do this?
i found the grimrock.log it says this
=== Software Failure ===
#script_entity_13.script:2: attempt to call method 'getWorldPosition' (a nil value)
stack traceback:
#script_entity_13.script:2: in function <#script_entity_13.script:1>
[string "Script.lua"]: in function 'sendMessage'
[string "Component.lua"]: in function 'triggerConnectors'
[string "Component.lua"]: in function 'callHook'
[string "Monster.lua"]: in function 'die'
[string "GameMode.lua"]: in function 'keyPressed'
[string "DungeonEditor.lua"]: in function 'preview'
[string "DungeonEditor.lua"]: in function 'update'
[string "Grimrock.lua"]: in main chunk
I'm pretty sure I ight have asked this question already, but I forgot which thread it was in.
I want to spawn a key where the party is standing when they kill a boss.
I alreayd know how to spawn a scroll and set the text, but I have been using floor triggers for that which don't move, so I always know that when the party steps on the trigger, I know exactly where the party will be, so I know where to place the scripting entity since the scroll will pop out of the entity.
but I have 3 bosses in 3 different spots on the map, and i have a counter set up so that when all 3 die, it runs a script to spawn a key. but I want the key to spawn in front of the party.
so this way, the party can tacke the 3 bosses in any order they wish, and when they kill the last one, a key spawns.
i tried
Code: Select all
function key()
local k = party.party:getWorldPosition()
k:spawn("nexus_key")
end
and the editior Crashed to desktop, and a white window appeared saying a bunch of stuff, (i don't remember what it said) and I lost some progress, it seems like it rolled my mod back to an point 10 minutes earlier.
I'm sure there's more to the code, and I did something drastically wrong, but how do I do this?
i found the grimrock.log it says this
=== Software Failure ===
#script_entity_13.script:2: attempt to call method 'getWorldPosition' (a nil value)
stack traceback:
#script_entity_13.script:2: in function <#script_entity_13.script:1>
[string "Script.lua"]: in function 'sendMessage'
[string "Component.lua"]: in function 'triggerConnectors'
[string "Component.lua"]: in function 'callHook'
[string "Monster.lua"]: in function 'die'
[string "GameMode.lua"]: in function 'keyPressed'
[string "DungeonEditor.lua"]: in function 'preview'
[string "DungeonEditor.lua"]: in function 'update'
[string "Grimrock.lua"]: in main chunk