• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[vJASS] vJass

Status
Not open for further replies.
Level 5
Joined
Jul 17, 2013
Messages
90
JASS:
scope Entrangling Roots initializer Init
// +-------------------------------------------------------------------------------------------------------------------------+
// |     Entrangling Roots - Created by dotieris123.  Requires a vJass preprocessor!                                         |
// +-------------------------------------------------------------------------------------------------------------------------+                                                 
// | Gives a great chance to entrangle the targetet unit                                                                     |
// | to the owner of the attacker.                                                                                           |
// +-------------------------------------------------------------------------------------------------------------------------+
// | How to Import:                                                                                                          |
// |  - Create a new trigger                                                                                                 |
// |  - Convert it to Custom text (Edit > Convert to Custom Text)                                                            |
// |  - Replace everything there with this code                                                                              |
// |  - Change the constants to suit yourself                                                                                |
// |  - Enjoy!                                                                                                               |
// +-------------------------------------------------------------------------------------------------------------------------+    

// |-------------|
// | Constants:  |
// |-------------|
    globals
        // The effect created on the target when it is being entrangled:
        private constant string EFFECT "Abilities\Spells\NightElf\EntanglingRoots\EntanglingRootsTarget.mdl"
        // Which is attached to the targets:
        private constant string EFFECT_POSITION "origin"
        
        // The Raw code of the ability
        private constant integer ID = 'A600'
    endglobals

    private constant function CHANCE takes integer level returns integer
    // The chance of a unit being possessed. "level" is the level of the ability
        return level * 1
    endfunction
// |------------------|
// | End of Constants |
// |------------------|

// DO NOT EDIT BELOW THIS LINE!

    private function True takes nothing returns boolean
        return true
    endfunction

    private function Cons takes nothing returns boolean
        return IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()), GetOwningPlayer(GetAttacker())) and GetRandomInt(0, 100) <= 35(GetUnitAbilityLevel(GetAttacker(), 'A600')) and IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true and GetUnitAbillityLevel(GetAttacker(), 'A600') > 0
    endfunction

    private function Entrangling Roots takes nothing returns nothing
        local unit u = GetAttacker()
        local unit t = GetTriggerUnit()
        call DestroyEffect(AddSpecialEffectTarget("Abilities\Spells\NightElf\EntanglingRoots\EntanglingRootsTarget.mdl", t, "origin"))
        call SetUnitOwner(t, GetOwningPlayer(u), true)
        set u = null
        set t = null
    endfunction

    private function Init takes nothing returns nothing
        local Tirgger t = CreateTrigger()
        local integer i = 0
        loop
            exitwhen i > 15
                call TriggerRegisterPlayerUnitEvent(t, Player (i) EVENT_PLAYER_UNIT_ATTACKED, Filter(function True))
            set i = i + 1
        endloop
        call TriggerAddCondition(t, Filter(function Cons))
        call TriggerAddAction(t, function Entrangling Roots)
    endfunction
where is the problem error appears when I start the map
 
Last edited by a moderator:
Level 5
Joined
Jul 17, 2013
Messages
90
damn I think endscope deleted while I was saving it seems to me that I missed that tirgger... still error
Edit: Did everything still error I mean I maked Tirgger to Trigger and added endscope at end but war 3 fatal error
 
Last edited:
There are quite a few issues.
  • The scope name "Entrangling Roots" should be one word.
  • Add = after EFFECT and EFFECT_POSITION
  • Add endscope.
  • Change "Tirgger" to "trigger"
  • Add a comma after "Player(i)"
  • The function "Entrangling Roots" should be one word
  • The paths should use "\\" instead of "\", or else the syntax check will interpret it as an escape sequence.
  • GetRandomInt() <= 35 * Level? I don't know exactly whether he wanted to have 35 * Level or just the level, or what.
  • Typo "GetUnitAbillityLevel" to "GetUnitAbilityLevel"

This should fix the errors:
JASS:
scope EntranglingRoots initializer Init
// +-------------------------------------------------------------------------------------------------------------------------+
// |     Entrangling Roots - Created by dotieris123.  Requires a vJass preprocessor!                                         |
// +-------------------------------------------------------------------------------------------------------------------------+                                                 
// | Gives a great chance to entrangle the targetet unit                                                                     |
// | to the owner of the attacker.                                                                                           |
// +-------------------------------------------------------------------------------------------------------------------------+
// | How to Import:                                                                                                          |
// |  - Create a new trigger                                                                                                 |
// |  - Convert it to Custom text (Edit > Convert to Custom Text)                                                            |
// |  - Replace everything there with this code                                                                              |
// |  - Change the constants to suit yourself                                                                                |
// |  - Enjoy!                                                                                                               |
// +-------------------------------------------------------------------------------------------------------------------------+    

