• 🏆 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 Trigger Systems, help plz

Status
Not open for further replies.
Level 2
Joined
Jun 29, 2012
Messages
17
Hi, I am making a Pokemon map and want to incorporate catching, summoning, and unsummoning and so am trying to create triggers so that multiple players can do these things. So far it has been rather difficult and so I would appreciate any and all help.

I have made this trigger which I think is succesful in catching a pokemon and storing its values in a hashtable, but I am unsure of how to recall the values to later summon the pokemon and store it in a pokeball as well(to be summoned and unsummoned over and over again just like a pokeball). This would need to be able to be done by multiple players and for multiple pokemon and pokeball storage, so you see where it may get difficult...

Here is the trigger so far
  • pokeball test with player unit groups
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Catch for Pokeball (Item)
      • (Percentage life of (Target unit of ability being cast)) Less than or equal to 25.00
      • (Unit-type of (Target unit of ability being cast)) Equal to Charmander
    • Actions
      • Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Triggering unit)) and Retain color
      • Set pokecustomvalue = (pokecustomvalue + 1)
      • Unit - Set the custom value of (Target unit of ability being cast) to pokecustomvalue
      • Hashtable - Save Handle Of(Target unit of ability being cast) as pokecustomvalue of (Player number of (Owner of (Triggering unit))) in CaughtPokemon
      • Set pokemonunit = (Load pokecustomvalue of (Player number of (Owner of (Triggering unit))) in CaughtPokemon)
      • Unit - Move (Target unit of ability being cast) instantly to (Center of caught region <gen>)
      • Hero - Create Pokeball - Charmander and give it to (Triggering unit)
      • Set pokeballcustomvalue = (pokeballcustomvalue + 1)
      • Hashtable - Save Handle Of(Last created item) as pokeballcustomvalue of (Player number of (Owner of (Triggering unit))) in CaughtPokeball
      • Set pokeballcaught = (Load pokeballcustomvalue of (Player number of (Owner of (Triggering unit))) in CaughtPokeball)
Any help appreciated, thanks.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Well.. I guess you use an Item to catch pokemons, and that you can only catch 6 different pokemons.

You can store the Unit Type ID of the Catched Pokemon (GetHandleId() of the Target Unit of Ability Being Cast) into the ID of the Used Item (GetHandleId() of the Item Being Manipulated).

Remove the pokemon where you casted the ability, and from there on just create a new on whenever you use that item, "Create 1 (Load 1 of Item ID from Hashtable) at location..."

That way you have the ID of the Pokemon you used the pokeball on, and will remain there untill you, somehow, clean the pokeball.
 
Level 2
Joined
Jun 29, 2012
Messages
17
Could you please trigger this, I can't see it in my head.
How would I make one trigger which is able to store any caught pokemon individually into individual pokeballs and able to be summoned, unsummoned later on?
I was able to designate a pokemon to a pokeball with a couple triggers, but wasn't able to devise a way to do it with multiple pokemon and pokeballs, and also could not summon again after summoning and unsummoning once.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Ok... you should be able to get the hang of it.

It creates a Dummy Pokeball and moves it towards the targeted Pokemon: I used a Random Integer as the chance to catch, but you can use the Life % or anything you want.

When the Pokemon it catch, a different Item is created (Pokeball, not Empty Pokeball). That one has the ID of the Unit Type of the catched Pokemon. If you click it, it will create a unit of the same unit type of your catched pokemon at your position

It still requires working on returning the Summoned Pokemon to its pokeball with it's current HP and Mana. Also requires some kind of "Pokeball Clean" system if you want to remove a Pokemon from a Pokeball. It may have some leaks related to hashtable data storage. It can still be greatly improved removing bj's and locations and some other stuff. It also requires Throwing the Pokeball to Summon as to Catch... This, and some other stuff were just too easy as to do it myself, I just wanted to give you some help with your problem, and here it's :p Ask if you have any doubt.
 

Attachments

  • Pokemon Catch.w3x
    44.2 KB · Views: 65
Level 2
Joined
Jun 29, 2012
Messages
17
Thank you, but it seems as if this will not work for being able to catch multiple pokemon for multiple players. Furthermore, the pokemon I want to be heroes, not units, so the pokeball would have to recall the specific unit, not just a unit of the same type as that caught.

EDIT: It is so cool though how you made it that you can see the pokeball being thrown.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Ok, but you can base the system on this. You can "hide" the catched pokemon and "unhide -> move instantly" to make it summon The same catched unit. That would be the easiest way.

