Spellpack Wraith's Spellpack

wraithseeker

Tired.
Reaction score
122
Wraith's Spellpack

This spellpack includes

Blizzard
Mass Entangling Roots ( can be changed to Aoe Banish Aoe Polymorph or whatever Aoe you want)
Knockback
Dead Will
Frost Armour


Screenshots are not amazing, you have to download the map and test it to see it


Blizzard

Import Difficulty : Medium
GUI / Jass : vJass
MUI / MPI : MUI
Leak / Leakess : Leakless


Quote
The mage makes the earth tremble at the target point and then raining down blizzard at his enemies

Screenshots
WC3ScrnShot_010809_184012_06.jpg

Code

rooty.jpg
Code

JASS:
// +------------------------------------------------------------+
// |                                                            |
// |                    -=-=- Blizzard -=-=-                    |
// |                    Requires Jass NewGen                    |
// |                                                            |
// +------------------------------------------------------------+
// |   Makes the earth shake at the targeted point , and then   |
// |   calling a blizzard to damage the caster's foes           |    
// |                                                            |
// +------------------------------------------------------------+
// |                                                            |
// |   -=-=- How To Implement -=-=-                             |
// |      1. Create a trigger named Blizzard                    |
// |      2. Copy the text from this map's trigger              |
// |      3. Copy/paste it into your map's Blizzard trigger     |
// |      4. Copy all the abilities to your map                 |
// |      5. Copy all the units to your map                     |
// |      6. Enjoy!                                             |
// |                                                            |
// +------------------------------------------------------------+
// |                                                            |
// |   -=-=- Credits -=-=-                                      |
// |      Credits are not needed, but appreciated               |
// |         Just don't claim this as yours                     |
// |                                                            |
// +------------------------------------------------------------+

scope Blizzard initializer BZInit

// +-------------------------------------+
// |       -=-=- MODIFY HERE -=-=-       |
// |       -=-=- MODIFY HERE -=-=-       |
// |       -=-=- MODIFY HERE -=-=-       |
// +-------------------------------------+

    globals
        private constant integer BZID = 'A001'       // Rawcode of dummy spell
        private constant integer BZDUMMY = 'h003'       // Rawcode of dummy unit
        private constant integer BLIZZARD = 'BLIZ'       // Blizzard ability rawcode
        private constant integer CLAPS = 'CLAP'       // Thunder Clap ability rawcode
        private constant string THUNDERCLAP = "thunderclap"       // Order string of Thunderclap
        private constant string BLIZZARDS = "blizzard"       // Order string of Blizzard
    endglobals
    
// +------------------------------------------------+
// |       -=-=- DO NOT TOUCH PAST HERE -=-=-       |
// |       -=-=- DO NOT TOUCH PAST HERE -=-=-       |
// |       -=-=- DO NOT TOUCH PAST HERE -=-=-       |
// +------------------------------------------------+

    private function BZConditions takes nothing returns boolean
        return GetSpellAbilityId() == BZID
    endfunction
    
    private function BZActions takes nothing returns nothing
        local unit t = GetTriggerUnit()
        local location target = GetSpellTargetLoc()
        local unit b = CreateUnitAtLoc(GetOwningPlayer(t), BZDUMMY, target, bj_UNIT_FACING)
        local unit c = CreateUnitAtLoc(GetOwningPlayer(t), BZDUMMY, target, bj_UNIT_FACING)
        call UnitAddAbility(b, BLIZZARD)
        call UnitAddAbility(c, CLAPS)
        call SetUnitAbilityLevel(b, BLIZZARD, GetUnitAbilityLevel(t, BZID))
        call SetUnitAbilityLevel(c, CLAPS, GetUnitAbilityLevel(t, BZID))
        call IssueImmediateOrder(c, THUNDERCLAP)
        call IssuePointOrderLoc(b, BLIZZARDS, target)
        call UnitApplyTimedLife(b, 'BTLF', 5)
        call UnitApplyTimedLife(c, 'BTLF', 1)
        set c = null
        set b = null
        set t = null
        call RemoveLocation(target)
        set target = null
    endfunction

//===========================================================================
    private function BZInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(t, Condition(function BZConditions))
        call TriggerAddAction(t, function BZActions)
    endfunction

endscope


Mass Entangling Roots

Import Difficulty : Medium
GUI / Jass : vJass
MUI / MPI : MUI
Leak / Leakess : Leakless


Quote
The mage targets an area and then using his druidic powers, he calls upon the spirit of the forest to entangle the targeted units

Screenshots

root.jpg



