• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Pokemon Catch System

Status
Not open for further replies.
Level 8
Joined
Feb 20, 2020
Messages
200
Hello guys, i need a pokemon like catch system.
I know how to make it in gui, but for multiplayer it leaks a little and can be a little laggy.
if someone knows a way to make this for me without leaks of laggy i will be very thankful!

i need a trigger that works like the following:

the player have 9 basic skills in a "spellbook"

1 - throw pokeball
2 - return monster
3 - release monster
4 - summon monster 1
5 - summon monster 2
6 - summon monster 3
7 - summon monster 4
8 - summon monster 5
9 - summon monster 6

the catch system i need that works like this :

the player uses the skill "throw pokeball"
- if he have pokeballs in his inventory (pokeballs stacks)
- if the monster is from "neutral hostile" team
- if he still not have 6 monsters
get a chance of capture
chance is determined by:
- level
- type of monster (list of monster)
- health remaining of the monster
- kind of pokeball used (normal, great, ultra, master)
- food gave to the monster (if the player uses a fruit in the pokemon, inscreases his chance to capture)

if he capture the monster
than set it in the player number region
than set it in a array of player monsters to use the "summon monster 1-6" skill

player uses one of the summon skill
if there is already a summoned monster cancel the summon
if not, summon the monster in the position of the trainer and set monsters summoned = 1
so he cant summon another monster
if he uses release monster, delete the selected monster and remove it from the array
player uses return monster,
return the summoned monster
if there is no monster, nothing happens.
 
Level 8
Joined
Feb 20, 2020
Messages
200
Well, here is my code, but right now its not working...
Idk why...
someone can help me ??


upload_2020-2-29_21-24-32.png

upload_2020-2-29_21-24-59.png

upload_2020-2-29_21-25-37.png

upload_2020-2-29_21-26-30.png
 

Attachments

  • upload_2020-2-29_21-23-6.png
    upload_2020-2-29_21-23-6.png
    185.8 KB · Views: 20
  • upload_2020-2-29_21-23-35.png
    upload_2020-2-29_21-23-35.png
    52.7 KB · Views: 29
  • upload_2020-2-29_21-24-9.png
    upload_2020-2-29_21-24-9.png
    44.8 KB · Views: 21
  • upload_2020-2-29_21-25-54.png
    upload_2020-2-29_21-25-54.png
    6.6 KB · Views: 19
  • upload_2020-2-29_21-26-9.png
    upload_2020-2-29_21-26-9.png
    6.3 KB · Views: 20