It does work for any amount of players and any amount of pokemons. Each Pokemon will be saved on the Item ID. Obviously, you would have only 1 Pokemon per pokeball.
 
Level 2
Joined
Jun 29, 2012
Messages
17
Right, I know how to do this with one unit. The question is, how do I do it so multiple players can do it with multiple units? I can't tell based on the trigger, can you please show me?
One problem I ran into is how to recall the precise pokemon data? I think that as is the pokemon summoned for each player will all be the same pokemon last stored in trigger. Not sure how to fix this.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Empty Pokeballs are used to catch pokemons. If it succeds, it creates a Pokeball. The Unit-Type ID of the catched pokemon is stored within the Pokeball, so, A pokeball will only summon the Unit it Catched, and will summon it for the one who uses the Pokeball.

Any player can use an Empty Pokeball on any unit, and the unit will remain stored in the Pokeball If it succeeds. This is MUI. 12 players can be Catching and Summoning Pokemons without any bug.

As I said, there are several problems that need to be fixed to make the system "perfect"... Right now, if there's a pokeball going towards a unit while the unit is catched, the Pokeball floats to the center of the map :p...

I just wanted to make something basic, you just need to twit it a bit more to adjust it the way you want.

I'm using "Remove Unit". You can use "Hide unit" and, when you summon it, you Unhide it and Move it to the position where you used the Pokeball. The Specific Unit Data can be get with "GetHandleId(whichunit)" The specific Unit-Type Id is "GetUnitTypeId(WhichUnit)". I'm using "GetUnitTypeId", but if you want the same unit, you can use the HandleId of the specific unit to handle it however you want. I mean, you can access to any unit you want if you want the Handle Id, which is an specific number that each object in the map has. It's unique, so, it's safe to use it.

As you can see in the Triggers, when you use the Empty Pokeball I create a Dummy Unit that looks like a Pokeball. I save the target unit Handle ID in the ID of that pokeball, and I order the pokeball to move towards that Unit, using it's ID. So, i add the pokeball to a Group and I order every unit in that group to move towards the Target Unit that's saved within each unit ID in that group. This makes every order and action independent from each other. You can have 1 pokeball, or 100 pokeballs, each one will do it's task by separate.

Same happens with the Pokemon in a Pokeball, the Pokemon data (in this case, the Unit-Type ID) is stored within the Item itself. You can also store, skills, experience, Hp, and any other attribute, but, as said, it's easier if you use "Hide" and "Unhide" :p
 
Level 2
Joined
Jun 29, 2012
Messages
17
But, how do I store the unit Id of a specific hero unit(as every pokemon will be a hero type unit) to the pokeball? Storing unit type does not help much because it needs to keep track of the specific individual pokemons, their levels, stats, items being carried, etc.

I don't mind about the animation for the time being, I am only worried about the other triggers.
There seem to be several problems with what you suggest:
When hiding a unit, how do u specifiy which unit to hide? The same with unhiding. I need to see the triggers as I am unsure of how to do this. It seems very difficult because each individual caught pokemon must have a separate id which I don't know how to store and recall.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Q: When hiding a unit, how do u specifiy which unit to hide?
A: By the Handle ID. "GetHandleId()" gives you the specific ID of the Unit, and you can always manage the unit by it's ID. The same thing with Unhiding. A unit ID can be 27401778492674 You can hide "27401778492674" and unhide "27401778492674". GetHandleId gives you the specific ID of that unit, GetUnitTypeId() gives you that unit Type ID.

In the map I stored the UnitTypeId as 0 of ItemID in the PokeHash. Now I changed it to work with the Specific unit Handle ID

Here, I improved it a bit. Fixed some bugs and made it prettier. I Started working with a bit of JASS, it's easier, faster, and more efficient. Tried to explain most of it to make it easier for you to understand.
 

Attachments

  • Pokemon Catch.w3x
    44.6 KB · Views: 70
Level 2
Joined
Jun 29, 2012
Messages
17
That's awesome, thanks. It seems to work perfectly. I don't understand JASS though so I can't fool around with it, like with inserting heroes instead of regular units and such, making certain conditions, and all that. Can you post it in GUI please?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
This already works the same for heroes and regular units.

JASS's almost the same than GUI, it's not so hard having my comments to let you know what's everything you see, and what every line means.

The Triggers I turned to JASS are pretty easy, and they're almost like they would look in GUI. Turning them to GUI again would be a waste of time, since I would have to make them again. The best option is you decide to learn some basics of JASS.

Let me know what you want to Add, remove or Modify, and I'll teach / explain / do it for you.
 
Level 2
Joined
Jun 29, 2012
Messages
17
Thank you so much for your continued help.
Ok then, I suppose I will have to learn a bit of JASS, but just so you know, I know absolutely nothing lol. So I would like to make a ton of pokemon of course, probably around 100, and they will all be hero types which can evolve. So how would I incorporate all these new pokemon into the triggers you made? I also want to have 5 different types of pokeballs, pokeball, greatball, ultraball, safariball, and masterball. So I also don't know how to add these different types into the mix. I also would like to have conditions which increase the chance of catching the pokemon(barring the masterball), such as target's hp, pokeball being used, and status, if the target is asleep or paralyzed.

Also, if you could explain how you were able to recall specific values for each stored pokemon and pokeball? Seems confusing and as I said I don't know JASS so it's difficult to look at the trigger you made, albeit helpful as it is.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
You can make as many Pokemons as you want, and make them Heroes or Units (tough I would make them regular units and handle experience and skills with triggers... I just don't like heroes), there's no implication with that and the triggers. That trigger will work for as many units as you want to. Even if they evolve.

About different Pokeballs, you could create 1 dummy for each one, and save in the dummy Unit-Type ID the chance to catch and any other value you want to use in the catching equation, even the special effect you want to display based on the Pokeball, and recall all that data on the Periodic Trigger. Right now it says "If Random Integer between 1 and 2 is equal to 1" but you can use other values, as example:

0 of ID in Hash = The Creep the Pokeball Aims to
1 of ID in Hash = The Base Chance to catch 40, 55, 70, 85, 100, based on the Pokeball type
2 of ID in Hash = Bonus chance if the unit is sleep or paralized (5, 10, 15, 20)
3 of ID in Hash = The Creep HP % influence ratio that reduces the chance to catch (1, 0.75, 0.50, 0.25)
etc...

Then you just do the math in the conditions you find in the Periodic Trigger in the same place where right now there's just the Random Number Between 1 and 2 condition.

You recall specific data as showed before :) When you catch a pokemon you can store any information you want in the PokeHash slots (0, 1, 2, 3, 4, 5... infinite) and use it later however you want.

Lets say you have Electric and Water Pokemons... you can save in the Unit-Type ID of those pokemons and special Electric Effect and Water Effect when one of them is catched, lets say, in slot 4 of the Unit-Type ID... Then you just create and special effect using the model that's stored in Slot 4 of the Catched Unit ID... and the magic happens :)
 
Level 2
Joined
Jun 29, 2012
Messages
17
When I try to export and import the trigger data into another map I get errors on certain lines such as expected function missing and something like this. So then I also imported the object data because I figured that this was the reason there were errors in the triggers. Still didn't work. Should I import the odject data first?

I have only just begun to look at JASS tutorials, so how would I make it so that only one pokemon can be out at a time. As it currently works, a player can summon all of the pokemon he has contained within his pokeballs, which is totally logical, but not how I want the trigger to work for my map. Also, for the same reason, I still am not quite sure how to incorporate the conditions, nor code a experience system in JASS. It seems much easier in my mind to just have the pokemon be heroes. Only thing is, if they evolve and the unit needs to be replaced, how would I maintain that this evolved pokemon is still stored within the same pokeball as the previously unevolved pokemon, and will consequently be able to be summoned and unsummoned from this pokeball? The deeper we dig, the more complicated it gets hah. I see that you have set it up so that a limitless number of conditions may be instated, but am not sure how to do this either.


So obviously it would be easier for me to import your trigger and object data(I assume), and will of course give you credit. If you don't mind continuing to help with this. I am trying to read the tutorials, but it seems it would take me a year before I'd be able to make a trigger that you just made, and of course want to finish the map sooner. Only, if I get a head start on all the terrain and then import the triggers and object data, how do I avoid the aforementioned problems occuring on the lines of your triggers(expected data missing and stuff like that...)?

Thanks again.


EDIT: I have just thought of a cool feature by which players may trade pokemon by dropping their pokeballs with contained pokemon and switching with that of another player(to a more complicated trading process I would not be opposed, but this seems easiest). Would it be possible then, to make a trigger for this so that when a player drops a pokeball with the intent to trade(maybe each player will type a message to make this coherent, such that red types, -trade with blue, and blue types -trade with red), and the ownership of the pokemon changes to the new owners. If you feel like it though, I am totally fine without having this. Also makes me think that the pokemon could remain neutral, not under any players control even after being caught, and when summoned from pokeball react with a certain; this would make trading easier as well. Just an idea and probably too crazy for now. This goes against what you made so far though lol, so probably we should just forget it.

EDIT 2: When I tried to add a hero, archmage, from unit layer to your map, and then test, I got the message pokemon summon disabled due to some error, and also when map starts, it says periodic timer off. Any idea?

Errors that came up, not sure if these were all of them:
Line 300 - invalid argument type(unknown type)
Line 303 - expected a code statement(unknown type)
Line 358 - expected a function name(unknown type)

So this seemed to happen on more than one occasion, when I imported the trigger data, and later when I tried to add an Archmage. Then your original map wasn't even working so I redownloaded it. I think due to these same errors. Is it that player 1 red can only have one hero type to use the pokeballs and creating a second hero messed it up?
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
When I try to export and import the trigger data into another map I get errors on certain lines such as expected function missing and something like this. So then I also imported the object data because I figured that this was the reason there were errors in the triggers. Still didn't work. Should I import the odject data first?

You have to create Location1, Location2, Location3, PokeballGroup, PokeHash, Unit, Unit2, ID, ID2, Angle, variables (I'm not sure if they're all). You also have to be sure that the Pokeball (Catch) and Pokeball (Summon) Raw ID (Press CTRL+D to see Raw ID in the OE) are the same than in the Trigger ('xxxx'), and that the PokeballSummon Item ID is the same than the Pokeball ID in the OE.

I have only just begun to look at JASS tutorials, so how would I make it so that only one pokemon can be out at a time.
I created a Boolean called "AlreadySummoned" False means you haven't summoned any pokemon, True means you have already summoned. I also created an Ability that's given to the Pokemons called "Return to Pokeball", this can be done in another way (Give the ability to the trainer and use it in the Pokemon you want to hide, or the one that's already out automatically, that's easy). Changed a bit the "Pokemon Summon" to work with the AlreadySummoned boolean.

Only thing is, if they evolve and the unit needs to be replaced, how would I maintain that this evolved pokemon is still stored within the same pokeball as the previously unevolved pokemon, and will consequently be able to be summoned and unsummoned from this pokeball? The deeper we dig, the more complicated it gets hah. I see that you have set it up so that a limitless number of conditions may be instated, but am not sure how to do this either.

The same way you save the ID of the Pokemon into the Pokeball, save the ID of the Pokeball into the Pokemon.
JASS:
Set PokemonID = GetHandleId(GetTriggerUnit()) // The ID of the Pokemon
Set PokeballID = LoadInteger(udg_PokeHash, PokemonID, 0) // The ID of the Pokeball stored in the ID of the Pokemon
Set EvolvedPokemonID = GetHandleId(bj_lastCreatedUnit()) // The ID of the Evolved Pokemon

call SaveInteger(udg_Pokehash, ID, 0, EvolvedPokemonID) // Hashtable save Integer
call RemoveUnit(Pokemon) // Remove the old pokemon

After that, everything remains working the same.

So obviously it would be easier for me to import your trigger and object data(I assume), and will of course give you credit. If you don't mind continuing to help with this. I am trying to read the tutorials, but it seems it would take me a year before I'd be able to make a trigger that you just made, and of course want to finish the map sooner. Only, if I get a head start on all the terrain and then import the triggers and object data, how do I avoid the aforementioned problems occuring on the lines of your triggers(expected data missing and stuff like that...)?

Just pay attention to the Raw ID of the Abilities and Items i'm using in the Triggers. You'll get the Hang of it in no time. I'll add some comments to help you find the correct abilities/items for the triggers.

EDIT: I have just thought of a cool feature by which players may trade pokemon by dropping their pokeballs with contained pokemon and switching with that of another player(to a more complicated trading process I would not be opposed, but this seems easiest). Would it be possible then, to make a trigger for this so that when a player drops a pokeball with the intent to trade(maybe each player will type a message to make this coherent, such that red types, -trade with blue, and blue types -trade with red), and the ownership of the pokemon changes to the new owners. If you feel like it though, I am totally fine without having this. Also makes me think that the pokemon could remain neutral, not under any players control even after being caught, and when summoned from pokeball react with a certain; this would make trading easier as well. Just an idea and probably too crazy for now. This goes against what you made so far though lol, so probably we should just forget it.

This can already be done :) You can give any pokeball to anyone, since the Pokemon is inside the Pokeball, doesn't matter if you drop it or anything else. I'll add a line to give ownership of unhidden unit to the triggering player.