JASS:
// +------------------------------------------------------------+
// |                                                            |
// |             -=-=- Mass Entangling Roots -=-=-              |
// |                   Requires Jass NewGen                     |
// |                                                            |
// +------------------------------------------------------------+
// |   Entangles all targeted units in the point of ability     |
// |   being cast.                                              |
// |     Suitable for a Aoe Template (Mass Banish, Mass StunBolt|            
// |                                                            |
// +------------------------------------------------------------+
// |                                                            |
// |   -=-=- How To Implement -=-=-                             |
// |      1. Create a trigger named Mass Entangling Roots       |
// |      2. Copy the text from this map's trigger              |
// |      3. Copy/paste it into your map's                      |
// |            Mass Entangling Roots trigger.                  |
// |      4. Copy all the abilities to your map.                |
// |      5. Copy all the units to your map.                    |
// |      6. Enjoy!                                             |
// |                                                            |
// +------------------------------------------------------------+
// |                                                            |
// |   -=-=- Credits -=-=-                                      |
// |      Credits are not needed, but appreciated               |
// |         Just don't claim this as yours                     |
// |                                                            |
// +------------------------------------------------------------+

scope MassEntangleRoots initializer MERInit

// +-------------------------------------+
// |       -=-=- MODIFY HERE -=-=-       |
// |       -=-=- MODIFY HERE -=-=-       |
// |       -=-=- MODIFY HERE -=-=-       |
// +-------------------------------------+

    globals
        private constant integer MERID = 'MER1'       // Rawcode of dummy spell
        private constant integer MERDUMMY = 'h003'       // Rawcode of dummy unit
        private constant integer SPELL = 'ENTA'       // Rawcode of entangling roots
        private constant string MERORDER = "entanglingroots"       // Order string of ability
        private boolexpr MERCONDITION
    endglobals

    private function MERRange takes integer level returns integer
        return level * 150       // Range per level
    endfunction
    
// +------------------------------------------------+
// |       -=-=- DO NOT TOUCH PAST HERE -=-=-       |
// |       -=-=- DO NOT TOUCH PAST HERE -=-=-       |
// |       -=-=- DO NOT TOUCH PAST HERE -=-=-       |
// +------------------------------------------------+
    
    private function MERConditions takes nothing returns boolean
        return GetSpellAbilityId() == MERID
    endfunction
    
    private function MERFilters takes nothing returns boolean
        return IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false and IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) == false
    endfunction

    private function MERActions takes nothing returns nothing
        local location target = GetSpellTargetLoc()
        local unit t = GetTriggerUnit()
        local group g = CreateGroup()
        local unit u
        local unit d
        call GroupEnumUnitsInRange(g, GetLocationX(target), GetLocationY(target), MERRange(GetUnitAbilityLevel(t, MERID)), MERCONDITION)
        loop
        set u = FirstOfGroup(g)
        exitwhen u == null
            set d = CreateUnit(GetOwningPlayer(t), MERDUMMY, GetUnitX(u), GetUnitY(u), bj_UNIT_FACING)
            call UnitAddAbility(d, SPELL)
            call SetUnitAbilityLevel(d, SPELL, GetUnitAbilityLevel(t, MERID))
            call IssueTargetOrder(d, MERORDER, u)
            call UnitApplyTimedLife(d, 'BTLF', 3)
            call GroupRemoveUnit(g, u)
        endloop
        call DestroyGroup(g)
        call RemoveLocation(target)
        set target = null
        set g = null
        set d = null
        set u = null
    endfunction

//===========================================================================
    private function MERInit takes nothing returns nothing
        local trigger t = CreateTrigger()
            call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
            call TriggerAddCondition(t, Condition(function MERConditions))
            call TriggerAddAction(t, function MERActions)
            set MERCONDITION = Filter(function MERFilters) 
    endfunction

endscope


Knockback



Import Difficulty : High (Requires TT and DestructableLib)
GUI / Jass : vJass
MUI / MPI : MUI
Leak / Leakess : Leakless


Quote
The user hits the target with his axe, knocking him back and killing trees on the way and damages unit close to the spell target unit.

Screenshots

WC3ScrnShot_010809_183946_01.jpg


WC3ScrnShot_010809_183947_02.jpg
Code:
JASS:

// +------------------------------------------------------------+
// |                                                            |
// |                   -=-=- Knockback -=-=-                    |
// |                    Requires Jass NewGen                    |
// |                                                            |
// +------------------------------------------------------------+
// |Stuns the targeted unit and then knocks it by some distance |                                                      
// | killing trees, dealing damage to units who are beside the  |                
// | targeted unit                                              |              
// +------------------------------------------------------------+
// |                                                            |
// |   -=-=- How To Implement -=-=-                             |
// |      1. Create a trigger named Knockback                   |
// |      2. Copy the text from this map's trigger              |
// |      3. Copy/paste it into your map's Knockback trigger    |
// |      4. Copy all the abilities to your map.                |
// |      5. Copy all the units to your map.                    |
// |      6. Enjoy!                                             |
// |                                                            |
// +------------------------------------------------------------+
// |                                                            |
// |   -=-=- Credits -=-=-                                      |
// |      Credits are not needed, but appreciated               |
// |         Just don't claim this as yours                     |
// |                                                            |
// +------------------------------------------------------------+

