wraithseeker
Tired.
- Reaction score
- 122
I have made a spell after some time and is happy to submit it to Thehelper.
Import Difficulty: Medium
GUI/JASS: VJASS
MUI/MPI: MUI
Leakless/Leak: Leakless
[
Verison 1.1 Update
-Removed PolledWait and replaced with TriggerSleepaction
-Depending on the level of your ability, the dummy ability will change in stun duration.
-Added.... some terrain
Verison 1.2 Update
-turned some BJS into natives
- Now there is tooltip for the spell
- Dummy no longer shows and you will never ever see it.
Verison 1.3 Update
-Changed some functions to make it more efficent
-Unit now spawns for neutral passive
- Ability is now added at Init
Verison 1.4 Update
-Some minor text changes and ability name changes
-screenshots are added
Code
Screenshots
Import Difficulty: Medium
GUI/JASS: VJASS
MUI/MPI: MUI
Leakless/Leak: Leakless
[
Ability Information
Gives a 5/10/15 percent chance to do 3/4/5 second stun when a unit attacks you and the enemy will fall down.
Verison 1.1 Update
-Removed PolledWait and replaced with TriggerSleepaction
-Depending on the level of your ability, the dummy ability will change in stun duration.
-Added.... some terrain
Verison 1.2 Update
-turned some BJS into natives
- Now there is tooltip for the spell
- Dummy no longer shows and you will never ever see it.
Verison 1.3 Update
-Changed some functions to make it more efficent
-Unit now spawns for neutral passive
- Ability is now added at Init
Verison 1.4 Update
-Some minor text changes and ability name changes
-screenshots are added
Code
JASS:
scope Fortitute initializer Init
// +------------------------------------------------------------------------+
// | Fortitute - Created by wraithseeker. Requires JassNewGen! |
// +------------------------------------------------------------------------+
// | Gives 5/10/15% chance to knock down a enemy unit that is attacking the
// | person who has the spell.
// |
// +------------------------------------------------------------------------+
// | How to Import: |
// | - Create a new trigger |
// | - Convert it to Custom text |
// | - Replace everything there with this code |
// | - Change the constants to suit yourself |
// | - Make a dummy unit and a dummy ability based off storm bolt |
// | - create a passive ability based off anything and set everything to 0%|
// | - You don't have to give me credits but don't say this spell is yours.| |
// +------------------------------------------------------------------------+
// | Credits to Viikuna for helping me with some bugs|
// |-------------|-------------------------------------------------|
// | Constants: |
// |-------------|
globals
private constant string EFFECT = "Abilities\\Spells\\Items\\TomeOfRetraining\\TomeOfRetrainingCaster.mdl" // effect at the guy who attacked
private constant integer ID = 039;A003039; // ability ID of spell
private constant string POSITION = "origin" // the position where u want to attach for effect at the guy who attacked
private constant string DEATH = "death" // the animation you want to play for the unit which attacked the person who has the ability
private constant integer UNIT = 039;h001039; // ID of dummy unit
private constant integer SPELL = 039;A002039; // ID Of dummy ability which will be used to stun
private unit Dealer // dummy unit
endglobals
//|----------------|
//|End Of Constants|
//------------------
private function CHANCE takes integer level returns integer
return level * 5 // the amount of chance each level the person can get knocked down
endfunction
/// DO not touch below this line ///
private function True takes nothing returns boolean
return true
endfunction
private function Conditions takes nothing returns boolean
return IsUnitEnemy(GetTriggerUnit(), GetOwningPlayer(GetAttacker())) and GetRandomInt(0, 100) <= CHANCE(GetUnitAbilityLevel(GetTriggerUnit(), ID)) and GetUnitAbilityLevel(GetTriggerUnit(), ID) > 0
endfunction
private function Actions takes nothing returns nothing
local unit t = GetTriggerUnit()
local unit u = GetAttacker()
call SetUnitX(Dealer,GetUnitX(u))
call SetUnitY(Dealer,GetUnitY(u))
call SetUnitAbilityLevel(Dealer, SPELL, GetUnitAbilityLevel(t, ID))
call IssueTargetOrder(Dealer,"thunderbolt",u)
call DestroyEffect(AddSpecialEffectTarget(EFFECT,u,POSITION))
call TriggerSleepAction(0.1)
call SetUnitAnimation(u,DEATH)
set t = null
set u = 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 Conditions))
call TriggerAddAction( t, function Actions )
set Dealer = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),UNIT,0.0,0.0,0.0)
call UnitAddAbility(Dealer,SPELL)
endfunction
endscope