This question was
closed Nov 08, 2015 at 10:38 AM by
Vylax for the following reason:
The question is answered, right answer was accepted
C# Inventory items use help
Hi, in the game I made I have a short inventory system(I found it on a forum) (don't like rpg inventory) and I need help to use item, my script :
//.......
if (!remove)
{
currentItem = slot1;
messageint = 100;
messagetext = slot1 + " Used";
ActivateItems(currentItem);
slot1 = "Empty 1";
}
//......
void ActivateItems(string slot)
{
}
I have différent items : Key, Meditkit and etc... I want to be help to complete the void ActivateItems. What must I put it inside ? (sorry for my bad english)
Comment
Best Answer
Answer by NightLucididty · Nov 07, 2015 at 03:47 PM
Well it really depends on what you want the items to do, If I were you I would make an if statement checking what this "Item" is, So something like this
void ActivateItems(string slot) {
if(currentItem == "Key") {
//open door (You add your own thing)
}
if(currentItem == "MeditKit") {
//Heal player (You add your own thing)
}
if(currentItem == "Potion") {
//Make player fly or watever (You add your own thing)
}
if(currentItem == "Alarm") {
//Attract other players/enemys (You add your own thing)
}
}
Thats all I can say with what you have given me... Maybe with more info I could help in a better way.