scope Knockback initializer KBInit

// +-------------------------------------+
// |       -=-=- MODIFY HERE -=-=-       |
// |       -=-=- MODIFY HERE -=-=-       |
// |       -=-=- MODIFY HERE -=-=-       |
// +-------------------------------------+

    globals
        private constant integer KBID = 'BOLT'       // Rawcode of dummy spell 
        private constant real SLIDE_SPEED = 700       // Slide speed
        private constant string KBEFFECT = "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl"       // SFX of the targeted spell unit
        private constant boolean KillTrees = true       // Kill trees or not?
        private constant string BLOOD = "Objects\\Spawnmodels\\Human\\HumanLargeDeathExplode\\HumanLargeDeathExplode.mdl"       // SFX when unit comes within the targeted spell unit who got hit
        private constant real TreeRADIUS = 200       // Range needed for a tree to be beside targeted unit before tree dies
        private constant real UnitRADIUS = 200       // Range needed for a unit to be beside targeted unit before they take damage
        private boolexpr KBDAMGER
    endglobals
    
    private function KBDISTANCES takes integer level returns integer
        return level * 300       // How far the unit will get knocked backed
    endfunction

    private function KBDAMAGE takes integer level returns integer
        return level * 5       // Damage the targeted unit takes
    endfunction