Level 8
Joined
Feb 20, 2020
Messages
200
The problem is, i can't get the target of the item i used...

  • catching Copy
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (((Item-type of (Item being manipulated)) Equal to Catchball) or ((Item-type of (Item being manipulated)) Equal to Great Catchball)) or ((Item-type of (Item being manipulated)) Equal to Ultra Catchball)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MonstersCountforPlayer[(Team number of (Owner of (Hero manipulating item)))] Less than 6
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of ChoosenMonsterCatch) Equal to MonsterTeam
            • Then - Actions
              • Set VariableSet ChoosenMonsterCatch = (Targeted unit)
              • Set VariableSet OnwerofMonster = (Owner of (Hero manipulating item))
              • Set VariableSet CaptureChanceTotal = 0.00
              • Set VariableSet HealthRemaining = (Percentage life of ChoosenMonsterCatch)
              • Set VariableSet CaptureChanceTotal = (CaptureChanceTotal + (0.20 - (HealthRemaining x (0.02 / 10.00))))
              • Set VariableSet MonsterLevel = (Hero level of ChoosenMonsterCatch)
              • Set VariableSet CaptureChanceTotal = (CaptureChanceTotal + (0.30 - ((Real(MonsterLevel)) x (0.03 / 10.00))))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • KindofPokeballused Equal to Pokeball
                • Then - Actions
                  • Set VariableSet CaptureChanceTotal = (CaptureChanceTotal + 0.15)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • KindofPokeballused Equal to Greatball
                    • Then - Actions
                      • Set VariableSet CaptureChanceTotal = (CaptureChanceTotal + 0.21)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • KindofPokeballused Equal to Ultraball
                        • Then - Actions
                          • Set VariableSet CaptureChanceTotal = (CaptureChanceTotal + 0.28)
                        • Else - Actions
              • For each (Integer A) from 1 to 10, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of MonsterTryingToCatch) Equal to MonsterTypeR1[(Integer A)]
                    • Then - Actions
                      • Set VariableSet RunChance = 0.20
                      • Set VariableSet MonsterRarityModificator = 1.50
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of MonsterTryingToCatch) Equal to MonsterTypeR2[(Integer A)]
                        • Then - Actions
                          • Set VariableSet RunChance = 0.30
                          • Set VariableSet MonsterRarityModificator = 2.25
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit-type of MonsterTryingToCatch) Equal to MonsterTypeR3[(Integer A)]
                            • Then - Actions
                              • Set VariableSet RunChance = 0.40
                              • Set VariableSet MonsterRarityModificator = 3.00
                            • Else - Actions
              • Set VariableSet CaptureChanceRandom = (Random real number between 0.00 and 1.00)
              • Set VariableSet CaptureChanceFinalN = (CaptureChanceTotal / MonsterRarityModificator)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CaptureChanceFinalN Greater than CaptureChanceRandom
                • Then - Actions
                  • Unit - Change ownership of ChoosenMonsterCatch to OnwerofMonster and Retain color
                  • Unit - Move (Ownership-changed unit) instantly to (Random point in RegioPlayer[(Team number of OnwerofMonster)])
                  • Game - Display to (All players matching ((Triggering player) Equal to OnwerofMonster).) for 15.00 seconds the text: You Gotcha!
                • Else - Actions
                  • Set VariableSet RunChanceRandom = (Random real number between 0.00 and 1.00)
                  • Game - Display to (All players matching ((Triggering player) Equal to OnwerofMonster).) for 15.00 seconds the text: Not this time...
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • RunChanceRandom Less than RunChance
                    • Then - Actions
                      • Unit - Create 1 Smoke for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
                      • Animation - Play (Last created unit)'s birth animation
                      • Unit - Remove ChoosenMonsterCatch from the game
                      • Game - Display to (All players matching ((Triggering player) Equal to OnwerofMonster).) for 15.00 seconds the text: The monster run awa...
                      • Unit - Remove (Last created unit) from the game
                    • Else - Actions
            • Else - Actions
              • Game - Display to (All players matching ((Triggering player) Equal to OnwerofMonster).) for 15.00 seconds the text: You can't capture t...
              • Skip remaining actions
        • Else - Actions
          • Game - Display to (All players matching ((Triggering player) Equal to OnwerofMonster).) for 15.00 seconds the text: You reached the max...
          • Skip remaining actions
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,511
That's because you don't want to use the Event "A unit uses an item". Instead, you can use the Event "A unit starts the effect of an ability" in response to your item's ability.

This allows you to reference "target unit of ability being cast" and the rest of the useful Event Responses.
 
Level 5
Joined
Jun 12, 2016
Messages
74
Idk if you want ideas, but here is some for a simple rng easy to understand:

- level
- type of monster (list of monster)
- health remaining of the monster
- kind of pokeball used (normal, great, ultra, master)
- food gave to the monster (if the player uses a fruit in the pokemon, inscreases his chance to capture)

5 factors, so give each 0~20% chance bonus. Easy to program and no problems like negative chances or more than 100% chances.

Now you should just work on the extremes range, an example:
Level difference between you and monster, if you want it to range between 5 levels diff to -5 lvl diff would mean only half bonus at equal level and full 20% bonus at lower level, or between 5 to 0 would mean full bonus at equal level but don't get easier at lower levels.
 
Status
Not open for further replies.
Top