Release Candidate 2 (version 1.3.1) is out!
Re: Release Candidate 2 (version 1.3.1) is out!
I'm pretty sure onItemPickup working from the inventory would end up looking exactly that "ugly hideous literally Hitler" workaround you didn't want to use, anyway.
Re: Release Candidate 2 (version 1.3.1) is out!
Not at all, because the workaround would cause me too have to check hundreds of items several times every second just too make sure they aren't moved, and if you move it and place it outside the inventory the game will crash with the error that an item of that type already exist because the "bad object" work around.Lmaoboat wrote:I'm pretty sure onItemPickup working from the inventory would end up looking exactly that "ugly hideous literally Hitler" workaround you didn't want to use, anyway.
Trust me, I did try the workaround too see if I could make it work, but was way too buggy.
Re: Release Candidate 2 (version 1.3.1) is out!
Thank you for the bug report! Unfortunately it's too late to fix these for the release but I'll add them to the bug list. Whenever we do an update we'll go through the bug list.Wolfrug wrote:I've got two crash-to-desktops to tell you about right off the bat, not sure how urgent they are but
Re: Release Candidate 2 (version 1.3.1) is out!
I'm not completely sure what you're trying to do, but if your goal is to prevent the player from removing a certain item from inventory, I'm pretty sure that can be done with the scripting interface.Lilltiger wrote:Not at all, because the workaround would cause me too have to check hundreds of items several times every second just too make sure they aren't moved, and if you move it and place it outside the inventory the game will crash with the error that an item of that type already exist because the "bad object" work around.Lmaoboat wrote:I'm pretty sure onItemPickup working from the inventory would end up looking exactly that "ugly hideous literally Hitler" workaround you didn't want to use, anyway.
Trust me, I did try the workaround too see if I could make it work, but was way too buggy.
First check every frame where the "cursed" item is in the inventory and mark the champion index and inventory slot if the item is found. Then check if the mouse item contains the cursed item. If it contains remove it from mouse item by calling setMouseItem(nil) and place it back into the inventory slot. Just create a timer that runs at very high frequency (e.g. 200hz) - this should guarantee that the code is executed every frame.
If you're worried about performance, don't be. The game engine, which is written in Lua, updates every object in the current level each frame and other levels at a somewhat slower pace - that's a lot of updates - and we don't have any performance problems even on slower computers.
Re: Release Candidate 2 (version 1.3.1) is out!
I don't think checking very often should be much of a problem. I'm no computer scientist, but I think computers are already do that sort of thing constantly anyway, so it shouldn't be a problem unless you have like 100 of them. Fixed that while thing with having to prespawn the item, so just turning off the timer should allow you to place the item without any crashes.
Code: Select all
skull = spawn("skull")
party:getChampion(1):insertItem(31, skull)
function slotcheck()
if getMouseItem() == skull then
setMouseItem(null)
party:getChampion(1):insertItem(31, skull)
end
if party:getChampion(1):getItem(31) ~= skull then
setMouseItem(party:getChampion(1):getItem(31))
party:getChampion(1):removeItem(31)
party:getChampion(1):insertItem(31, skull)
end
end
Re: Release Candidate 2 (version 1.3.1) is out!
That does not work because object references (the contents of your "skull" variable) cannot be serialized with save games.
To fix this don't hold a reference to the skull in a global variable. Use object id's or names to check the presence of the item in a inventory slot / mouse item slot.
E.g.
if getMouseItem() and getMouseItem().name == "skull" then
-- mouse item is a skull
end
To fix this don't hold a reference to the skull in a global variable. Use object id's or names to check the presence of the item in a inventory slot / mouse item slot.
E.g.
if getMouseItem() and getMouseItem().name == "skull" then
-- mouse item is a skull
end
Re: Release Candidate 2 (version 1.3.1) is out!
I completely replace the inventory with other items that fills all the slots, and non of these items should not be allowed to be swapped with another, but indeed if it is guarented to check it every frame it might be possible to do it. So a timer that activates evry 0.005 should be 200hz right?petri wrote:I'm not completely sure what you're trying to do, but if your goal is to prevent the player from removing a certain item from inventory, I'm pretty sure that can be done with the scripting interface.Lilltiger wrote:Not at all, because the workaround would cause me too have to check hundreds of items several times every second just too make sure they aren't moved, and if you move it and place it outside the inventory the game will crash with the error that an item of that type already exist because the "bad object" work around.Lmaoboat wrote:I'm pretty sure onItemPickup working from the inventory would end up looking exactly that "ugly hideous literally Hitler" workaround you didn't want to use, anyway.
Trust me, I did try the workaround too see if I could make it work, but was way too buggy.
First check every frame where the "cursed" item is in the inventory and mark the champion index and inventory slot if the item is found. Then check if the mouse item contains the cursed item. If it contains remove it from mouse item by calling setMouseItem(nil) and place it back into the inventory slot. Just create a timer that runs at very high frequency (e.g. 200hz) - this should guarantee that the code is executed every frame.
If you're worried about performance, don't be. The game engine, which is written in Lua, updates every object in the current level each frame and other levels at a somewhat slower pace - that's a lot of updates - and we don't have any performance problems even on slower computers.
I will give it a try, and hope for the best
Re: Release Candidate 2 (version 1.3.1) is out!
that sounds insane! I'm not sure how I feel from a player point of view, not too keen on being whipped around and forced into things and not allowed to do other things
Finished Dungeons - complete mods to play
Re: Release Candidate 2 (version 1.3.1) is out!
Komag: Don't worry, it will make perfect sense once you see it, I am not limiting the player from doing stuff, If I get it to work i will post a little demo of it tomorrow.
Re: Release Candidate 2 (version 1.3.1) is out!
1.3.1 working great so far~
*cough* Import to Main Dungeon *cough* hehe ( maybe allowed if we beat the game once already?
)
*cough* Import to Main Dungeon *cough* hehe ( maybe allowed if we beat the game once already?