// +------------------------------------------------+
// |       -=-=- DO NOT TOUCH PAST HERE -=-=-       |
// |       -=-=- DO NOT TOUCH PAST HERE -=-=-       |
// |       -=-=- DO NOT TOUCH PAST HERE -=-=-       |
// +------------------------------------------------+

    private function KBConditions takes nothing returns boolean
        return GetSpellAbilityId() == KBID // the ID of dummy spell
    endfunction

    private function KillTree takes nothing returns nothing
    if IsDestructableTree(GetEnumDestructable()) then
        call KillDestructable(GetEnumDestructable())
        endif
    endfunction
    
    struct Knock
        unit target
        unit caster
        real x1
        real y1
        real cos
        real sin
        real DISTANCE
        real angle
    endstruct

    private function KBFilters takes nothing returns boolean
        return true 
    endfunction

    private function KBKnockback takes nothing returns boolean
        local Knock data = TT_GetData()
        local unit t
        local real x = GetUnitX(data.target)
        local real y = GetUnitY(data.target)
        local location CasterLoc = GetUnitLoc(data.target)
        //local group g = GetUnitsInRangeOfLocMatching(UnitRADIUS, CasterLoc, DAMGER)
        // Start of what I added
        local group g = CreateGroup()
        call GroupEnumUnitsInRangeOfLoc(g, CasterLoc, UnitRADIUS, KBDAMGER)
        call DestroyBoolExpr(KBDAMGER)
        // End of what I added
        set x = x + data.cos * TT_PERIOD * SLIDE_SPEED
        set y = y + data.sin * TT_PERIOD * SLIDE_SPEED
        loop
        set t = FirstOfGroup(g)
        exitwhen t == null
            call GroupRemoveUnit(g, t)
            if IsUnitEnemy(data.caster, GetOwningPlayer(t)) then
                call UnitDamageTarget(data.caster, t, KBDAMAGE(GetUnitAbilityLevel(data.caster, KBID)), false, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
            if GetRandomInt(1,10) == 1 then
            call DestroyEffect(AddSpecialEffect(BLOOD,GetUnitX(t),GetUnitY(t)))
            endif
            endif
        endloop
        if KillTrees == true then
            call EnumDestructablesInCircleBJ(TreeRADIUS, CasterLoc, function KillTree)
        endif
        call SetUnitPosition (data.target, x, y)
        set data.DISTANCE = data.DISTANCE - TT_PERIOD * SLIDE_SPEED
        call RemoveLocation(CasterLoc)
        call DestroyGroup(g)
        set g = null
        set CasterLoc = null
        set t = null
        if data.DISTANCE <= 0 then
            call data.destroy ()
            return true
        endif
        return false
    endfunction

    private function KBActions takes nothing returns nothing
        local Knock data = Knock.create()
        local real x1
        local real y1
        local real x2
        local real y2
        local real angle
        local integer stomp = 7
        set data.caster = GetTriggerUnit()
        set data.target = GetSpellTargetUnit()
        set x1 = GetUnitX (data.caster)
        set y1 = GetUnitY (data.caster)
        set x2 = GetUnitX (data.target)
        set y2 = GetUnitY (data.target)
        set angle = Atan2 (y2 - y1, x2 - x1)
        set data.DISTANCE = KBDISTANCES(GetUnitAbilityLevel(GetTriggerUnit(), KBID))
        set data.cos = Cos (angle)
        set data.sin = Sin (angle)
        call TT_Start (function KBKnockback, data)
        loop
        exitwhen stomp == 0
        call TriggerSleepAction(GetRandomReal(0.090,0.1))
        call DestroyEffect(AddSpecialEffect(KBEFFECT,GetUnitX(data.target),GetUnitY(data.target)))
        set stomp = stomp - 1
        endloop
    endfunction

//===========================================================================
    private function KBInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(t, Condition(function KBConditions))
        call TriggerAddAction(t, function KBActions)
        set KBDAMGER = Filter(function KBFilters)
    endfunction

endscope

Dead Will

Import Difficulty : Medium
GUI / Jass : vJass
MUI / MPI : MUI
Leak / Leakess : Leakless


Quote
The necromancer, being unholy and powerful, summons the fallen soul of a fallen unit near the necromancer

Screenshots
WC3ScrnShot_010809_184557_01.jpg


WC3ScrnShot_010809_184558_02.jpg

Code
JASS:
// +------------------------------------------------------------+
// |                                                            |
// |                   -=-=- Dead Will -=-=-                    |
// |                    Requires Jass NewGen                    |
// |                                                            |
// +------------------------------------------------------------+
// |         Every 5 seconds , the necromancer has a chance to  |                                                 
// |     revive dead units beside the caster.                   |
// |                                                            |
// +------------------------------------------------------------+
// |                                                            |
// |   -=-=- How To Implement -=-=-                             |
// |      1. Create a trigger named Dead Will                   |
// |      2. Copy the text from this map's trigger              |
// |      3. Copy/paste it into your map's Dead Will trigger    |
// |      4. Copy all the abilities to your map.                |
// |      5. Copy all the units to your map.                    |
// |      6. Enjoy!                                             |
// |                                                            |
// +------------------------------------------------------------+
// |                                                            |
// |   -=-=- Credits -=-=-                                      |
// |      Credits are not needed, but appreciated               |
// |         Just don't claim this as yours                     |
// |                                                            |
// +------------------------------------------------------------+

scope DeadWill initializer DWInit

// +-------------------------------------+
// |       -=-=- MODIFY HERE -=-=-       |
// |       -=-=- MODIFY HERE -=-=-       |
// |       -=-=- MODIFY HERE -=-=-       |
// +-------------------------------------+

    globals
        private constant integer REVIVE = 'A00K'       // Rawcode of dummy passive ability
        private constant integer DWDUMMY = 'h003'       // Rawcode of Dummy Unit
        private constant integer DEAD = 'DEA1'       // Rawcode of Animate Dead
        private constant string SUMMON = "animatedead"       // Order String of Animate Dead
        private boolexpr DWCONDITION
    endglobals

    private function DWCHANCE takes integer level returns integer
        return level * 10    // Chance of Dead Will activating
    endfunction

// +------------------------------------------------+
// |       -=-=- DO NOT TOUCH PAST HERE -=-=-       |
// |       -=-=- DO NOT TOUCH PAST HERE -=-=-       |
// |       -=-=- DO NOT TOUCH PAST HERE -=-=-       |
// +------------------------------------------------+

    private function DWHero takes nothing returns boolean
        return GetUnitAbilityLevel(GetFilterUnit(), REVIVE) > 0 and GetRandomInt(1, 100) <= DWCHANCE (GetUnitAbilityLevel(GetFilterUnit(), REVIVE)) //and GetUnitTypeId(GetFilterUnit()) == 'Ulic'
    endfunction
    
    private function DWRevive takes nothing returns nothing
        local unit e = GetEnumUnit()
        local unit d = CreateUnit(GetOwningPlayer(e), DWDUMMY, GetUnitX(e), GetUnitY(e), bj_UNIT_FACING)
        call UnitAddAbility(d, DEAD)
        call UnitApplyTimedLife(d, 'BTLF', 3)
        call IssueImmediateOrder(d, SUMMON)
        set e = null
        set d = null
    endfunction

    private function DWActions takes nothing returns nothing
        local group g = CreateGroup()
        call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, DWCONDITION)
        call ForGroup(g, function DWRevive)
        call DestroyGroup(g)
        set g = null
    endfunction

//===========================================================================
    private function DWInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterTimerEvent(t, 5.00, true)
        call TriggerAddAction(t, function DWActions)
        set DWCONDITION = Filter(function DWHero)
    endfunction
    
endscope

Frost Armour


Screenshots
WC3ScrnShot_010809_203247_02.jpg


The lich has a armour that will freeze enemy units that attack it