EDIT 2: When I tried to add a hero, archmage, from unit layer to your map, and then test, I got the message pokemon summon disabled due to some error, and also when map starts, it says periodic timer off. Any idea?

The "Periodic Trigger is OFF" Message is placed there to know if the Periodic Trigger is ON or OFF, just for testing purposes. You can find it in the Periodic Trigger and delete or disable that action. I'll delete it.

If a Trigger Gets Dissabled is because there's something missing in it, like variable, or something is wrong. It just requires 1 character to be out of place in order to disable the trigger :).

<< EDIT >>

I'm working on the map to make the changes and add some more comments.

<< EDIT >>

· Created a trigger called "Evolve List" that's run in Map Initialization. What you do there is save all the Evolutions.
JASS:
function Trig_Evolve_List_Actions takes nothing returns nothing

/*
 Hashtable: The Hashtable name
 Poke: The Pokemon that evolves to NewPoke
 Slot: The Number in the Unit-Type ID where i'll save the Unit-Type of the Evolved Unit
 NewPoke: The Evolved form of the Poke
*/

//                Hashtable   |  Poke  | Slot  | NewPoke
call SaveInteger(udg_PokeHash,  'hfoo' ,   0   , 'hkni'  ) // Footman -> Knight
call SaveInteger(udg_PokeHash,  'hkni' ,   0   , 'hmtt'  ) // Knight -> Siege Engine
call SaveInteger(udg_PokeHash,  'hmtt' ,   0   , 'hfoo'  ) // Siege Engine -> Footman

endfunction

· Made some small changes on the periodic trigger to save the Pokeball ID into the Catched Pokemon ID.
· Retained the Debug Messages untill. It's better to leave it that way untill we're really sure there are no problems. (Mainly on the Periodic Trigger)
· Gave ownership of summoned Pokemon to the User of the Pokeball.
· Made it so only 1 Pokemon can be out at the time for each player
· Made the Pokemon Evolution Trigger that automatically evolves the unit to the Evolved form you saved in the "Evolve List" trigger.
JASS:
function Trig_Pokemon_Evolution_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A003' // Ability: Evolve
endfunction

function Trig_Pokemon_Evolution_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit() // Triggering Unit
    local real ux = GetUnitX(u)
    local real uy = GetUnitY(u)
    local integer UType = LoadInteger(udg_PokeHash, GetUnitTypeId(u), 0)
    local unit NewPoke = CreateUnit(GetTriggerPlayer(), UType, ux, uy, bj_UNIT_FACING)
    local integer uID = GetHandleId(u) // ID of the Evolving Pokemon
    local integer NewPokeID = GetHandleId(NewPoke) // ID of the Evolved Pokemon
    local integer PokeballID = LoadInteger(udg_PokeHash, uID, 0) // ID of the Pokeball
    
    call SaveInteger(udg_PokeHash, NewPokeID, 0, PokeballID) // Saving the ID of the Pokeball into the NewPoke
    call SaveUnitHandle(udg_PokeHash, PokeballID, 0, NewPoke) // Saving the ID of the NewPoke into the Pokeball
    
    call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Other\\Levelup\\LevelupCaster.mdl", ux, uy)) // The Special Effect
    
    DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 10, GetUnitName(u) + " |cffff0000Evolves to|r " + GetUnitName(NewPoke))
    
    call RemoveUnit(u)
    
    set u = null
    set NewPoke = null
endfunction

//===========================================================================
function InitTrig_Pokemon_Evolution takes nothing returns nothing
    set gg_trg_Pokemon_Evolution = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Pokemon_Evolution, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Pokemon_Evolution, Condition( function Trig_Pokemon_Evolution_Conditions ) )
    call TriggerAddAction( gg_trg_Pokemon_Evolution, function Trig_Pokemon_Evolution_Actions )
endfunction
· Changed some icons to make it prettier
· Fixed some bugs with the abilities, since all of them were based on Channel but had the same OrderString and Base Ability ID
· Units already have the Evolve Ability for you to test. You'll have to create the triggers to give the ability to the units when they meet the requirements, or leave it there by default and make it work only when they meet the requirements.

· Don't use "Return to Pokeball" if you haven't already catched it with the Pokeball :p Catch it first, then do whatever you want.
· Don't catch yourself xD
 

Attachments

  • Pokemon Catch.w3x
    47.1 KB · Views: 68
Last edited:
Status
Not open for further replies.
Top