Script - Return Weapon to Alter
- undeaddemon
- Posts: 157
- Joined: Fri Mar 02, 2012 3:38 pm
Script - Return Weapon to Alter
Do anyone have some idea of how to get an item/weapon placed on the ground to return to a location?
Re: Script - Return Weapon to Alter
you'll probably do a destroy/spawn deal
Finished Dungeons - complete mods to play
- undeaddemon
- Posts: 157
- Joined: Fri Mar 02, 2012 3:38 pm
Re: Script - Return Weapon to Alter
Thanks.. any chance you have some example of that type of script? I am not great at the scripting, and I have no idea how to cause a destroy on setting an item on the ground.
Re: Script - Return Weapon to Alter
do you mean on setting it anywhere, or a certain spot? If it's a certain spot, that will be much easier, because you can use a hidden plate with a script. If it needs to be anywhere you drop it, that's a little harder but doable, maybe through a constant tick-timer searching for item in inventory or in dungeon level, etc.
either way, you would call the item and have it destroy(), like by id:
or by entity:
or maybe:
either way, you would call the item and have it destroy(), like by id:
Code: Select all
hammer_1:destroy()Code: Select all
if findEntity(hammer) then findEntity(hammer):destroy()Code: Select all
local thething = findEntity(hammer)
if thething then
thething:destroy()
endFinished Dungeons - complete mods to play
- undeaddemon
- Posts: 157
- Joined: Fri Mar 02, 2012 3:38 pm
Re: Script - Return Weapon to Alter
That is what I am looking for... set the the item down anywhere, and it returns to an alter. The logic being anyone who wields the weapon, should they die, it would return to the place.
Thanks
Thanks
Re: Script - Return Weapon to Alter
Well for that, you might want to use an onDie hook for the champion.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!
- undeaddemon
- Posts: 157
- Joined: Fri Mar 02, 2012 3:38 pm
Re: Script - Return Weapon to Alter
Well.. I meant.. like from a story perspective.. not for the champions.. as they dont drop items when they die... right?

Re: Script - Return Weapon to Alter
Nope. Champions retain all inventory even in death by default.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!
Re: Script - Return Weapon to Alter
then you can have a constantly running timer with a short duration like 0.5s, always triggering a script that checks all the slots of all the champions and also checks the mouse, looking for the item. if it's not found in any of those places, it must have been dropped within the past 0.5s, then do the destroy/spawn
Finished Dungeons - complete mods to play
- undeaddemon
- Posts: 157
- Joined: Fri Mar 02, 2012 3:38 pm
Re: Script - Return Weapon to Alter
Hi, I need [please please please] some help here - as when I exported my dungeon to playtest some stuff, I got a crash from a script I use.
Can someone look at this to see if it is explainable?
Script:RemoveBladeDrop_1
ErrorLog:
And to add a little more detail - the script was called via hidden plate - just before I clicked on the crystal, which explains the log portion where you see savegame and autosave.
Thanks!
UD
Can someone look at this to see if it is explainable?
Script:RemoveBladeDrop_1
Code: Select all
function itemCheck(item)
for champ = 1,4 do
for slot = 7,8 do
x = party:getChampion(champ):getItem(slot)
if x ~= nil then
if x.name == item then
party:getChampion(champ):removeItem(slot)
returnItem(item,champ)
end
end
end
end
end
function returnItem(item,champ)
altar_1:addItem(spawn("BladeOfLightning"))
hudPrint("The Blade of Lightning yanks from your hand,")
hudPrint("and flies through the air, out of sight!")
playSound("lightning_bolt_hit")
end
function checkBlade()
itemCheck("BladeOfLightning")
endCode: Select all
scriptRemoveBladeDrop_1: cannot serialize table 'x' with metatable
stack traceback:
[C]: in function 'error'
[string "ScriptEntity.lua"]: in function 'saveValue'
[string "ScriptEntity.lua"]: in function 'saveState'
[string "GameMode.lua"]: in function 'saveGame'
[string "GameMode.lua"]: in function 'autoSave'
[string "Crystal.lua"]: in function 'onClick'
[string "GameMode.lua"]: in function 'mousePressed'
[string "GameMode.lua"]: in function 'update'
[string "Grimrock.lua"]: in function 'display'
[string "Grimrock.lua"]: in main chunk
OS Version 6.2
OEM ID: 0
Number of processors: 8
Page size: 4096
Processor type: 586
Total memory: 16349 MB
Free memory: 8289 MB
Display device 0:
Device name: \\.\DISPLAY1
Device string: NVIDIA GeForce GTX 670
State flags: 08000005
Display device 1:
Device name: \\.\DISPLAY2
Device string: NVIDIA GeForce GTX 670
State flags: 00000001
Display device 2:
Device name: \\.\DISPLAY3
Device string: NVIDIA GeForce GTX 670
State flags: 00000000
Display device 3:
Device name: \\.\DISPLAY4
Device string: NVIDIA GeForce GTX 670
State flags: 00000000
And to add a little more detail - the script was called via hidden plate - just before I clicked on the crystal, which explains the log portion where you see savegame and autosave.
Thanks!
UD