Code
JASS:
// +------------------------------------------------------------+
// |                                                            |
// |                  -=-=- Lich Armor -=-=-                    |
// |                   Requires Jass NewGen                     |
// |                                                            |
// +------------------------------------------------------------+
// |     Units that attack the lich has a chance to get         |                                              
// |     a frostbite dealing damage and slowing the enemy       |                                                        
// |                                                            |
// +------------------------------------------------------------+
// |                                                            |
// |   -=-=- How To Implement -=-=-                             |
// |      1. Create a trigger named Lich Armor                   |
// |      2. Copy the text from this map's trigger              |
// |      3. Copy/paste it into your map's Lich Armor trigger    |
// |      4. Copy all the abilities to your map.                |
// |      5. Copy all the units to your map.                    |
// |      6. Enjoy!                                             |
// |                                                            |
// +------------------------------------------------------------+
// |                                                            |
// |   -=-=- Credits -=-=-                                      |
// |      Credits are not needed, but appreciated               |
// |         Just don't claim this as yours                     |
// |                                                            |
// +------------------------------------------------------------+

scope LichArmor initializer LAInit

// +-------------------------------------+
// |       -=-=- MODIFY HERE -=-=-       |
// |       -=-=- MODIFY HERE -=-=-       |
// |       -=-=- MODIFY HERE -=-=-       |
// +-------------------------------------+

    globals
        private constant integer FROST = 'A00M'       // Rawcode of dummy passive spell
        private constant integer NOVA = 'B003'       // Rawcode of Frost Nova
        private constant integer LADUMMY = 'h003'       // Rawcode of Dummy Unit
        private constant string LADAMAGE = "frostnova"       // Order String of Frost Nova
    endglobals

    private function LACHANCE takes integer level returns integer
        return level * 10       // Chance that Lich Armour will activate
    endfunction

// +------------------------------------------------+
// |       -=-=- DO NOT TOUCH PAST HERE -=-=-       |
// |       -=-=- DO NOT TOUCH PAST HERE -=-=-       |
// |       -=-=- DO NOT TOUCH PAST HERE -=-=-       |
// +------------------------------------------------+
    
    private function LATrue takes nothing returns boolean
        return true
    endfunction

    private function LAConditions takes nothing returns boolean
       return IsUnitEnemy(GetTriggerUnit(), GetOwningPlayer(GetAttacker())) and GetRandomInt(0, 100) <= LACHANCE(GetUnitAbilityLevel(GetTriggerUnit(), FROST)) and GetUnitAbilityLevel(GetTriggerUnit(), FROST) > 0
    endfunction

    private function LAActions takes nothing returns nothing
        local unit t = GetTriggerUnit()
        local unit d = CreateUnit(GetOwningPlayer(t), LADUMMY, GetUnitX(t), GetUnitY(t), bj_UNIT_FACING)
        call UnitAddAbility(d, NOVA)
        call IssueTargetOrder(d, LADAMAGE, GetAttacker())
        call UnitApplyTimedLife(d, 'BTLF', 1)
        set d = null
        set t = null
    endfunction

//===========================================================================
    private function LAInit 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 LATrue))  
            set i = i + 1
        endloop
        call TriggerAddCondition(t, Condition(function LAConditions))
        call TriggerAddAction(t, function LAActions)
    endfunction

endscope

The code is now neater done by Wolfie and code layout.
 

Attachments

  • Wraith's Spellpack(W).w3x
    56.3 KB · Views: 294

Kenny

Back for now.
Reaction score
202
Not gonna look through all of it, but:



Should be 'c' for the unit not 'b'.

You use GetTriggerUnit() and GetSpellTargetLoc() a fair bit in the first spell, you may want to make them local variables.

Theres a few BJ's in your codes that are quite easy to make non-BJ's, such as PolarProjectionBJ() - which can be changed by using real X/Y values plus Sin/Cos of an angle.

It may just be some weird error or something, but indentation makes codes much easier to read in my opinion. As an example:

This:
JASS:
globals
private constant integer ID = 'A001' // ID of dummy spell
private constant integer DUMMY = 'h003' // ID of dummy unit
private constant integer BLIZZARD = 'BLIZ' // Blizzard ability rawcode
private constant integer CLAPS = 'CLAP'  // Thunder Clap ability rawcode
endglobals


Can be this:
JASS:
globals
    private constant integer ID = 'A001' // ID of dummy spell
    private constant integer DUMMY = 'h003' // ID of dummy unit
    private constant integer BLIZZARD = 'BLIZ' // Blizzard ability rawcode
    private constant integer CLAPS = 'CLAP'  // Thunder Clap ability rawcode
endglobals


And this:
JASS:
private function Knockback takes nothing returns boolean
local Knock data = TT_GetData()
set data.i = data.i + 1
if data.i == 50 then
call data.destroy()
return true
else
call SetUnitPositionLoc(data.t, PolarProjectionBJ(GetUnitLoc(data.c), DistanceBetweenPoints(GetUnitLoc(data.c), GetUnitLoc(data.t))+10, AngleBetweenPoints(GetUnitLoc(data.c), GetUnitLoc(data.t))))
return false
endif
endfunction


