mob
verb
crafter()
switch(alert("Are you sure?","Start Chuunin Tournament","Kunai","No"))
if("Kunai")
for(var/obj/A in usr.Inventory)
if(findtext("[A]","Kunai"))
if("[A.name]"=="Kunai")
if(A.amount>=10)
src.RemoveInventory(new/obj/Attack/Weapons/Kunai,10)
usr<<"works"
src.AddInventory(new/obj/Attack/Weapons/LargeShuriken,1)
else
usr<<"[A.name]"
usr<<"You need 10 kunais"
return
ID:2038794
Feb 17 2016, 3:53 pm
|
|
so basically i think im close to figuring it out but idk what to do. im trying to do a check for a certain item in the inventory then do a amount check to see if i can craft it but the debug code keeps listing the first item in the inventory hwo can i get this working?
|
I should point out that this is not a robust crafting system at all. If you want to use crafting for more than one thing, I would suggest setting up a more generic way to handle all of this.
|
i wish i could but the problem is the way the inventory system is done im kinda forced to do it crudely
|
In response to Mastergamerxxx
|
|
Mastergamerxxx wrote:
i wish i could but the problem is the way the inventory system is done im kinda forced to do it crudely I can't imagine that's true. I think you're imposing a limitation on yourself that doesn't have to be there. You can get all sorts of crafting systems working with all sorts of inventory systems; they're completely orthogonal. |
In response to Mastergamerxxx
|
|
Mastergamerxxx wrote:
i wish i could but the problem is the way the inventory system is done im kinda forced to do it crudely May I ask for you to post the inventory code? I'd like to take a look at it for ya :) |
ok sure
mob/proc basically it uses a stacking system to keep track of how many of a item you have but the problem with it is it's probly highly inefficient and it probly really deeply coded and intertwine to just rip out so i was trying to figure out a craft system that would work with it. its the basic inventory code from jinketsu so i didn't personalty code it im just trying to improve stuff |
A flexible crafting system will work just fine with that. There's nothing a million copy-paste verbs can do that a single unifying system can't do better.
|
Here's something you could take a look at :)
obj/item/var |
The logic you probably want:
It translates pretty directly to DM if you know what code actually does.