[JASS] Imported ability not working

Level 3
Joined
May 16, 2024
Messages
13
Hello there!

I tried to import one of the abilities from an entry in one of the hero contest, specifically this one: Swashbuckler Spellpack
The ability that I'm talking about is "Persecute".
I made sure to follow the instructions:
  • I imported the "dummy caster" unit
  • Imported the "missile dummy" unit
  • Imported all the abilities (Persecute Buff, Mark and Main)
  • Imported all the corresponding buffs (Persecute Mark and Buff) and made sure that they are in the Abilities' buffs
  • Imported the required libraries and the "Persecute" spell trigger directly from the map
  • I THINK I have configured anything that needed to be

Then I gave the spell to one of my custom hero units, but the spell does not work correctly: It only takes effect when the hero is already attacking his target, and the buff doesn't wear off.
Since I don't know much about JASS (this is actually my first time trying to use a JASS trigger),
I thought that using already existing systems might be simple but to be frank, I am starting to lose my marbles over it (perhaps I should just stick to GUI :peasant-work-work:).

I don't want to upload my map here, since I have already put some work into it and I don't want it to be public yet, but what I could do, is send my map to one of the moderators so they can look into it (If one has time and willingness to do so of course :gg: ). Also, If you need any additional info, I will try to provide as best as I can.

Thanks in advance!

EDIT: Attached the map. If anyone wants to look into it, they should find the "Scripts" folder under the "SCRIPTS FOR SPELLS" comment and "WitchHunterSpells" right under that. All of those should be at the very bottom of the trigger list.
 

Attachments

  • Dungeon Raiders.w3x
    4 MB · Views: 3
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
I don't want to upload my map here, since I have already put some work into it and I don't want it to be public yet
I realize this might sound rude but... nobody cares. Nobody will steal your map idea from this tiny corner of the internet, and nobody is going to judge you for the current state of your project. You can even remove the upload here after this issue is resolved.