Can be this:
JASS:
private function Knockback takes nothing returns boolean
    local Knock data = TT_GetData()

    set data.i = data.i + 1
    if data.i == 50 then
        call data.destroy()
        return true
    else
        call SetUnitPositionLoc(data.t, PolarProjectionBJ(GetUnitLoc(data.c), DistanceBetweenPoints(GetUnitLoc(data.c), GetUnitLoc(data.t))+10, AngleBetweenPoints(GetUnitLoc(data.c), GetUnitLoc(data.t))))
        return false
    endif
endfunction


Besides all that, good work on the spells. + rep.
 

wraithseeker

Tired.
Reaction score
122
It will be updated when I get back from school tomorrow, I'm off, need to sleep.

+REP kenny for nice feedbacks
 

Flare

Stops copies me!
Reaction score
662
Thread will be updated when I get back from school tomorrow with code update and a attached demo map
Please don't do that - upload the demo map when your submitting the spell(s), otherwise it's not much use to anyone...


That line leaks heavily - 5 GetUnitLoc calls that aren't assigned to variables (even though you will only need 2 variables) and the PolarProjectionBJ call, not assigned to a variable - fix the leaks, or replace them with XY coordinates

Also, store data.c's casting position, or the angle between the caster and target in your actions function - if the caster moves, the PolarProjection recalculates the angle based on the caster's CURRENT position, so if he moved around, the slide changes direction. And offset based on the target's position, not the caster's

You need some configuration for Knockback - timer interval (or else just use the TT_Start function instead of TT_StartEx, and stick with TT_PERIOD as your interval), slide speed, max sliding distance (or a speed reduction value, either will do)


Blizzard and Mass Entangling Roots seem to have their screenshots mixed up
EDIT: Yes, you've definitely got one screenshot for Blizzard mixed up with one of the screenshots for Mass Entangling Roots - take a look at what ability is being cast in the second screenshot under Mass Entangling Roots heading, and what abilities the hero has in the first screenshot under the Blizzard heading, you can see that something's wrong :)

More to be added soon
 

wraithseeker

Tired.
Reaction score
122
Well Flare, It took me 40+ minutes to set up this page, updating now..

Code:
slide speed, max sliding distance (or a speed reduction value, either will do)


How?

And the unit isn't supposed to turn, This is my first knockback spell so pardon me for noob mistake etc.. meaning, he shouldn't even ever move / attack when getting knockbacked.
 

Flare

Stops copies me!
Reaction score
662
slide speed, max sliding distance (or a speed reduction value, either will do)

How?
Add a few constants at the top
JASS:
constant real SLIDE_SPEED = 700
constant real MAX_DISTANCE = 450

Change your ticks struct member (i) to a real type
Initialize it to MAX_DISTANCE in your Actions function

Then, in the timer callback
JASS:
local Knock data = TT_GetData ()
local real x1 = GetUnitX (data.target)
local real y1 = GetUnitY (data.target)
set x1 = x1 + a.cos * SLIDE_SPEED * TIMER_INTERVAL
set y1 = y1 + a.sin * SLIDE_SPEED * TIMER_INTERVAL
//TIMER_INTERVAL will be replaced with TT_PERIOD, unless you plan to stick with TT_StartEx
call SetUnitX (data.target, x1)
call SetUnitY (data.target, y1)
set data.distance = data.distance - (SLIDE_SPEED * TIMER_INTERVAL)
//.distance is here instead of .i and it should be initialized to MAX_DISTANCE
if data.distance <= 0 then
//end instance, clean up, etc
endif
...


And the unit isn't supposed to turn, This is my first knockback spell so pardon me for noob mistake etc.. meaning, he shouldn't even ever move / attack when getting knockbacked.
Just store the Sin/Cos values of the original angle in struct members e.g.
JASS:
local Knock data = Knock.create ()
//more locals and stuff
set data.cos = Cos (angle)
set data.sin = Sin (angle)

then offset the units like in the example above
 

wraithseeker

Tired.
Reaction score
122
Will it be able to attack?, all orders issued to the units must not be ordered meaning you can't move the unit when you got stunned.

Demo map is here now..

I have a project going on and well I am so busy that I don't have time today so I will do it on saturday, sorry if it takes too long for some people :(
 

wraithseeker

Tired.
Reaction score
122
24 Hour Bump

And some errors In my knockback trigger.

My spell has a error, whenever I cast the spell, the unit gets knocked like a random dude. Also, Should I use vexorian's pathing check to make it not go out of the map?
How do I make it kill trees when it comes to 100 range of it which is when it touches it and I don't want it to go through units.

Here's Code

JASS:
<div class="bbCodeSpoiler">
	<button type="button" class="bbCodeSpoiler-button button" data-xf-click="toggle" data-xf-init="tooltip" title="Click to reveal or hide spoiler"><span class="button-text">

		<span>Spoiler</span>
	</span></button>
	<div class="bbCodeSpoiler-content">
		<div class="bbCodeBlock bbCodeBlock--spoiler">
			<div class="bbCodeBlock-content">scope Stunbolt initializer Init

