Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by MJG1123 · May 28, 2015 at 03:13 PM · rpgturn-basedcombatpokemon

Need to code Enemy Attacking Portion of a Pokemon/Turned Based Combat System

Once the player has clicked a button to attack and the damage and such to the enemy has been calculated, I then need to run the function to calculate the damage the player takes AND DISPLAY THE TEXT/INFO the player needs to know on screen long enough/and possibly give the option to skip the text. video

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by MJG1123 · May 28, 2015 at 06:47 PM

so I found out that the Invoke () class (Video) might work if I can find a way to call a function from another script, follow this link sorry for the confusion

Comment
Add comment · 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
0

Answer by Masterben135 · May 28, 2015 at 03:45 PM

You could create a textBox gameObject once everything has been calculated, passing in a List of strings (i.e. the damage and such that has already been calculated) that the textBox object will need to display. Then in the textBox's update function, you keep a timer (using Time.deltaTime) that changes the displayed string to the next string in the List.

Also in the same update, you could check for any user input that would immediately skip to the next string. Once every string has been looped through, the gameObject is destroyed.

Comment
Add comment · Show 3 · 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 MJG1123 · May 28, 2015 at 04:15 PM 0
Share

so for example I would write my code like this (where eaTextGO is the game object for the text, and I would insert the timer at the // marks, but what would I type?

         public void EnemyAttacking ()
         {
            eaTextGO.SetActive (true);
         eaText.text = "Enemy Is Attacking... ";
         //insert timer here???
         //This is where the damage is calculated/move is picked
         enemyG.RollDice ();
         AttackName ();
         eaText.text = "Enemy Used " + enemy$$anonymous$$oveName + " ...";
         //insert timer here???
         //actual damage is substracted
         if (enemy$$anonymous$$oveName == "$$anonymous$$ick Attack")
           {
             kickAttack ();
             Debug.Log ("test");
           }
         //insert timer here???
         eaTextGO.SetActive (false);
         //this is were we switch back to allowing the player to attack
         state$$anonymous$$achine.Attack$$anonymous$$enu ();              
         }
 
 



avatar image Masterben135 · May 28, 2015 at 04:42 PM 0
Share

You're going to have to restructure that code, if you're not going to use a coroutine. You can't just insert "wait" timers in normal scripts or functions.

avatar image MJG1123 · May 28, 2015 at 05:40 PM 0
Share

I added a like to a video if helps

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

20 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

Related Questions

Need help making a pokemon turn based system ! 1 Answer

How to handle undefined targets in a composition based ability system? 2 Answers

Server software for multiplayer turn-based RPG like Pokemon 1 Answer

Move object to position, perform action, move back to starting position 0 Answers

rpg turn based attack enemy is not attacking 1 Answer


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