pokemon battle start
hi i would like to know how can i initiate battle like pokemon using triggers?
Answer by Scribe · Apr 28, 2016 at 02:39 PM
Well I'm pretty sure if you have a gridbased system like pokemon, you would just have an OnMove method, that checks the the tile you are moving to for a 'probability' of triggering an attack. Then if some random number is less than that probability, you initiate the attack sequence.
If you want to do it with triggers, you would give each 'attack' square a trigger with some tag like 'attackTrigger' and then do something like:
void OnTriggerEnter(Collider c){
if(c.CompareTag("attackTrigger")){
if(someProbability < Random.value){
Debug.Log("attack!");
}
}
}
And thanks and could you email me as your script knowledge might be helpful and you will get credited in the game
I am not currently in a position where I can offer that kind of help, however if you put a little more effort into the asking of the question, there is no end to the help you receive here. SOme tips for getting good answers:
Show us code, perhaps several examples of what you have tried and written yourself.
Tell us which part is not working correctly, ask about a specific part, 'why is this method not working'.
If you find it hard to explain the issue, draw some pictures.
If you really want some personalised coding help then you should probably post in Commercial job offering if you are willing to pay, or Non-Commercial collaboration though I think it is unlikely you will find anyone there willing to give free tutoring. There are thousands of tutorials online as well, it is likely that you can find one very similar to what you wish to achieve.
Your answer
![](https://koobas.hobune.stream/wayback/20220612075806im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
looking for a way to register Input from the UI canvas and such 0 Answers
Buggy "Floor Drag" Camera 0 Answers
Space Battle AI issues 0 Answers
cant get a target menu open JRPG 1 Answer
Character Battle Menu 0 Answers