Removing all items of one kind script (torch)
Re: Removing all items of one kind script (torch)
U want to connect all single use timers to deactivate themselves or you will have problematic infinite timing loops continuing after they are triggered.
Currently conspiring with many modders on the "Legends of the Northern Realms"project.
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
Re: Removing all items of one kind script (torch)
Sadly Wolfrug it gives me the same problem that I had yesterday.
I can never get the script to return a true value for some reason. I ended up with the "else" message no matter how I tried to connect the script to the inventory.
It is as if the script don't even do the check or that it's checking for the wrong item or not all slots.
I'm at a loss really.
Just so I know for the future (never programmed in LUA before) is "," between two numbers equal to "ranging between"?
The timer was easy to set up once I figured out I was using the counter
Thanks for the tip about the deactivation, I will make a mental note of it for future usage.
I can never get the script to return a true value for some reason. I ended up with the "else" message no matter how I tried to connect the script to the inventory.
It is as if the script don't even do the check or that it's checking for the wrong item or not all slots.
I'm at a loss really.
Just so I know for the future (never programmed in LUA before) is "," between two numbers equal to "ranging between"?
The timer was easy to set up once I figured out I was using the counter
Thanks for the tip about the deactivation, I will make a mental note of it for future usage.
Last edited by pandemo on Tue Oct 30, 2012 4:33 pm, edited 2 times in total.
Re: Removing all items of one kind script (torch)
Try this. As per the others, I have no grimrock now to test.
Code: Select all
function removeTorches()
local hastorches = false
for i=1,4 do
for v=1,31 do
if (party:getChampion(i):getItem(v) ~= nil) and (party:getChampion(i):getItem(v).name == "torch") then
party:getChampion(i):removeItem(v)
hastorches = true
end
end
end
return hastorches
end
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com
The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563
My preciousss: http://www.moonsharp.org
The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563
My preciousss: http://www.moonsharp.org
Re: Removing all items of one kind script (torch)
Sadly it does not workXanathar wrote:Try this. As per the others, I have no grimrock now to test.
Code: Select all
function removeTorches() local hastorches = false for i=1,4 do for v=1,31 do if (party:getChampion(i):getItem(v) ~= nil) and (party:getChampion(i):getItem(v).name == "torch") then party:getChampion(i):removeItem(v) hastorches = true end end end return hastorches end
Re: Removing all items of one kind script (torch)
I tried Xanathar's script and got it working fine. Note that it only removes ordinary torches, not the everburning one you get when running the game in the editor.
Re: Removing all items of one kind script (torch)
My mistake. I used destroy() instead of removeItem(). Always forget champions for some completely arbitrary reason don't have the same command for destroying items.Xanathar wrote:Try this. As per the others, I have no grimrock now to test.
-Wolfrug
Try my Mordor: Depths of Dejenol LoG-ification. Feedback much appreciated!
- SpiderFighter
- Posts: 789
- Joined: Thu Apr 12, 2012 4:15 pm
Re: Removing all items of one kind script (torch)
Also because it wastes precious CPU cycles. It's a good idea to get in the habit of always deactivating your timers in this way (once they've served their purpose); your dungeon (and players) will thank you for it.Komag wrote:timer Events are only activate, counter Events are activate, deactivate, any. Don't mix up Event and Action.
You have the timer connect to itself and Action deactivate so that it doesn't forever repeatedly try to close the door every so-many-seconds
Re: Removing all items of one kind script (torch)
gfffm, glaaargh wha wha wha say whaaaat??!Ancylus wrote:I tried Xanathar's script and got it working fine. Note that it only removes ordinary torches, not the everburning one you get when running the game in the editor.
Are you serious
Was to tired to try running the whole level trough.
Going to drop a torch, rebake with another start location. brb
EDIT: Yeay, it works *small dance around chair
Thanks guys, amazing help and only nice replies.
I'm only on level 5 in my dungeon but I'll post it as soon as that level is done for some beta testing