ID:172246
 
In my coding if the user bumps into a Tower He automatically searches it.Everytime he finds something it takes it out of the Treasure List(Which is what items are inside the tower).I was wondering how to respawn the List when the user leaves the Adventure Map but only respawn the Items he searched and found.This is my code
mob
Bump(atom/movable/A)
if(isobj(A))
var/obj/O=A
spawn()
O.Bumped(src)
mob
Move()
if(move)
..()
else
return
if(istype(src.loc.loc, /area/Adventure))
if(src.client)
src.InAdventure = 1
src.Pet.density = 0
src.rundelay = 10
src.Energy -= 1
src.Adventure_panel = 1
if(src.Energy <= 0)
usr.Pet.density = 1
usr.rundelay = 2
src.InAdventure = 0
usr << "[BadMessage]You run out of Energy and finish your adventure"
src.loc = locate(1,1,2)
src.Adventure_panel = 0
obj
proc
Bumped(atom/movable/A)
Ruins
Tower1
name = "Ruins"
icon ='Ruins.dmi'
icon_state = "Tower1"
density = 1
var/list/Treasure = list(/obj/Items/Food/Mint_Leaf,/obj/Items/Food/Fruit)
Bumped(atom/movable/A)
if(ismob(A))
if(usr.action == 0)
if(usr.Energy < 5)
usr << "[BadMessage]You do not have enough Energy"
else
usr.move = 0
usr.action = 1
usr << "[NormalMessage][usr.Pet] search's the Ruin"
sleep(60)
usr.Energy -=5
usr.move = 1
usr.action = 0
if(!Treasure.len)
usr << "[BadMessage]There is No Items left In this Ruin"
else
var/Z=pick(50; /obj/Items/Food/Mint_Leaf, 5;/obj/Items/Food/Fruit, 45; "nothing")
if(Z in Treasure)
if(Z == /obj/Items/Food/Mint_Leaf)
usr << "[GoodMessage][usr.Pet] returns with Mint Leaf"
new Z(usr)
Treasure -= Z
if(Z == /obj/Items/Food/Fruit)
usr << "[GoodMessage][usr.Pet] returns with Fruit"
new Z(usr)
Treasure -= Z
if(Z == "nothing")
usr << "[BadMessage][usr.Pet] returns with Nothing"
else
usr << "[BadMessage][usr.Pet] returns with Nothing"
client
Northeast()
if(mob.InAdventure)
return 0
else
if(usr.move)
..()
else
return
Northwest()
if(mob.InAdventure)
return 0
else
if(usr.move)
..()
else
return
Southeast()
if(mob.InAdventure)
return 0
else
if(usr.move)
..()
else
return
Southwest()
if(mob.InAdventure)
return 0
else
if(usr.move)
..()
else
return
You will probably need to search for the items missing on the list, and readd them to it.
In response to Metroid
Hmm i have no idea how to do that and cant seem to find anything :/ Would i use Findtext?
Don't use usr in procs.
Make a seperate lists to store the items taken out, then when the player's done, move all of the contents in that list back into the original location.