globals
private constant integer SPELL = &#039;BOLT&#039; // raw code of dummy spell 
private constant real MAX_DISTANCE = 700
private constant real SLIDE_SPEED = 700
private constant real TIMER_INTERVAL = 0.03125
endglobals

// do not touch below this point//

struct Knock
unit t
unit c
real x1
real y1
real cos
real sin
real DISTANCE
real angle
endstruct

private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELL
endfunction

private function Knockback takes nothing returns boolean
local Knock data = TT_GetData()
set data.x1 = data.x1 + data.cos * SLIDE_SPEED * TIMER_INTERVAL
set data.y1 = data.y1 + data.sin * SLIDE_SPEED * TIMER_INTERVAL
call SetUnitX(data.t,data.x1)
call SetUnitY(data.t,data.y1)
set data.DISTANCE = data.DISTANCE - (SLIDE_SPEED * TIMER_INTERVAL)
if data.DISTANCE &lt;= 0 then
call data.destroy()
return true
endif
return false
endfunction

private function Actions takes nothing returns nothing
local Knock data = Knock.create()
set data.DISTANCE = MAX_DISTANCE
set data.t = GetSpellTargetUnit()
set data.c = GetTriggerUnit()
set data.x1 = GetUnitX(data.t)
set data.y1 = GetUnitY(data.t)
set data.angle = Atan2(data.y1,data.x1)
set data.cos = Cos(data.angle)
set data.sin = Sin(data.angle)
call TT_Start(function Knockback, data)
endfunction

private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function Conditions))
call TriggerAddAction(t, function Actions)
endfunction

endscope</div>
		</div>
	</div>
</div>
 
Reaction score
341
Was that done reading the KB vJASS tutorial on hive? i would suggest to just use a pre-made kb system.


Im also not too good at math so i don't know what x1/y1 are producing but you can tryin something like this instead, it will move the unit towards his facing.

JASS:
scope Stunbolt initializer Init

globals
    private constant integer SPELL = &#039;BOLT&#039; // raw code of dummy spell 
    private constant real MAX_DISTANCE = 700
    private constant real SLIDE_SPEED = 700
    private constant real TIMER_INTERVAL = 0.03125
endglobals

// do not touch below this point//

struct Knock
    unit t
    unit c
    real x1
    real y1
    real cos
    real sin
    real DISTANCE
    real angle
endstruct

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == SPELL
endfunction

private function Knockback takes nothing returns boolean
    local Knock data = TT_GetData()
    set data.x1 = GetUnitX(data.t) + (SLIDE_SPEED*TIMER_INTERVAL) * Cos(GetUnitFacing(data.t) * bj_DEGTORAD)
    set data.y1 = GetUnitY(data.t) + (SLIDE_SPEED*TIMER_INTERVAL) * Sin(GetUnitFacing(data.t) * bj_DEGTORAD)
    call SetUnitX(data.t,data.x1)
    call SetUnitY(data.t,data.y1)
    set data.DISTANCE = data.DISTANCE - (SLIDE_SPEED * TIMER_INTERVAL)
    if data.DISTANCE &lt;= 0 then
        call data.destroy()
        return true
    endif
    return false
endfunction

private function Actions takes nothing returns nothing
    local Knock data = Knock.create()
    set data.DISTANCE = MAX_DISTANCE
    set data.t = GetSpellTargetUnit()
    set data.c = GetTriggerUnit()
    set data.x1 = GetUnitX(data.t)
    set data.y1 = GetUnitY(data.t)
    set data.angle = Atan2(data.y1,data.x1)
    set data.cos = Cos(data.angle)
    set data.sin = Sin(data.angle)
    call TT_Start(function Knockback, data)
endfunction

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t, Condition(function Conditions))
    call TriggerAddAction(t, function Actions)
endfunction

endscope


You can try that out, maybe your formula was just messed. I also indented your code it was annoying, good luck.
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Using 'TAB'.

