Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
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

avatar image
0
Question by Vylax · Nov 07, 2015 at 02:49 PM · inventoryitems

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
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

  • Sort: 
avatar image
1
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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Vylax · Nov 07, 2015 at 04:32 PM 0
Share

Thank you, that just the answer I wanted.

Follow this Question

Answers Answers and Comments

33 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Enum filter for Item system 1 Answer

Problem with using an item from inventory 0 Answers

Make LoadObjectsOfTypeAll load objects that have not been loaded 0 Answers

How to save bought items and show them on my inventory ? 0 Answers

int variable from dictionary? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges