• 🏆 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!

Pokémon - Catching Pokémon trigger problem

Status
Not open for further replies.
Level 7
Joined
Aug 8, 2008
Messages
340
Hello there while working on my map I ran into a problem creating the Pokémon Trainers ability: Catch Pokémon.

The ability is supposed to work like this:
The trainer shoots a missile (Pokéball model) at a target (none player owned unit) enemy. Causing the unit to be hidden for about 2.94 seconds, while a dummy Pokéball is playing it's spell animation during the duration. At the end of the duration the pokéball should dissapear with the blink sound attached to it, unhiding the unit which has now been moved to another place and changed owner to the player which unit used the ability.
If owner of the casting unit is having more than 4 units (I know it is set to 7 I was testing the trigger during the time the picture was taken),
or if the casting unit diden't have a pokéball item within its inventory,
or if the taget unit of the ability was a player owned unit the ability should go on cooldown before the Pokémon Trainer would be able to throw the pokeball missile.

What the ability does:
The trainer shoots a missile (Pokéball model) at a target neutral hostile unit. Causing the unit to be hidden for about 2.94 seconds, while a dummy Pokéball aint playing any animation. At the end of the duration the pokéball should dissapear with the blink sound attached to it, unhiding the unit which has now been moved to another place and changed owner to the player which unit used the ability.
HOWEVER!

Using the ability by other trainers at the same time cause this to happend:
The trainer shoots a missile (Pokéball model) at a target neutral hostile unit. Causing the unit to be hidden for about 2.94 seconds, while one of the dummy Pokéballs is playing it's spell animation during the duration. At the end of duration one of the pokeballs dissapear with the blink sound attached to it, unhiding one of the units which has now been moved to another place and changed owner to the player which unit used the ability.
The other pokeball remains and the other caught pokemon never gets unhidden.

I only know about MUI and Jass from what I read on a forum, so my knowledge on that point is limited.

The trigger looks like this:

Your help would greatly be appreciated. :)
 

Attachments

  • Trigger Problem.png
    Trigger Problem.png
    61 KB · Views: 118
Level 14
Joined
Apr 20, 2009
Messages
1,543
It is not MUI because of using waits and global variables.
What you can do is use timers and hashtables or you could use local variables and timers.

You should see it like this:

A variable in GUI is global, so whenever some trigger gets executed simultaniously the global variable will change to a incorrect value for one of the two triggers being executed.

For example:

I have a variable called:

My_Unit

and a trigger like this:

  • MUI
    • Events
      • Player - Player 1 (Red) types a chat message containing something as An exact match
      • Player - Player 2 (Blue) types a chat message containing something as An exact match
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering player) Equal to (==) Player 1 (Red)
        • Then - Actions
          • Set My_Unit = Peasant
        • Else - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering player) Equal to (==) Player 2 (Blue)
            • Then - Actions
              • Set My_Unit = Footman
            • Else - Actions
      • Unit - Create 1 My_Unit for (Triggering player) at ((Triggering player) start location) facing Default building degrees
Now lets say in theory player 1 and 2 type something at almost the exact same time, causing the trigger to be executed simultaniously.

This means that My_Unit can be Footman for Player 1 or Peasent for Player 2 depending on who executed the trigger first.
Let's say for example Player 2 executed the trigger first.
My_Unit will be set to Footman.
But before The unit is created, Player 1 executes the trigger and the variable My_Unit will be set to Peasent.
This causes the unit being created for Player 2 to be a Peasent.

If however My_Unit was a local variable then the variable would exist locally for each trigger being executed. Which means it can not change for Player 1 or Player 2.

An example would be:
  • MUI
    • Events
      • Player - Player 1 (Red) types a chat message containing something as An exact match
      • Player - Player 2 (Blue) types a chat message containing something as An exact match
    • Conditions
    • Actions
      • Custom script: local integer My_Unit
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Triggering player) Equal to (==) Player 1 (Red)
          • Then - Actions
            • Custom script: set My_Unit = 'hpea'
          • Else - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Triggering player) Equal to (==) Player 2 (Blue)
              • Then - Actions
                • Custom script: set My_Unit = 'hfoo'
              • Else - Actions
      • Custom script: call CreateUnit(GetTriggerPlayer(), My_Unit, GetStartLocationX(GetPlayerStartLocation(GetTriggerPlayer())), GetStartLocationY(GetPlayerStartLocation(GetTriggerPlayer())), bj_UNIT_FACING)
(Unit Types are actually integer variables since they point to RAW codes which can be shown with control + D inside the object editor)

Make sure a local variable is created above all other actions in GUI.

As you can see there are no global variables any more.
They are replaced with local ones and the trigger is now MUI.

Waits are simply inaccurate.
The time that it waits is not as acurate as using timers.
This is because triggers take time to process their actions.
While a timer does not need to process anything, it simply counts.


I hope this gave some clarification on the subject.

EDIT: 1,000 posts! :D
 
Level 7
Joined
Aug 8, 2008
Messages
340
I think I understood some of it, but I am not very good with tiggering.
If what you say is the problem with my trigger, then how do i fix it?
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
If in Custom script or (Jass) a variable has udg_ infront of it, it's a global GUI variable.
So basically what you did wrong here is set a global variable to be the value of the local variable.
This makes no sense since that would be the same as using global variables entirely.

Also, you have quite some location leaks inside your trigger.
And I suggest creating a continious timer instead of using that 0,47 seconds wait.

Fix those issues and your trigger will be MUI.

(Try it yourself first, if you really can't find a solution I'll help later on by giving you the trigger)
But first I'm gonna take a shower.
 
Level 7
Joined
Aug 8, 2008
Messages
340
Well I have tried, but can get it to work. And I've been working on it for 3 days (no shit).
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
It's probably better to do it entirely in Jass.

However, there is also another solution: You might want to use UMSWE triggers.

They give more functionality which is needed to access local variables in GUI actions.

I could've also made almost every action a custom script line if you like...

Either ways this is the trigger I made with UMSWE (Which can be found in JNGP, which can be downloaded here):

  • Catch Pokemon
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Catch Pokemon
      • (Owner of (Target unit of ability being cast)) Equal to (==) Neutral Hostile
      • (Number of units in (Units in (Playable map area) owned by (Owner of (Casting unit)))) Less than (<) 7
    • Actions
      • Custom script: local unit pokeball
      • Custom script: local unit caught_pokemon = GetSpellTargetUnit()
      • Custom script: local unit catching_trainer = GetSpellAbilityUnit()
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((catching_trainer) has an item of type Pokeball) Equal to (==) True
            • (Percentage life of (caught_pokemon)) Less than or equal to (<=) 10.00
          • Then - Actions
            • Item - Remove (Item carried by (catching_trainer) of type Pokeball)
            • Set tempLoc[1] = (Position of (caught_pokemon))
            • Set tempLoc[2] = (Position of (catching_trainer))
            • Unit - Create 1 Footman for Neutral Passive at tempLoc[1] facing tempLoc[2]
            • Custom script: set pokeball = GetLastCreatedUnit()
            • Custom script: call RemoveLocation(udg_tempLoc[1])
            • Custom script: call RemoveLocation(udg_tempLoc[2])
            • Unit - Add a 2.94 second Generic expiration timer to (pokeball)
            • Unit - Hide (caught_pokemon)
            • Animation - Reset (pokeball)'s animation
            • Animation - Play (pokeball)'s spell animation
            • Start (Create Timer) lasting 0.47 and One-shot and execute (Animation - Queue (pokeball)'s spell animation) when it expires
            • Start (Create Timer) lasting 0.47 and One-shot and execute (Animation - Queue (pokeball)'s spell animation) when it expires
            • Start (Create Timer) lasting 0.47 and One-shot and execute (Animation - Queue (pokeball)'s spell animation) when it expires
            • Start (Create Timer) lasting 0.47 and One-shot and execute (Animation - Queue (pokeball)'s spell animation) when it expires
            • Start (Create Timer) lasting 0.47 and One-shot and execute (Animation - Queue (pokeball)'s spell animation) when it expires
            • Start (Create Timer) lasting 0.47 and One-shot and execute (Animation - Queue (pokeball)'s spell animation) when it expires
            • Start (Create Timer) lasting 0.47 and One-shot and execute (Sound - Play BlinkArrival1 <gen> at 100.00% volume, attached to (caught_pokemon)) when it expires
            • Unit - Change ownership of (caught_pokemon) to (Owner of (catching_trainer)) and Change color
            • Set tempLoc[1] = (Random point in Region 007 <gen>)
            • Unit - Move (caught_pokemon) instantly to tempLoc[1]
            • Custom script: call RemoveLocation(udg_tempLoc[1])
            • Unit - Unhide (caught_pokemon)
          • Else - Actions
      • Custom script: set pokeball = null
      • Custom script: set caught_pokemonl = null
      • Custom script: set catching_trainer = null
If you want I can create a trigger that is compatible with the regular World Editor consisting of a lot of Custom scripts or entirely in Jass.
Or I could create one using hashtables...

I hope that I did at least point you to the right direction ;)

EDIT: this trigger will not work, I'll create a full jass version for you.
 
Last edited:
Level 7
Joined
Aug 8, 2008
Messages
340
Thank you man. :)
When your done, please tell me what kind of variables I need to create and what to name them, in order to make your trigger work.
I'll try to add some more +rep to you, if I am able to. ;)
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Level 7
Joined
Aug 8, 2008
Messages
340
Okay, however I am grateful for your help. Tell me if you want me to send you the map, if that would make it any easyer. ;)
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Okay, however I am grateful for your help. Tell me if you want me to send you the map, if that would make it any easyer. ;)

It's not nessecary if you could tell me the RAW codes of the Pokeball item and the Pokeball unit.

(Press Control + D inside the object editor to see RAW codes)

EDIT: ow and the RAW code of the Catch Pokemon spell. I almost forgot about that one xD
 
Level 7
Joined
Aug 8, 2008
Messages
340
I've uploaded all 4 pokeball items. The reason i'm going with the if, then, else action is that i need the pokeball to be able to catch a pokemon with 10% hp, the greatball to be able to catch a pokemon with 15% hp, the ultraball to be able to catch a pokemon with 20% hp and the masterball to be able to catch a pokemon with 100% hp.

The ball unit was intented to be used in all 4 actions. ;)
 

Attachments

  • Code.png
    Code.png
    4.1 KB · Views: 106
Level 14
Joined
Apr 20, 2009
Messages
1,543
Okay so those RAW codes are the Pokebal unit and the items?
Could you also show the RAW code of the Catch Pokemon spell?

I'll implement it as soon as I found a solution for the anoying timer problem I mentioned earlyer xD
 
Level 7
Joined
Aug 8, 2008
Messages
340
Yes those 4 Pokéballs are the items and the ? is the dummy unit Pokéball.
The code for the Catch Pokémon ability is A007:AEsh. :)
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Little question:

What if a unit casts the catch pokemon ability and that unit has all 4 different type of pokeballs in his inventory?
How would you want the ability to work then?
I'm almost done, this is the only thing I'm still worrying about...

I guess you want to use the else block to make a priority on which ball should be thrown?

If the unit casting the ability has a pokeball and the unit has less then 10% life use the pokeball,
else if the unit casting the ability has a greatball and the pokemon has less then 15% life use the greatball,
else if the unit casting the ability has a ultrabal and the pokemon has less then 20% life use the ultraball,
else if the unit has a masterball use the masterball right?

EDIT: If what I said above is what you want then here is the Jass trigger (I added comments so that it's easier to understand)

JASS:
function Catch_Pokemon_Conditions takes nothing returns boolean
    //the conditions of the trigger simply converted from GUI to Jass (It's not that optimized but why would I care that much ^.^?)
    
    //ability being cast equal to Catch Pokemon
    if ( not ( GetSpellAbilityId() == 'A007' ) ) then
        return false
    endif
    
    //owner of target unit of ability being cast equal to neutral hostile
    if ( not ( GetOwningPlayer(GetSpellTargetUnit()) == Player(PLAYER_NEUTRAL_AGGRESSIVE) ) ) then
        return false
    endif
    
    //number of units in units in playable map area owned by owner of casting unit less then 7
    if ( not ( CountUnitsInGroup(GetUnitsInRectOfPlayer(GetPlayableMapRect(), GetOwningPlayer(GetSpellAbilityUnit()))) < 7 ) ) then
        return false
    endif
    return true
endfunction

//skip this function when reading this trigger for the first time, this function should be checked during the actions in the function underneath this one...
function QueueAnimation takes nothing returns nothing
    local timer t = GetExpiredTimer() //set t is the timer being expired
    local integer id = GetHandleId(t) //set id is the id of the expiring timer
    local unit u = LoadUnitHandle(udg_Catch_Pokemon, id, 1) //load the pokeball unit from the hashtable where the parent key is the id of the expiring timer
    local real duration = LoadReal(udg_Catch_Pokemon, id, 2) //load the real value from the hashtable where the parent key is the id of the expiring timer
    if duration > 0 then //if the real value being loaded is bigger then 0, reset the pokeball unit animation and decrease the value being loaded by 1
        call SetUnitAnimation(u, "spell")
        call SaveReal(udg_Catch_Pokemon, id, 2, duration - 1)
    else //if the real value being loaded is 0 (which means the timer was executed 6 times) then destroy the timer and flush the hashtable
        call PauseTimer(t)
        call DestroyTimer(t)
        call FlushChildHashtable(udg_Catch_Pokemon, id)
    endif
    set u = null
endfunction

function Catch_Pokemon_Actions takes nothing returns nothing
    local unit pokeball //the pokeball unit being created
    local unit caught_pokemon = GetSpellTargetUnit() //the pokemon being targeted by the spell
    local unit catching_trainer = GetSpellAbilityUnit() //the unit casting the ability
    local real unit_facing //for calculating the angle which the pokeball unit faces, this is for optimization purposes
    local timer t //a timer which will fire every 0.47 seconds for the pokeball animation to be reset. This will be done 6 times in a row before the timer is destroyed.
    set udg_Catch_Pokemon = InitHashtable() //a hashtable to make sure the spell becomes MUI
    
    //if the catching trainer has a pokeball and the unit being caught has less then or equal to 10% hp then
    if (UnitHasItemOfTypeBJ(catching_trainer, 'I001')) and (GetUnitLifePercent(caught_pokemon) <=10)  then
    
        //remove the pokeball item from the catching trainer
        call RemoveItem(GetItemOfTypeFromUnitBJ(catching_trainer, 'I001'))
        
        //set the unit facing to the position of catching trainer
        set unit_facing = bj_RADTODEG * Atan2(GetUnitY(caught_pokemon) - GetUnitY(catching_trainer), GetUnitX(caught_pokemon) - GetUnitX(catching_trainer))
        
        //create the pokeball unit
        set pokeball = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'N002', GetUnitX(catching_trainer), GetUnitY(catching_trainer), unit_facing)
        
        //add a generic expiration timer of 2.94 seconds to the pokeball unit
        call UnitApplyTimedLife(pokeball, 'BTLF', 2.94)
        
        //hide the caught pokemon
        call ShowUnit(caught_pokemon, false)
        
        //set the animation for the pokeball unit to "spell"
        call SetUnitAnimation(pokeball, "spell" )
        
        //create the timer
        set t = CreateTimer()
        
        //start the timer and make it a continious timer which expires every 0.47 seconds. When the timer expires function QueueAnimation is executed (see function QueueAnimation)
        call TimerStart(t, 0.47, true, function QueueAnimation)
        
        //save the pokeball unit in a hashtable where the parent key is the id of the timer we just created. The child key is 1.
        call SaveUnitHandle(udg_Catch_Pokemon, GetHandleId(t), 1, pokeball)
        
        //save a real value of 6 in the hashtable under the same parent key with child key 2.
        call SaveReal(udg_Catch_Pokemon, GetHandleId(t), 2, 6)
        
        //set the owner of the pokemon being caught to the trainer catching the pokemon
        call SetUnitOwner(caught_pokemon, GetOwningPlayer(catching_trainer), true )
        
        //set the position of the caught pokemon to random point in Region 007 <gen>
        call SetUnitPosition(caught_pokemon, GetLocationX(Location(GetRandomReal(GetRectMinX(gg_rct_Rect_007), GetRectMaxX(gg_rct_Rect_007)), GetRandomReal(GetRectMinY(gg_rct_Rect_007), GetRectMaxY(gg_rct_Rect_007)))), GetLocationY(Location(GetRandomReal(GetRectMinX(gg_rct_Rect_007), GetRectMaxX(gg_rct_Rect_007)), GetRandomReal(GetRectMinY(gg_rct_Rect_007), GetRectMaxY(gg_rct_Rect_007)))))
        
        //show the caught pokemon
        call ShowUnit(caught_pokemon, true)
        
    //else if the catching trainer has a greatball and the unit being caught has less then or equal to 15% hp then
    elseif (UnitHasItemOfTypeBJ(catching_trainer, 'I002')) and (GetUnitLifePercent(caught_pokemon) <=15)  then
        //same actions as in the first if block except a different item is removed from the catching trainer
        call RemoveItem(GetItemOfTypeFromUnitBJ(catching_trainer, 'I002'))
        set unit_facing = bj_RADTODEG * Atan2(GetUnitY(caught_pokemon) - GetUnitY(catching_trainer), GetUnitX(caught_pokemon) - GetUnitX(catching_trainer))
        set pokeball = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'N002', GetUnitX(catching_trainer), GetUnitY(catching_trainer), unit_facing)
        call UnitApplyTimedLife(pokeball, 'BTLF', 2.94)
        call ShowUnit(caught_pokemon, false)
        call SetUnitAnimation(pokeball, "spell" )
        set t = CreateTimer()
        call TimerStart(t, 0.47, true, function QueueAnimation)
        call SaveUnitHandle(udg_Catch_Pokemon, GetHandleId(t), 1, pokeball)
        call SaveReal(udg_Catch_Pokemon, GetHandleId(t), 2, 5)
        call SetUnitOwner(caught_pokemon, GetOwningPlayer(catching_trainer), true )
        call SetUnitPosition(caught_pokemon, GetLocationX(Location(GetRandomReal(GetRectMinX(gg_rct_Rect_007), GetRectMaxX(gg_rct_Rect_007)), GetRandomReal(GetRectMinY(gg_rct_Rect_007), GetRectMaxY(gg_rct_Rect_007)))), GetLocationY(Location(GetRandomReal(GetRectMinX(gg_rct_Rect_007), GetRectMaxX(gg_rct_Rect_007)), GetRandomReal(GetRectMinY(gg_rct_Rect_007), GetRectMaxY(gg_rct_Rect_007)))))
        call ShowUnit(caught_pokemon, true)
        
    //else if the catching trainer has a ultraball and the unit being caught has less then or equal to 20% hp then
    elseif (UnitHasItemOfTypeBJ(catching_trainer, 'I003')) and (GetUnitLifePercent(caught_pokemon) <=20) then
        //same actions as in the first if block except a different item is removed from the catching trainer
        call RemoveItem(GetItemOfTypeFromUnitBJ(catching_trainer, 'I003'))
        set unit_facing = bj_RADTODEG * Atan2(GetUnitY(caught_pokemon) - GetUnitY(catching_trainer), GetUnitX(caught_pokemon) - GetUnitX(catching_trainer))
        set pokeball = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'N002', GetUnitX(catching_trainer), GetUnitY(catching_trainer), unit_facing)
        call UnitApplyTimedLife(pokeball, 'BTLF', 2.94)
        call ShowUnit(caught_pokemon, false)
        call SetUnitAnimation(pokeball, "spell" )
        set t = CreateTimer()
        call TimerStart(t, 0.47, true, function QueueAnimation)
        call SaveUnitHandle(udg_Catch_Pokemon, GetHandleId(t), 1, pokeball)
        call SaveReal(udg_Catch_Pokemon, GetHandleId(t), 2, 5)
        call SetUnitOwner(caught_pokemon, GetOwningPlayer(catching_trainer), true )
        call SetUnitPosition(caught_pokemon, GetLocationX(Location(GetRandomReal(GetRectMinX(gg_rct_Rect_007), GetRectMaxX(gg_rct_Rect_007)), GetRandomReal(GetRectMinY(gg_rct_Rect_007), GetRectMaxY(gg_rct_Rect_007)))), GetLocationY(Location(GetRandomReal(GetRectMinX(gg_rct_Rect_007), GetRectMaxX(gg_rct_Rect_007)), GetRandomReal(GetRectMinY(gg_rct_Rect_007), GetRectMaxY(gg_rct_Rect_007)))))
        call ShowUnit(caught_pokemon, true)
        
    //else if the catching trainer has a masterball
    elseif (UnitHasItemOfTypeBJ(catching_trainer, 'I004')) then
        //same actions as in the first if block except a different item is removed from the catching trainer
        call RemoveItem(GetItemOfTypeFromUnitBJ(catching_trainer, 'I004'))
        set unit_facing = bj_RADTODEG * Atan2(GetUnitY(caught_pokemon) - GetUnitY(catching_trainer), GetUnitX(caught_pokemon) - GetUnitX(catching_trainer))
        set pokeball = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'N002', GetUnitX(catching_trainer), GetUnitY(catching_trainer), unit_facing)
        call UnitApplyTimedLife(pokeball, 'BTLF', 2.94)
        call ShowUnit(caught_pokemon, false)
        call SetUnitAnimation(pokeball, "spell" )
        set t = CreateTimer()
        call TimerStart(t, 0.47, true, function QueueAnimation)
        call SaveUnitHandle(udg_Catch_Pokemon, GetHandleId(t), 1, pokeball)
        call SaveReal(udg_Catch_Pokemon, GetHandleId(t), 2, 5)
        call SetUnitOwner(caught_pokemon, GetOwningPlayer(catching_trainer), true )
        call SetUnitPosition(caught_pokemon, GetLocationX(Location(GetRandomReal(GetRectMinX(gg_rct_Rect_007), GetRectMaxX(gg_rct_Rect_007)), GetRandomReal(GetRectMinY(gg_rct_Rect_007), GetRectMaxY(gg_rct_Rect_007)))), GetLocationY(Location(GetRandomReal(GetRectMinX(gg_rct_Rect_007), GetRectMaxX(gg_rct_Rect_007)), GetRandomReal(GetRectMinY(gg_rct_Rect_007), GetRectMaxY(gg_rct_Rect_007)))))
        call ShowUnit(caught_pokemon, true)
    endif
    set pokeball = null
    set caught_pokemon = null
    set catching_trainer = null