EDIT:
I spent 5 minutes reading the entire thread and within those 5 minutes TriggerHappy posted and I lost to him in saying 'TAB'. :(
 

wraithseeker

Tired.
Reaction score
122
Testing it now... and I don't like to use many systems due to the credit issue. Makes me feel like as though they did the work for me.

Now it slides the unit by the direction where the unit is facing, what I want is that when you shoot at a unit, they should slide behind and not infront.

E.g X shoots Y at north, Y is at south, Y should slide down south.
 

Flare

Stops copies me!
Reaction score
662
JASS:
set data.x1 = GetUnitX(data.t)
set data.y1 = GetUnitY(data.t)
set data.angle = Atan2(data.y1,data.x1)

You can't get the slope (and, subsequently, the angle) of a line froma single pair of points.
JASS:
local real cx = GetUnitX (caster)
local real cy = GetUnitY (caster)
local real tx = GetUnitX (target)
local real ty = GetUnitY (target)
local real angle = Atan2 (ty - cy, tx - cx)
set data.cos = Cos (angle)
set data.sin = Sin (angle)

There's no need to store angle, or unit coordinates in your struct, you're going to be constantly retrieving updates unit coordinates for the target (you won't be needed caster coordinates anymore) and you never use angle anymore once you've set .cos and .sin

Also, since you've changed to TT_Start, you can remove that TIMER_INTERVAL constant, and replace all usage of it with TT_PERIOD e.g.
JASS:
    set data.x1 = GetUnitX(data.t) + (SLIDE_SPEED*TT_PERIOD) * Cos(GetUnitFacing(data.t) * bj_DEGTORAD)
    set data.y1 = GetUnitY(data.t) + (SLIDE_SPEED*TT_PERIODL) * Sin(GetUnitFacing(data.t) * bj_DEGTORAD)
    call SetUnitX(data.t,data.x1)
    call SetUnitY(data.t,data.y1)
    set data.DISTANCE = data.DISTANCE - (SLIDE_SPEED * TT_PERIOD)

Also, you stored sin and cos values in the struct, why are you using GetUnitFacing instead?

Will it be able to attack?, all orders issued to the units must not be ordered meaning you can't move the unit when you got stunned.
If you don't want any orders to be issued, use SetUnitPosition (whichUnit, x, y) instead of SetUnitX and SetUnitY

Was that done reading the KB vJASS tutorial on hive? i would suggest to just use a pre-made kb system.
Do we really need even more stuff to import?
And, considering this is wraithseeker's first knockback(?), he is probably better off learning how to do it himself, because every triggered spell that requires some sort of projectile movement is gonna work on a similar principle, so he may as well learn how to do it now so he'll know it for any other spell he makes with a projectile/knockback.

Anyway, knockback systems will only get him so far, since they all have individual limitations
 
Reaction score
341
JASS:
scope Stunbolt initializer Init

globals
    private constant integer SPELL = &#039;BOLT&#039; // raw code of dummy spell 
    private constant real MAX_DISTANCE = 700
    private constant real SLIDE_SPEED = 700
    private constant real TIMER_INTERVAL = 0.03125
endglobals

// do not touch below this point//

struct Knock
    unit t
    unit c
    real x1
    real y1
    real cos
    real sin
    real DISTANCE
    real angle
endstruct

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == SPELL
endfunction

private function Knockback takes nothing returns boolean
    local Knock data = TT_GetData()
    set data.x1 = GetUnitX(data.c) + (SLIDE_SPEED*TIMER_INTERVAL) * Cos(GetUnitFacing(data.t) * bj_DEGTORAD)
    set data.y1 = GetUnitY(data.c) + (SLIDE_SPEED*TIMER_INTERVAL) * Sin(GetUnitFacing(data.t) * bj_DEGTORAD)
    call SetUnitX(data.t,data.x1)
    call SetUnitY(data.t,data.y1)
    set data.DISTANCE = data.DISTANCE - (SLIDE_SPEED * TIMER_INTERVAL)
    if data.DISTANCE &lt;= 0 then
        call data.destroy()
        return true
    endif
    return false
endfunction

private function Actions takes nothing returns nothing
    local Knock data = Knock.create()
    set data.DISTANCE = MAX_DISTANCE
    set data.t = GetSpellTargetUnit()
    set data.c = GetTriggerUnit()
    set data.x1 = GetUnitX(data.t)
    set data.y1 = GetUnitY(data.t)
    set data.angle = Atan2(data.y1,data.x1)
    set data.cos = Cos(data.angle)
    set data.sin = Sin(data.angle)
    call TT_Start(function Knockback, data)
endfunction

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t, Condition(function Conditions))
    call TriggerAddAction(t, function Actions)
endfunction

endscope


Should fix it.
 

Flare

Stops copies me!
Reaction score
662
Should fix it.
Ahm... from what I see, all you did was change the GetUnitX/Y parameter here
JASS:
set data.x1 = GetUnitX(data.c) + (SLIDE_SPEED*TIMER_INTERVAL) * Cos(GetUnitFacing(data.t) * bj_DEGTORAD)
    set data.y1 = GetUnitY(data.c) + (SLIDE_SPEED*TIMER_INTERVAL) * Sin(GetUnitFacing(data.t) * bj_DEGTORAD)

which would probably make things worse, since the target would just stick with the caster - at least, before, the target would actually slide :p Probably wouldn't slide in the right direction, but it would slide, at the very least

Code:
real DISTANCE
Why is that capitalized? Seems a bit out-of-place there :S
 

Flare

Stops copies me!
Reaction score
662
No, that'd just force the target to be stuck in front of the caster (since you'd be offsetting the caster's position, with respect to the caster's facing, which is directly in front of him)

Anyway, I did outline what was wrong already (namely the fact that an angle is being calculated with only one pair of coordinates, and that the target is being offset towards it's own facing)
*points at post 16*
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top