Troubleshooting an issue like yours without access to the map is borderline impossible. It could be any number of configuration steps you forgot to do (or didn't realize you had to do/check). When running into an issue like this I advise that you try importing into a blank map from scratch, rather than integrating it directly into your project.
 
Level 3
Joined
May 16, 2024
Messages
13
I realize this might sound rude but... nobody cares. Nobody will steal your map idea from this tiny corner of the internet, and nobody is going to judge you for the current state of your project. You can even remove the upload here after this issue is resolved.
Fair enough.
It should be attached to the main post now.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Fair enough.
It should be attached to the main post now.
Here's the instructions:
vJASS:
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//                    Persecute v1.0
//                    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//
//      I. Description
//          Throws a paintball at the target. Marking it as a wanted
//          target.  Marked  unit will leave traces as  it  travels.
//          Ally  units  who's targeting it will have  their  attack
//          speed  and  move speed increased. The mark lasts for  15
//          seconds.
//
//              Level 1 - 15% attack speed bonus. 10% move speed bonus.
//              Level 2 - 25% attack speed bonus. 15% move speed bonus.
//              Level 3 - 35% attack speed bonus. 20% move speed bonus.
//
//      II. Requirements
//          • Missile       by BPower       | hiveworkshop.com/threads/missile.265370/
//          • UnitIndexer   by TriggerHappy | hiveworkshop.com/threads/system-unitdex-unit-indexer.248209/
//          • TimerUtils    by Vexorian     | wc3c.net/showthread.php?t=101322
// 
//      III. How to import
//          • Import dummy.mdx from import manager to your map. Other files are optional
//          • Import the following object data to your map:
//              (Unit)
//                  • Dummy Caster
//                  • Missile Dummy
//              (Ability)
//                  • Persecute (Buff)
//                  • Persecute (Mark)
//                  • Persecute (Main)
//              (Buff)
//                  • Persecute (Buff)
//                  • Persecute (Mark)
//          • Make sure "Persecute (Buff)" ability has "Persecute (Buff)" as buff
//          • Make sure "Persecute (Mark)" ability has "Persecute (Mark)" as buff
//          • Import and configure required libraries properly
//          • Import Persecute trigger and configure it properly
// 
//      IV. Credits
//          • HappyCockroach : spell concept
//          • TriggerHappy : UnitIndexer library
//          • Vexorian     : TimerUtils library
//
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//                          Configurations
//                          ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//      A. Static configurations
        globals
//          1. Persecute main ability raw code
            private constant integer MAIN_SPELL_ID          = 'A00H'
// 
//          2. Persecute (Mark) ability raw code
            private constant integer MARK_SPELL_ID          = 'A00I'
// 
//          3. Persecute (Buff) ability raw code
            private constant integer BONUS_SPELL_ID         = 'A00E'
// 
//          4. Persecute (Buff) buff raw code
            private constant integer MARK_BUFF_ID           = 'B001'
// 
//          5. Persecute (Mark) buff raw code
            private constant integer BONUS_BUFF_ID          = 'B002'
// 
//          6. Dummy Caster unit raw code
            private constant integer DUMMY_CASTER_ID        = 'h00W'
// 
//          7. Persecute (Mark) ability order id
            private constant integer MARK_ORDER_ID          = 852570 // "wandofshadowsight"
// 
//          8. Persecute (Buff) ability order id
            private constant integer BONUS_ORDER_ID         = 852101 // "bloodlust"
// 
//          9. Launched missile model file path
            private constant string  MISSILE_MODEL_PATH     = "war3mapImported\\Swashbuckler_Persecute_Projectile.MDX"
// 
//          10. Missile move speed
            private constant real    MISSILE_SPEED          = 25.0
// 
//          11. Missile trajectory arc
            private constant real    MISSILE_ARC            = 0.15
// 
//          12. Missile launching vertical (height) offset
            private constant real    MISSILE_LAUNCH_VOFFSET = 125.0
// 
//          13. Missile launching horizontal (xy) offset
            private constant real    MISSILE_LAUNCH_HOFFSET = 65.0
// 
//          Interval at which the detection trigger will reset
//          (Just don't modify if you don't know what it means)                                                                                                  Congrats! If you are reading this, it means you are certified nerd
            private constant real    TRIGGER_RESET_INTERVAL = 30.0
// 
//          Better not to modify this
            private constant real    INTERVAL               = 0.1
        endglobals
// 
//      B. Dynamic configurations
// 
//          14. Mark duration on normal units
            private constant function MarkDurationNormal takes integer level returns real
                return 20.0
            endfunction
// 
//          15. Mark duration on hero units
            private constant function MarkDurationHero takes integer level returns real
                return 10.0
            endfunction
// 
//          16. Classification of unit that can receive bonus stats when
//             chasing a target with Persecute (Buff - Target) buff
//              • chaser = unit that's targeting the marked unit
//              • caster = owner of the caster (who gives the mark)
//              • target = marked unit
//              Current targets: enemy of target, ally of caster, non-mechanical, non-structure
            private constant function AllowedChaser takes unit chaser, player caster, player target returns boolean
                return IsUnitEnemy(chaser, target) and IsUnitAlly(chaser, caster) and not IsUnitType(chaser, UNIT_TYPE_MECHANICAL) and not IsUnitType(chaser, UNIT_TYPE_STRUCTURE)
            endfunction
//
//
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It seems like you imported everything and used the correct rawcodes.

The first thing I can think of is that you are not learning the skill which is what initializes everything:
vJASS:
        static method onLearn takes nothing returns boolean
 
            if (GetLearnedSkill() == MAIN_SPELL_ID) then
                // The first time the spell appears in game, initialize the spell trigger
                call initializeSpell()
            endif
 
            return false
        endmethod
Other potential issues:
  • The AllowedChaser function is filtering out your units, although that seems highly unlikely.
  • You have more than one Unit Indexer or you're modifying a unit's Custom Value yourself. You only want 1 of each system and a Unit Indexer will manage Custom Values so you shouldn't use that Action yourself.
  • You have failed to import/configure one of the libraries, they all have their own instructions.
  • Mark Order Id / Bonus Order Id's are incorrect (unlikely).


Side note, I suggest having two Dummy units and reusing them wherever possible.

Dummy (Caster): Based on Locust, give it the Dummy model, disable Shadow, disable Attack, disable Movement Type, set Speed Base = 0. This one is meant to cast spells instantly and cannot move.

Dummy (Missile): Based on Locust, give it the Dummy model, disable Shadow, disable Attack, disable Movement Type, set Speed Base = Anything > 0, adjust Turn Rate as necessary, and adjust Art fields to make it appear correctly. This one acts as a missile and needs to be able to move around and interact properly with the environment. If you try to cast spells with it there will be a slight delay.

Your h00W and e002 dummy units (Dummy Caster and Missile Dummy) seem to be setup properly for this exact purpose. If a spell needs a very specific type of Dummy unit (I'd argue these two should be able to accomplish everything) then I'd recommend naming it accordingly. In your map you currently have 4 Dummy units and they're all basically called "Dummy". When importing more custom spells this problem will only get worse.
 
Last edited:
Top