Return to Inventory
Re: Return to Inventory
I'm working on a related problem, I'd like to make cursed items that return after a short interval when dropped.They will be able to be destroyed only by placing them on an altar with a plate and delete item script.
Re: Return to Inventory
that's such a cool idea, where do you come up with this stuff?!
But what if everyone's inventory is full and their hands are full too?
But what if everyone's inventory is full and their hands are full too?
Finished Dungeons - complete mods to play
Re: Return to Inventory
As Montis said, a script that checks those and then drops to the floor in the event no space is free.
I'm just stuck with how to search for the presence of "something" (something being a vague item). I'm guessing that it would be easier to search for the existence of something rather than nothing, but then I'm unsure of how to do that :p
Just thinking if == means exactly equal to then is there a counter symbol like "Is not equal to"? I used to use the symbol != would that work?
I'm just stuck with how to search for the presence of "something" (something being a vague item). I'm guessing that it would be easier to search for the existence of something rather than nothing, but then I'm unsure of how to do that :p
Just thinking if == means exactly equal to then is there a counter symbol like "Is not equal to"? I used to use the symbol != would that work?
Last edited by Xzalander on Thu Sep 20, 2012 7:12 pm, edited 1 time in total.
Re: Return to Inventory
There isn't enough items in my dungeon to do that. "Burden Hands - These gauntlets are insanely heavy, but still worth two in the bush." "Chitin Trousers - Someone Chitin these trousers, but they're still wearable.I guess"Komag wrote:that's such a cool idea, where do you come up with this stuff?!
But what if everyone's inventory is full and their hands are full too?
- Montis
- Posts: 340
- Joined: Sun Apr 15, 2012 1:25 am
- Location: Grimrock II 2nd playthrough (hard/oldschool)
Re: Return to Inventory
it's ~=Xzalander wrote:Just thinking if == means exactly equal to then is there a counter symbol like "Is not equal to"? I used to use the symbol != would that work?
Re: Return to Inventory
Yeah; I thought it was.
Heres what i'm working with so far.
Sorry my ending is so bad.
The only problem with doing it this way, is... I need to know what to call the nothing or listing every single item in the game to get it pass on that item slot and then check the next one.
Heres what i'm working with so far.
Code: Select all
function itemCheck(thisItem)
for champ = 1,4 do
for slot = 7,8 do
for empty = 11,31 do
x = party:getChampion(champ):getItem(slot)
if x ~= nil then
if x.name == "torch" then
party:getChampion(champ):removeItem(slot)
print("item removed")
y = party:getChampion(champ):getItem(empty)
if y == nil then
if y.name ~= " " then
party:getChampion(champ):insertItem(y,x)
print("item put in inventory")
end
end
end
end
end
end
end
end
The only problem with doing it this way, is... I need to know what to call the nothing or listing every single item in the game to get it pass on that item slot and then check the next one.
- Montis
- Posts: 340
- Joined: Sun Apr 15, 2012 1:25 am
- Location: Grimrock II 2nd playthrough (hard/oldschool)
Re: Return to Inventory
you should try to make a simple function to print() what an empty slot returns, then you can have that as a comparison. probably nil or maybe false.
Re: Return to Inventory
Yep an empty slot is nil.
Re: Return to Inventory
i can confirm that
still brings up the error message from earlier.
i had a returnItem script which i've tested and it works, except of course you can't insertItem() xD
on a side note, this is genius ^_^
Code: Select all
x = "torch"
party:getChampion(2):insertItem(11,x)
i had a returnItem script which i've tested and it works, except of course you can't insertItem() xD
Code: Select all
function returnItem(item)
local itemReturned = false
for slot = 11,32 do
for champ = 1,4 do
if itemReturned == false then
if slot < 32 then
if party:getChampion(champ):getItem(slot) == nil then
print("item returned")
-- Disabled due to bug
-- party:getChampion(champ):insertItem(slot,item)
itemReturned = true
end
else
spawn(item,player.level,player.x,player.y,player.facing)
itemReturned = true
end
end
end
end
end
on a side note, this is genius ^_^
edit: switched round the for/do in the function, as i realised it would end up reaching 32 before checking the next character.Malveus wrote: "Burden Hands - These gauntlets are insanely heavy, but still worth two in the bush." "Chitin Trousers - Someone Chitin these trousers, but they're still wearable.I guess"
Last edited by Emciel on Thu Sep 20, 2012 7:50 pm, edited 1 time in total.
Re: Return to Inventory
Emciel;
I have it successfully reinserting a torch after removing one
HOWEVER, I cannae make it insert into the next slot available, despite it checking the slots.
This current script sets it so that the player who loses a torch, has a torch put back in its inventory.
However in the event a player is holding two torches, it doesn't work and as I said, it only puts the torch into slot 11 (backpack slot 1)
ONE STEP CLOSER!
This code now out puts whether or not the slot is available for insertion.
Now I just need to get it to check the next slot and insert.
I have it successfully reinserting a torch after removing one
Code: Select all
function itemCheck(thisItem)
for champ = 1,4 do
for slot = 7,8 do
for empty = 11,31 do
x = party:getChampion(champ):getItem(slot)
if x ~= nil then
if x.name == "torch" then
party:getChampion(champ):removeItem(slot)
print("item removed")
y = party:getChampion(champ):getItem(empty)
if y == nil then
print("Slot is available")
party:getChampion(champ):insertItem(empty,x)
print("item put in inventory")
end
end
end
end
end
end
end
HOWEVER, I cannae make it insert into the next slot available, despite it checking the slots.
This current script sets it so that the player who loses a torch, has a torch put back in its inventory.
However in the event a player is holding two torches, it doesn't work and as I said, it only puts the torch into slot 11 (backpack slot 1)
ONE STEP CLOSER!
Code: Select all
function itemCheck(thisItem)
for champ = 1,4 do
for slot = 7,8 do
for empty = 11,31 do
x = party:getChampion(champ):getItem(slot)
if x ~= nil then
if x.name == "torch" then
party:getChampion(champ):removeItem(slot)
print("item removed")
y = party:getChampion(champ):getItem(empty)
print (y)
if y == nil then
party:getChampion(champ):insertItem(empty,x)
print("item put in inventory")
else
print ("Slot not available")
end
end
end
end
end
end
end
Now I just need to get it to check the next slot and insert.
Last edited by Xzalander on Thu Sep 20, 2012 8:00 pm, edited 1 time in total.