07-07-2009, 11:52 AM
How to make a GHI item a requirement for a GHI item
((Another chapter in the DuskWolf GHI tutorials, I would have posted this in the articles and guides but it would not let me do pictures there))
This would be useful to make things like a lock and key, tobacco for a pipe, and thousand other uses.
First we must make an Item ID finder. Every item has an ID normally you would have to get into the code to find it but with this nifty little device you can find the ID right in game. This would be more of an OCC item.
To make the device we need to make a new item, name it, pick icon. I named mine ID finder and picked a telescope for a icon. Then hit next to get to the next screen, now in the drop down box select “Script†and click “Add newâ€Â. You will get big empty box.
![[Image: ID.jpg]](http://www.evolo.org/coth/GHI/ID.jpg)
In that box put this code
Click ok then Finish and you are done.
Now you can right click the ID finder, it will turn you curser blue and then you click on any GHI Item and it will print out its ID in the chat frame.
Now it is time to make the GHI item requirement, I am going to make a Chest with a key.
First make the key it dose not need any thing special just a name and a icon. Of coarse you can add what ever you want to it.
Now use your ID finder and find the ID.
Next make a new item you want the requirement for, your locked chest. Name, icon and what ever else you want and go to the next screen. There you can make it a bag by selecting “bag†in the drop down menu and clicking “add newâ€Â. You may choose how many slots you want in the bag and hit ok.
Now comes the important part of clicking the “Run Always†so it changes to “Is Fulfilledâ€Â
Last we make the requirement. Select Requirement from the Drop down menu and Click “Add Newâ€Â. When the Requirement frame shows up select Lua Statement from the drop down menu. In the requirement filter box put this code
![[Image: LuaState2.jpg]](http://www.evolo.org/coth/GHI/LuaState2.jpg)
This checks sees how many items with that ID do you have and if it is greater than 0 then you have fulfilled the requirement. Replace Corwin_42671262 with what ever you items ID is. Make sure you put the ID is quotes. Click finish and you are done.
![[Image: end2.jpg]](http://www.evolo.org/coth/GHI/end2.jpg)
And that's it, not too hard and the uses are limitless.
Let me know if you have any questions
((Another chapter in the DuskWolf GHI tutorials, I would have posted this in the articles and guides but it would not let me do pictures there))
This would be useful to make things like a lock and key, tobacco for a pipe, and thousand other uses.
First we must make an Item ID finder. Every item has an ID normally you would have to get into the code to find it but with this nifty little device you can find the ID right in game. This would be more of an OCC item.
To make the device we need to make a new item, name it, pick icon. I named mine ID finder and picked a telescope for a icon. Then hit next to get to the next screen, now in the drop down box select “Script†and click “Add newâ€Â. You will get big empty box.
![[Image: ID.jpg]](http://www.evolo.org/coth/GHI/ID.jpg)
In that box put this code
Code:
GHI_ID ={};
GHI_ID.cursorFeedback = function(id)
if id then
local name = GHI_GetItemInfo(id);
GHI_Message(name..": "..id);
end
end
GHI_SetCursor("choose_item",GHI_ID);
Click ok then Finish and you are done.
Now you can right click the ID finder, it will turn you curser blue and then you click on any GHI Item and it will print out its ID in the chat frame.
Now it is time to make the GHI item requirement, I am going to make a Chest with a key.
First make the key it dose not need any thing special just a name and a icon. Of coarse you can add what ever you want to it.
Now use your ID finder and find the ID.
Next make a new item you want the requirement for, your locked chest. Name, icon and what ever else you want and go to the next screen. There you can make it a bag by selecting “bag†in the drop down menu and clicking “add newâ€Â. You may choose how many slots you want in the bag and hit ok.
Now comes the important part of clicking the “Run Always†so it changes to “Is Fulfilledâ€Â
Last we make the requirement. Select Requirement from the Drop down menu and Click “Add Newâ€Â. When the Requirement frame shows up select Lua Statement from the drop down menu. In the requirement filter box put this code
Code:
GHI_CountItem("Corwin_42671262") > 0
![[Image: LuaState2.jpg]](http://www.evolo.org/coth/GHI/LuaState2.jpg)
This checks sees how many items with that ID do you have and if it is greater than 0 then you have fulfilled the requirement. Replace Corwin_42671262 with what ever you items ID is. Make sure you put the ID is quotes. Click finish and you are done.
![[Image: end2.jpg]](http://www.evolo.org/coth/GHI/end2.jpg)
And that's it, not too hard and the uses are limitless.
Let me know if you have any questions