endfunction

//===========================================================================
function InitTrig_Catch_Pokemon takes nothing returns nothing
    //the actual trigger being created. Here all events, conditions and actions gets added to the trigger
    local trigger t = CreateTrigger()
    local integer index
    set index = 0
    loop
        //add the event: A unit Starts the effect of an ability for each player
        call TriggerRegisterPlayerUnitEvent(t, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
        set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
    endloop
    //add the trigger conditions
    call TriggerAddCondition( t, Condition( function Catch_Pokemon_Conditions ) )
    //add the trigger actions
    call TriggerAddAction( t, function Catch_Pokemon_Actions )
    set t = null
endfunction

Create a trigger called: Catch Pokemon and go to Edit -> Convert to Custom Text
Then copy this code and paste it over the code you get from the converted trigger.

Make sure that File -> Preferences -> Automatically create unknown variables when pasting trigger data is checked
If that doesn't seem to create any variables, create 1 hashtable variable inside your variable editor called Catch_Pokemon

I haven't tested it because I don't have the ability, unit and items. (And I'm to lazy to create them myself ^.^)
But I guess it will work for you...
If it doesn't tell me and I'll fix the bugs that might occur.

EDIT2: This trigger could've looked so much better in vJass :(
But since you wanted a Jass version which worked for the regular World Editor here it is...

EDIT3: Oops I forgot to play the sound :S
Could you tell me where the blink arrival sound is located?
 
Last edited:
Level 7
Joined
Aug 8, 2008
Messages
340
Good question. xD Would it be possible to make it priorities as low as possible? I mean if a pokeball is able to be used successfully, that would be used over fx a masterball.

Edit: The blink sound is located under night elf spells as far as i remember. :)

Edit 2: It does not appear to be working.
Try to take a look for your self.

The map attached is only allowed for Hashjie to download and edit.
 

Attachments

  • Pokémon World v.0.1.w3x
    247.5 KB · Views: 54
Last edited:
Level 14
Joined
Apr 20, 2009
Messages
1,543
Good question. xD Would it be possible to make it priorities as low as possible? I mean if a pokeball is able to be used successfully, that would be used over fx a masterball.

That's exactly how I intended it to be. As shown in my previous post. And this was done correctly.

Edit: The blink sound is located under night elf spells as far as i remember. :)

I'll add it as soon as possible.

Edit 2: It does not appear to be working.
Try to take a look for your self.

The map attached is only allowed for Hashjie to download and edit.

Lol If that's so, then why not send it through Private Message xD?
(you can still edit your post, remove the map and send it through PM by using the pastebin on the top left of hiveworkshop if you preferr.
Not that it's nessecary though since I now already have it, you can still remove it from your previous post if you're not feeling comfortable ofcourse)

EDIT: Okay, the system seems to work (I made 1 unintended small typo somewhere, <3 Syntax Check),
but there are still some minor visibility issues which I'm currently resolving.
Check your PM to see more specific details.
I'm still working on the new version though, I'll need to do some distance calculations...

I'm going to sleep now and continue on it tomorrow.

Sonofjay if you are reading this, sorry that your system has less priority. I like Jass over GUI ^.^ I'll be working on yours as soon as this is fixed.
 
Last edited:
Status
Not open for further replies.
Top