// |-------------|
// | Constants:  |
// |-------------|
    globals
        // The effect created on the target when it is being entrangled:
        private constant string EFFECT = "Abilities\\Spells\\NightElf\\EntanglingRoots\\EntanglingRootsTarget.mdl"
        // Which is attached to the targets:
        private constant string EFFECT_POSITION = "origin"
        
        // The Raw code of the ability
        private constant integer ID = 'A600'
    endglobals

    private constant function CHANCE takes integer level returns integer
    // The chance of a unit being possessed. "level" is the level of the ability
        return level * 1
    endfunction
// |------------------|
// | End of Constants |
// |------------------|

// DO NOT EDIT BELOW THIS LINE!

    private function True takes nothing returns boolean
        return true
    endfunction

    private function Cons takes nothing returns boolean
        return IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()), GetOwningPlayer(GetAttacker())) /*
    */ and GetRandomInt(0, 100) <= 35 * (GetUnitAbilityLevel(GetAttacker(), 'A600'))  /*
    */ and IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true /*
    */ and GetUnitAbilityLevel(GetAttacker(), 'A600') > 0
    endfunction

    private function EntranglingRoots takes nothing returns nothing
        local unit u = GetAttacker()
        local unit t = GetTriggerUnit()
        call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\NightElf\\EntanglingRoots\\EntanglingRootsTarget.mdl", t, "origin"))
        call SetUnitOwner(t, GetOwningPlayer(u), true)
        set u = null
        set t = null
    endfunction

    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer i = 0
        loop
            exitwhen i > 15
                call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_ATTACKED, Filter(function True))
            set i = i + 1
        endloop
        call TriggerAddCondition(t, Filter(function Cons))
        call TriggerAddAction(t, function EntranglingRoots)
    endfunction

endscope

Maybe. There might've been some I missed. Either way, there are still a lot of issues with the code. He declares constants and doesn't use them, and judging by these syntax errors, he probably didn't even test the code (or understand JASS, for that matter).
 
Level 5
Joined
Jul 17, 2013
Messages
90
There are quite a few issues.
  • The scope name "Entrangling Roots" should be one word.
  • Add = after EFFECT and EFFECT_POSITION
  • Add endscope.
  • Change "Tirgger" to "trigger"
  • Add a comma after "Player(i)"
  • The function "Entrangling Roots" should be one word
  • The paths should use "\\" instead of "\", or else the syntax check will interpret it as an escape sequence.
  • GetRandomInt() <= 35 * Level? I don't know exactly whether he wanted to have 35 * Level or just the level, or what.
  • Typo "GetUnitAbillityLevel" to "GetUnitAbilityLevel"

This should fix the errors:
JASS:
scope EntranglingRoots initializer Init
// +-------------------------------------------------------------------------------------------------------------------------+
// |     Entrangling Roots - Created by dotieris123.  Requires a vJass preprocessor!                                         |
// +-------------------------------------------------------------------------------------------------------------------------+                                                 
// | Gives a great chance to entrangle the targetet unit                                                                     |
// | to the owner of the attacker.                                                                                           |
// +-------------------------------------------------------------------------------------------------------------------------+
// | How to Import:                                                                                                          |
// |  - Create a new trigger                                                                                                 |
// |  - Convert it to Custom text (Edit > Convert to Custom Text)                                                            |
// |  - Replace everything there with this code                                                                              |
// |  - Change the constants to suit yourself                                                                                |
// |  - Enjoy!                                                                                                               |
// +-------------------------------------------------------------------------------------------------------------------------+    

// |-------------|
// | Constants:  |
// |-------------|
    globals
        // The effect created on the target when it is being entrangled:
        private constant string EFFECT = "Abilities\\Spells\\NightElf\\EntanglingRoots\\EntanglingRootsTarget.mdl"
        // Which is attached to the targets:
        private constant string EFFECT_POSITION = "origin"
        
        // The Raw code of the ability
        private constant integer ID = 'A600'
    endglobals

    private constant function CHANCE takes integer level returns integer
    // The chance of a unit being possessed. "level" is the level of the ability
        return level * 1
    endfunction
// |------------------|
// | End of Constants |
// |------------------|

// DO NOT EDIT BELOW THIS LINE!

    private function True takes nothing returns boolean
        return true
    endfunction

    private function Cons takes nothing returns boolean
        return IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()), GetOwningPlayer(GetAttacker())) /*
    */ and GetRandomInt(0, 100) <= 35 * (GetUnitAbilityLevel(GetAttacker(), 'A600'))  /*
    */ and IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true /*
    */ and GetUnitAbilityLevel(GetAttacker(), 'A600') > 0
    endfunction

    private function EntranglingRoots takes nothing returns nothing
        local unit u = GetAttacker()
        local unit t = GetTriggerUnit()
        call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\NightElf\\EntanglingRoots\\EntanglingRootsTarget.mdl", t, "origin"))
        call SetUnitOwner(t, GetOwningPlayer(u), true)
        set u = null
        set t = null
    endfunction

    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer i = 0
        loop
            exitwhen i > 15
                call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_ATTACKED, Filter(function True))
            set i = i + 1
        endloop
        call TriggerAddCondition(t, Filter(function Cons))
        call TriggerAddAction(t, function EntranglingRoots)
    endfunction

endscope

Maybe. There might've been some I missed. Either way, there are still a lot of issues with the code. He declares constants and doesn't use them, and judging by these syntax errors, he probably didn't even test the code (or understand JASS, for that matter).
Thank you I wilk try it at morning Im not good at Jass and I tried to made the abillity myself because none would anyway that 35 is the chance I think so
 
Also

This IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true
Should be this IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO)
The one that has == true is slower and less efficient.

Never use TriggerAddAction. Use TriggerAddCondition and run everything from there.

Also you should take a look at my tutorial converting GUI to efficient jass.
 
Level 5
Joined
Jul 17, 2013
Messages
90
JASS:
scope EntranglingRoots initializer Init
// +-------------------------------------------------------------------------------------------------------------------------+
// |     Entrangling Roots - Created by dotieris123.  Requires a vJass preprocessor!                                         |
// +-------------------------------------------------------------------------------------------------------------------------+                                                
// | Gives a great chance to entrangle the targetet unit                                                                     |
// | to the owner of the attacker.                                                                                           |
// +-------------------------------------------------------------------------------------------------------------------------+
// | How to Import:                                                                                                          |
// |  - Create a new trigger                                                                                                 |
// |  - Convert it to Custom text (Edit > Convert to Custom Text)                                                            |
// |  - Replace everything there with this code                                                                              |
// |  - Change the constants to suit yourself                                                                                |
// |  - Enjoy!                                                                                                               |
// +-------------------------------------------------------------------------------------------------------------------------+    

// |-------------|
// | Constants:  |
// |-------------|
    globals
        // The effect created on the target when it is being entrangled:
        private constant string EFFECT = "Abilities\\Spells\\NightElf\\EntanglingRoots\\EntanglingRootsTarget.mdl"
        // Which is attached to the targets:
        private constant string EFFECT_POSITION = "origin"
       
        // The Raw code of the ability
        private constant integer ID = 'A600'
    endglobals

    private constant function CHANCE takes integer level returns integer
    // The chance of a unit being possessed. "level" is the level of the ability
        return level * 1
    endfunction
// |------------------|
// | End of Constants |
// |------------------|

// DO NOT EDIT BELOW THIS LINE!

    private function True takes nothing returns boolean
        return true
    endfunction

    private function Cons takes nothing returns boolean
        return IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()), GetOwningPlayer(GetAttacker())) /*
    */ and GetRandomInt(0, 100) <= 35 * (GetUnitAbilityLevel(GetAttacker(), 'A600'))  /*
    */ and IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true /*
    */ and GetUnitAbilityLevel(GetAttacker(), 'A600') > 0
    endfunction

    private function EntranglingRoots takes nothing returns nothing
        local unit u = GetAttacker()
        local unit t = GetTriggerUnit()
        call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\NightElf\\EntanglingRoots\\EntanglingRootsTarget.mdl", t, "origin"))
        call SetUnitOwner(t, GetOwningPlayer(u), true)
        set u = null
        set t = null
    endfunction

    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer i = 0
        loop
            exitwhen i > 15
                call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_ATTACKED, Filter(function True))
            set i = i + 1
        endloop
        call TriggerAddCondition(t, Filter(function Cons))
        call TriggerAddAction(t, function EntranglingRoots)
    endfunction

endscope
This still not working before I enable it it says create a function InitTrig_Entrangling_Roots I did it didnt worked and then removed
 
Level 5
Joined
Jul 17, 2013
Messages
90
v in vjass = vexorian, it' next to cohader's jass helper. But it also should work with cohader's...

Does it throw errors after saving the map? You know you have to save the mal and wait until all compiled, before you can test your map?
from where I can make the chance higher because I think its not working because chance is very low.. I mean map opens now but skill never works
 
Level 5
Joined
Jul 17, 2013
Messages
90
v in vjass = vexorian, it' next to cohader's jass helper. But it also should work with cohader's...

Does it throw errors after saving the map? You know you have to save the mal and wait until all compiled, before you can test your map?
I dont know where I wrote it maybe in an other thread ^^ but I enabled vexorian Jasshelper, skill sitll doesnt working and how can I increase the chance so I can check this way if its the reason that spell dont working low chance= spell will rarily achieved
Edit: oups I re-write it pc lag didnt showed me it before....
 
Status
Not open for further replies.
Top