Spellpack Aim, Reflective Counter, and Rock Bounce

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
Spell Pack 1.3

JESP

Aim
Aim the target for a certain of time, damage indicating in the left side of the screen.
After that, shoots a laser to the target dealing random damage between 100-1000.

Features:
-Jass Coded
-Contain Custom Model
-Leakless ( i think so :O )
-Lagless
-Mui ? This need to be decided by Dax..i dont know :p


JASS:
scope Aim

// Aim by Kentchow74+1 / ~GaLs~
// Special thanks to KaTTaNa's Local Handle Variable System
//
// Implementation
// 1. Copy the Aim spell from object editor to your map
// 2. Press Ctrl+D and check the rawcode of the spell...The first four number.
// 3. Replace it in the constant function ARawC
// 4. Copy the code from this map's header to your map header
// 5. Copy this whole trigger to your map
// 6. Replacing the value of the constant function to what you need.
// 7. Copy the 4 items from import manager to your map
// 8. Get NewGen World Editor from <a href="http://wc3campaigns.net/showthread.php?t=90999" target="_blank" class="link link--external" rel="nofollow ugc noopener">http://wc3campaigns.net/showthread.php?t=90999</a>
// 9. I appologize that i lost track of the maker of the model, but i do get it from hiveworkshop.com and wc3campaigns.net

//========================
//== Constant Functions ==
//========================
constant function Aim_RawCode takes nothing returns integer
    return &#039;A006&#039; // the raw code if Aim
endfunction

constant function Aim_Duration takes real LevelOfAbility returns real
    return (LevelOfAbility)+4
endfunction

constant function Aim_LaserEffect takes nothing returns string
return &quot;LasercannonfinalRED.mdx&quot;
endfunction

constant function Aim_FlareEffect takes nothing returns string
return &quot;Abilities\\Spells\\Human\\Flare\\FlareCaster.mdl&quot;
endfunction

constant function Aim_DelayBeforeDamageDealt takes nothing returns real
return 1.4
endfunction

constant function Aim_CheckingInterval takes nothing returns real
return .5
endfunction
//========================
//==         End        ==
//========================

//============================
//==     Main Functions     ==
//============================
private function CreateTT takes real damage, unit WhichUnit, real lifespan returns texttag
local texttag tt = CreateTextTag()
    call SetTextTagText(tt,I2S(R2I(damage))+&quot; !&quot;,12 * 0.023 / 10)
    call SetTextTagVelocityBJ(tt, 64,90)
    call SetTextTagPos(tt, GetUnitX(WhichUnit),GetUnitY(WhichUnit),100)
    call SetTextTagPermanent(tt,false)
    call SetTextTagFadepoint(tt,2)
    call SetTextTagColor(tt,255,0,0,100)
    call SetTextTagLifespan(tt,lifespan)
return tt    
endfunction
private function T2Act takes nothing returns nothing
local texttag casttag //= CreateTextTag()
local texttag trgtag
local timer t2 = GetExpiredTimer()
local unit caster = GetHandleUnit(t2,&quot;caster&quot;)
local unit target = GetHandleUnit(t2,&quot;target&quot;)
local real dmg = GetHandleReal(t2,&quot;dmg&quot;)
    call UnitDamageTarget(caster, target, dmg, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
    set casttag = CreateTT(dmg,caster,1.3)
    set trgtag = CreateTT(dmg,target,1.3)
    call PauseTimer(t2)
    call FlushHandleLocals(t2)
    call DestroyTimer(t2)
set t2 = null
set caster = null
set target = null
set casttag = null
set trgtag = null
endfunction

private function AimCountAct takes nothing returns nothing
local effect array laser
local timer t = GetExpiredTimer()
local timer t2 
local real Time = GetHandleReal(t,&quot;time&quot;)
local real dmg = I2R(GetHandleInt(t,&quot;dmg&quot;))
local unit caster = GetHandleUnit(t,&quot;caster&quot;)
local unit target = GetHandleUnit(t,&quot;target&quot;)
        if (OrderId2StringBJ(GetUnitCurrentOrder(caster)) == &quot;channel&quot;) then
            if Time &gt;= Aim_CheckingInterval() then
                call SetHandleInt(t,&quot;dmg&quot;,R2I(dmg)+GetRandomInt(1,100))
                call SetHandleReal(t,&quot;time&quot;,Time-Aim_CheckingInterval())
            elseif Time&lt;= Aim_CheckingInterval() then
                set t2 = CreateTimer()
                call PauseTimer(t)
                set laser[1] = AddSpecialEffectTarget(Aim_LaserEffect(), target, &quot;origin&quot;)
                set laser[2] = AddSpecialEffectTarget(Aim_FlareEffect(),caster,&quot;origin&quot;)
                call SetHandleHandle(t2,&quot;caster&quot;,caster)
                call SetHandleHandle(t2,&quot;target&quot;,target)
                call SetHandleReal(t2,&quot;dmg&quot;,dmg)
                call TimerStart(t2,Aim_DelayBeforeDamageDealt(),false,function T2Act)
                call FlushHandleLocals(t)            
                call DestroyTimer(t)
                call DestroyEffect(laser[1])
                call DestroyEffect(laser[2])
                set laser[1] = null
                set laser[2] = null
                set t = null
                set t2 = null
                set caster = null
                set target = null
                return
            endif
        elseif (OrderId2StringBJ(GetUnitCurrentOrder(caster)) != &quot;channel&quot;) then
            set t2 = CreateTimer()
            call PauseTimer(t)
            set laser[1] = AddSpecialEffectTarget(Aim_LaserEffect(), target, &quot;origin&quot;)
            set laser[2] = AddSpecialEffectTarget(Aim_FlareEffect(),caster,&quot;origin&quot;) 
            call SetHandleHandle(t2,&quot;caster&quot;,caster)
            call SetHandleHandle(t2,&quot;target&quot;,target)
            call SetHandleReal(t2,&quot;dmg&quot;,dmg)
            call TimerStart(t2,Aim_DelayBeforeDamageDealt(),false,function T2Act)         
            call FlushHandleLocals(t)
            call DestroyTimer(t)
            call DestroyEffect(laser[1])
            call DestroyEffect(laser[2])
            set laser[1] = null
            set laser[2] = null
            set t = null
            set t2= null
            set caster = null
            set target = null
        endif
endfunction

private function AimSetCond takes nothing returns boolean
    return GetSpellAbilityId() == Aim_RawCode()
endfunction

private function AimSetAct takes nothing returns nothing
local integer dmg = 0
local unit caster = GetSpellAbilityUnit()
local unit target = GetSpellTargetUnit()
local timer t = CreateTimer()
local integer LvlOfSpell = GetUnitAbilityLevel(caster,Aim_RawCode())
local real Time = Aim_Duration(I2R(LvlOfSpell))
    call SetHandleReal(t,&quot;time&quot;,Time)
    call SetHandleInt(t,&quot;dmg&quot;,dmg)
    call SetHandleHandle(t,&quot;caster&quot;,caster)
    call SetHandleHandle(t,&quot;target&quot;,target)
    call TimerStart(t,Aim_CheckingInterval(),true,function AimCountAct)
set caster = null
set target = null
set t = null
endfunction
//============================
//==          End           ==
//============================

//===========================================================================
function InitTrig_Aim takes nothing returns nothing
    set gg_trg_Aim = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Aim, EVENT_PLAYER_UNIT_SPELL_EFFECT)
	call TriggerAddCondition(gg_trg_Aim, Condition(function AimSetCond))
    call TriggerAddAction( gg_trg_Aim, function AimSetAct )
endfunction

endscope

Comment
This version added a small floating text indicating how much damage is dealt.

Reflective Counter


Features:
-Jass Coded
-Leakless
-Lagless
-Mui

This hero has chances to counter when being attacked.


JASS:
scope ReflectiveCounterA

//===========================================================
// Reflective Counter by Kentchow74+1 / ~GaLs~
// Special thanks to KaTTaNa&#039;s Local Handle Variable System
//
// Implement Level : Moderate
// Required Tool   : Jass NewGen WorldEditor from <a href="http://www.wc3campaigns.net" target="_blank" class="link link--external" rel="nofollow ugc noopener">www.wc3campaigns.net</a>
//
// Implementation Instruction
// 1. This spell requires quite knowledge about WorldEditor, if there are question &#039;bout this spell, you 
//    are welcomed to pm me at TheHelper or send me email.
// 2. Make a copy of the unit you want to add this spell to (Copy and Paste at Object Editor) and copy
//    the Reflective Counter spell from Object Editor to your map.(Including 1 buff)
// 3. Remove all ability from the dummy you just made.
// 4. Set the following setting to &quot;true&quot; from the unit&#039;s object editing options:
//      -&gt; Stat - Hero - Hide Hero Death Message
//      -&gt; Stat - Hero - Hide Hero Interface Icon
//      -&gt; Stat - Hero - Hide Hero Minimap Display
// 5. Set &quot;Text - Name - Editor Suffix&quot; to &quot;[ReflectiveCounter]&quot; without quotes.
// 6. Copy the trigger to your map.
// 7. Change all the costant function&#039;s number to suit your map&#039;s abilities&#039; raw code.
//      --&gt; To check a the raw code, open the object editor and press CTRL + D and vice versa.
//          Then, pick the first 4 number from your abilities name. Ex: &#039;A000&#039; for abilities
// 8. You may modify the values in Constant Functions referring to the comment i gave.
//
// IMPORTANT NOTES !!
// 1. Create a new trigger for each unit that contains the ability (Reflective Counter)
// 2. Only 1 trigger works per unit.
// 3. After you have Create a new trigger(Make a new copy of this trigger) for a unit, modify every constant function to fit your perpose.
// 4. Everytime you create a new trigger, change the line in the most top (scope ReflectiveCounterA) to &quot;scope ReflectiveCounterB&quot;, if it is your third trigger,change it to &quot;scope ReflectiveCounterC&quot; and so on.
// 5. The purpose of 4th step is to prevent crash between trigger, you could change the &quot;ReflectiveCounterA&quot; to anything you want but just do not touch the &quot;scope &quot;.
//
// --Warning --
// Edit the main engine on your own risk
//
// My email: <a href="mailto:[email protected]">[email protected]</a>
//===========================================================


//===========================================
//==          Constant Functions           ==
//===========================================
private constant function RC_RawCode takes nothing returns integer
    return &#039;A003&#039; //Rawcode of Reflective Counter [Spell]
endfunction

private constant function RC_HeroRawCode takes nothing returns integer
    return &#039;H000&#039;  //Rawcode of the Main Hero [Unit]
endfunction

private constant function RC_heroID takes nothing returns integer
    return &#039;H003&#039; //Rawcode of the dummy you created earlier [Unit]
endfunction

private constant function RC_CounterPercent takes integer lvl returns integer
    return lvl*20 //Percentage to trigger Reflective Counter [Level of Ability x 20]
endfunction
//===========================================
//==                 End                   ==
//===========================================


//===============================================
//==       Reflective Counter Main Engine      ==
//===============================================  
private function RCScond takes nothing returns boolean
    return GetUnitAbilityLevel(GetTriggerUnit(), RC_RawCode())&gt;0 ==true and GetUnitTypeId(GetTriggerUnit())==RC_HeroRawCode()
endfunction

private function Trig_ReflectiveCounterSet_Actions takes nothing returns nothing
local integer start = 1
local integer end = 6
local unit created
local location trgloc = GetUnitLoc(GetAttacker())
local location cre8loc = PolarProjectionBJ(trgloc, 150, GetUnitFacing(GetTriggerUnit()))

        if GetRandomInt(0, 100) &lt;= RC_CounterPercent(GetUnitAbilityLevel(GetTriggerUnit(), RC_RawCode())) then
            set created = CreateUnitAtLoc(GetOwningPlayer(GetTriggerUnit()), RC_heroID() , cre8loc,GetUnitFacing(GetAttacker()))
            call SetHeroLevel(created, GetHeroLevel(GetTriggerUnit()), false)
            
                loop
                exitwhen start &gt; end
                    call UnitAddItem(created, UnitItemInSlot(GetTriggerUnit(), start))
                    set start = start +1 
                endloop
                
            call SelectUnit(created, false)
            call SetUnitVertexColor(created, 255,255,255,50)
            call IssueTargetOrder(created, &quot;attack&quot;, GetAttacker()) 
            call UnitApplyTimedLife(created, &#039;BTLF&#039;, 1.00)
            call UnitAddAbility(created, &#039;Aloc&#039;)
        endif
        
    call RemoveLocation(trgloc)
    call RemoveLocation(cre8loc)
    
set created = null
set trgloc = null
set cre8loc = null
endfunction
//===============================================
//==                   End                     ==
//===============================================


//=====================================================
//==              Remv Trigger Functions             ==
//=====================================================
private function RemvCond takes nothing returns boolean
    return GetUnitTypeId(GetDyingUnit())==RC_heroID()
endfunction

private function RemvAct takes nothing returns nothing
    call RemoveUnit(GetDyingUnit())
endfunction
//=====================================================
//==                      End                        ==
//=====================================================


//===========================================================================
//==                           Initialization                              ==
//===========================================================================
function InitTrig_RC takes nothing returns nothing
local trigger Remv = CreateTrigger()

    set gg_trg_RC = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ(gg_trg_RC, EVENT_PLAYER_UNIT_ATTACKED)
    call TriggerAddCondition(gg_trg_RC, Condition(function RCScond))
    call TriggerAddAction( gg_trg_RC, function Trig_ReflectiveCounterSet_Actions )
    
    call TriggerRegisterAnyUnitEventBJ(Remv,EVENT_PLAYER_UNIT_DEATH)
    call TriggerAddCondition(Remv,Condition(function RemvCond))
    call TriggerAddAction(Remv,function RemvAct)
set Remv = null
endfunction
//===========================================================================
//==                                 End                                   ==
//===========================================================================
endscope


Rock Bounce

Features:
-Jass Coded
-Leakless
-Lagless
-Mui (It is MUI if i am not mistaken)

A magical rock is thrown.
Level 1 - 100 damages and bounces 3 times.
Level 2 - 200 damages and bounces 4 times.
Level 3 - 300 damages and bounces 5 times.

stormbounceku5.jpg

JASS:

scope StormBounce

//===========================================================
// Reflective Counter by Kentchow74+1 / ~GaLs~
// Special thanks to KaTTaNa&#039;s Local Handle Variable System
//
// Implement Level : Easy
// Requires        : Jass NewGen WorldEditor from <a href="http://www.wc3campaigns.net" target="_blank" class="link link--external" rel="nofollow ugc noopener">www.wc3campaigns.net</a>
//                 : Local Handle Vars System from the map header
//
// Implementation Instruction
// 1. Items needed to be copied to your map
//    &gt;&gt; Unit &lt;&lt;
//     - A dummy unit named Dummy Stormer
//    
//    &gt;&gt; Abilities &lt;&lt;
//     - Rock Bounce [T]
//     - Rock Bounce [T] dummy
// 2. Replace the values in Constant Functions to suit your map.
// 3. Any problem are welcomed to email me.
//
// --Warning --
// Edit the main engine on your own risk
//
// My email: <a href="mailto:[email protected]">[email protected]</a>
//===========================================================


//===========================================
//==          Constant Functions           ==
//===========================================
constant function RB_RawCode takes nothing returns integer
return &#039;A004&#039; //Rawcode of RockBounce
endfunction

constant function RB_RawCodeDummy takes nothing returns integer
return &#039;A005&#039; //Rawcode of RockBounce Dummy
endfunction

constant function RB_DummtStormerRawCode takes nothing returns integer
return &#039;h004&#039; //Rawcode of DummyStormer
endfunction

constant function RB_BounceInterval takes nothing returns real
return .65 //interval before the second bounce
endfunction

constant function RB_GetBounceTimes takes integer Lvl returns integer
return Lvl+1 //how many time to bounce
endfunction

constant function RB_Range takes nothing returns real
return 750.00 //bounce in what RB_Range
endfunction
//===========================================
//==                 End                   ==
//===========================================


//================================================================
//==                   Rock Bounce Main Engine                  == 
//================================================================ 
function SurroundCond takes nothing returns boolean
return GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)&gt;0 and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)!= true
endfunction

function tAct takes nothing returns nothing
local timer t            = GetExpiredTimer()
local integer BounceTime = GetHandleInt(t,&quot;bouncetime&quot;)
local boolean NoAlly     = false
local integer Lvl        = GetHandleInt(t,&quot;lvl&quot;)
local unit target        = GetHandleUnit(t,&quot;target&quot;)
local unit target2       = null
local unit caster        = GetHandleUnit(t,&quot;caster&quot;)
local unit randomU
local unit dummy
local group Surround     = CreateGroup()
local group Randomed     

    if BounceTime &gt;0 then
        call GroupEnumUnitsInRange(Surround,GetUnitX(target),GetUnitY(target),RB_Range(),Condition(function SurroundCond))
            if CountUnitsInGroup(Surround)&gt;=2 then
            
                loop
                exitwhen NoAlly == true
                    if CountUnitsInGroup(Surround)&gt;=1 then
                        set Randomed = GetRandomSubGroup(1,Surround)
                        set randomU  = FirstOfGroup(Randomed)
                            if IsUnitAlly(randomU,GetOwningPlayer(caster)) == false and randomU != target then
                                set NoAlly = true
                                call DestroyGroup(Randomed)
                                set target2 = randomU
                            elseif IsUnitAlly(randomU,GetOwningPlayer(caster)) == true or randomU == target then
                                call GroupRemoveUnit(Surround,randomU)
                                call DestroyGroup(Randomed)
                            endif
                    elseif CountUnitsInGroup(Surround)&lt;1 then
                        set NoAlly = true
                    endif
                endloop
                
                if target2 != null then
                    set dummy = CreateUnit(GetOwningPlayer(caster),RB_DummtStormerRawCode(),GetUnitX(target),GetUnitY(target),270)
                    call UnitApplyTimedLife(dummy,&#039;BTLF&#039;,1.2)
                    call UnitAddAbility(dummy,RB_RawCodeDummy())
                    call SetUnitAbilityLevel(dummy,RB_RawCodeDummy(),Lvl)
                    call IssueTargetOrder(dummy,&quot;thunderbolt&quot;,target2)
                    call SetHandleHandle(t,&quot;target&quot;,target2)
                endif
            endif
            
        call SetHandleInt(t,&quot;bouncetime&quot;,BounceTime-1) 
                
    elseif BounceTime&lt;= 0 then
        call PauseTimer(t)
        call FlushHandleLocals(t)
        call DestroyTimer(t)
    endif
    
    call DestroyGroup(Surround)
set t = null
set target = null
set randomU = null
set dummy = null
set caster = null
set Surround = null
set Randomed = null
set target2 = null
endfunction

function SBCond takes nothing returns boolean
return GetSpellAbilityId() == RB_RawCode()
endfunction

function Trig_Storm_Bounce_Actions takes nothing returns nothing
local timer t     = CreateTimer()
local unit caster = GetSpellAbilityUnit()
local unit target = GetSpellTargetUnit()
local integer Lvl = GetUnitAbilityLevel(caster,RB_RawCode())
local integer BounceTime = RB_GetBounceTimes(Lvl)
    call SetHandleHandle(t,&quot;target&quot;,target)
    call SetHandleHandle(t,&quot;caster&quot;,caster)
    call SetHandleInt(t,&quot;bouncetime&quot;,BounceTime)
    call SetHandleInt(t,&quot;lvl&quot;,Lvl)
    call TimerStart(t,RB_BounceInterval(),true,function tAct)
set t = null
set caster = null
set target = null
endfunction
//================================================================
//==                            End                             == 
//================================================================ 


//===========================================================================
function InitTrig_RB takes nothing returns nothing
    set gg_trg_RB = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ(gg_trg_RB, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_RB, Condition(function SBCond))
    call TriggerAddAction( gg_trg_RB, function Trig_Storm_Bounce_Actions )
endfunction

endscope


Download it here:
View attachment Spell Pack 1.3.w3x

Was too free lately, so i merged all spell made my me into a spell pack.
This spell pack include another spell name Cloud Thunder.
But it lags like hell when casted, i won't be submiting it until the lag is fixed.
 
L

LeDah

Guest
nice spell tested it it didnt lag to me but i couldnt understand the damage it does the damage that shows on the floating text??? :D its like you choose the damage that you will do it you have good reacting :D
 
L

LeDah

Guest
its too obvious :p the snipers takes aim make a very powerful shot :p
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
ok...new map posted...
The damage dealt time is barely same when the laser reaches...

And recoded the damage counting trigger...Fix a bug in StopChannel trigger
 

Sim

Forum Administrator
Staff member
Reaction score
534
If you are submitting spells on a regular basis they should be in spellpacks.

Do you have projects for more spells?
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
no...i dont have project for spells...i just make it when i had an idea..
And the cloud torture is abondon for a while ....since last week...no mod checking
 

Sim

Forum Administrator
Staff member
Reaction score
534
I just came back from vacation, tomorrow I will review both spells ;)

Problem is, you can't just submit every spell you create. There are spellpacks, and they exist for a reason.

If you plan on creating many spells as time passes, you include them in a spellpack and submit that spellpack later on, when it is filled (4) with interesting spells!

Now as I know you are regularly creating spells, they should be in spellpacks.

This one will be ok, but I don't want to see you submit a single spell next. Submit it along with 3 more cool spells.

> since last week...no mod checking

I do apologize ;) They shall be reviewed soon enough!

Thank you again for submitting all those spells here, and I hope you understand submitting spellpacks makes it easier for the users browsing the forums.
 

Sim

Forum Administrator
Staff member
Reaction score
534
This spell has potential, though as of now it's a bit off the track.

  • Don't display text messages with the damage.
  • Reduce the number of trigger objects - the less you have, the easier it is to implement!
  • You must credit the maker of those models, whether you remember or not - search.
  • Why all this damage stuff and random triggers? You could just do it all in 1 trigger, without the random damage that's increasing feature, and it would be all the better.

Overall nice spell, but try to make your JASS codes look more... JASS-ish :p

It looks like converted GUI with local variables.
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>dax
No !! NOT GUI CONVERTE... :/ i swear i wrote all of them in scratch....

And remember i opened a thread about how to merge trigger...that problem occur here... i dont know how to merge all code to 1 trigger...=.=

>>Black hawk

nah...nice spell is for present but not for self use...as contest
 

Sim

Forum Administrator
Staff member
Reaction score
534
> No !! NOT GUI CONVERTE... :/ i swear i wrote all of them in scratch....

You wrote them all from scratch but you inspired yourself off GUI, a lot :rolleyes:

Well, when you use periodic events instead use a timer and attach your variables to it (Local Handle Vars, CSCache, or structs (not really attachments but w/e)).

Instead of creating a new trigger object to detect when the unit stops casting, create a local trigger or check his current order with the periodic event.

And a lot more :p

Have a look at my spell, Sacred Circle (http://www.thehelper.net/forums/showthread.php?t=55003, if it can be of any inspiration (It is old, uses Handle Vars but heh).
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
inspired yourself off GUI
What is inspire?

aw...i dont know about Local handle vars....i'll make a thread of asking it...or even structzz...zzz....


Looks nice :p


refering the secrad circle or my aim?

Hey...i manage to make all in 1 trigger...but it uses global...-.- since the timer variable cant be transfer to another trigger....if it is a local timer..
 

Sim

Forum Administrator
Staff member
Reaction score
534
It can be refered to as "GetExpiredTimer()" in the callback function.

Then, you can manage to "Get" the handle variables attached to it (Local Handle Vars / CSCache) or use structs.

Since structs can only be used with Jass New Gen, and you have Jass New Gen, I suggest you do it using structs ;)
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
er...dax....i just learnt some basics of vjass..and got my spell buged...sees the trigger -
JASS:
constant function RawC takes nothing returns integer
return &#039;A006&#039; // the raw code if Aim
endfunction

constant function RawS takes nothing returns integer
return &#039;A003&#039; //the raw code of Stop
endfunction

function AimSetCond takes nothing returns boolean
return GetSpellAbilityId() == RawC()
endfunction

scope trger
    globals
    private trigger AimCount = CreateTrigger()
    private trigger AimStop = CreateTrigger()
    private trigger AimTimer = CreateTrigger()
    private trigger AimStopChannel = CreateTrigger()
    private timer chances
    private integer LvlOfSpell
    private unit cast
    private unit trg
    private real dmg
    endglobals
    
private function TimerWaitz takes real durationz returns nothing  
local timer ct = CreateTimer()
local real tL 
if (durationz &gt; 0) then
call TimerStart(ct, durationz, false, null)
loop 
set tL = TimerGetRemaining(ct) 
call TriggerSleepAction(bj_POLLED_WAIT_INTERVAL)
exitwhen tL &lt;= 0 
endloop  
call DestroyTimer(ct) 
set ct = null 
endif 
endfunction

private function Trig_AimStop_Conditions takes nothing returns boolean
return GetSpellAbilityId() == RawS()
endfunction
    
private function DisTextT takes nothing returns nothing
local integer dmgg = 0
set dmgg = dmgg + GetRandomInt(1, 100)
set dmg = dmgg
endfunction

private function Exec takes trigger ex returns nothing
call TriggerExecute(ex)
endfunction
    
private function Trig_AimStop_Actions takes nothing returns nothing
local texttag tt = CreateTextTag()
local effect laser = (AddSpecialEffectTarget(&quot;LasercannonfinalRED.mdx&quot;, trg, &quot;origin&quot;))
call DisableTrigger(AimTimer)
call DisableTrigger(AimCount)
call UnitRemoveAbility(GetSpellAbilityUnit(), RawS())
call TimerWaitz (1.20)
call SetTextTagText(tt, R2S(dmg),30 * 0.023 / 10)
call SetTextTagPos(tt, GetUnitX(trg), GetUnitY(trg), 200)
call SetTextTagAge(tt, 1.00)
call SetTextTagFadepoint(tt, 1.00)
call SetTextTagColor(tt, 255, 0,0,50)
call SetTextTagLifespan(tt, 3.00)
call UnitDamageTarget(cast, trg, dmg, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(laser)
call TimerWaitz (1)
call DestroyTextTag(tt)
set laser = null
set tt = null
set cast = null
set trg = null
call DestroyTrigger(AimCount)
call DestroyTrigger(AimStop)
call DestroyTrigger(AimTimer)
call DestroyTrigger(AimStopChannel)
set AimCount = null
set AimStop = null
set AimTimer = null
set AimStopChannel = null
endfunction

private function Trig_AimCount_Actions takes nothing returns nothing
call DisTextT()
endfunction

private function Trig_AimTimer_Actions takes nothing returns nothing
call Exec(AimStop)
call DestroyTimer(GetExpiredTimer())
endfunction

public function addreg takes nothing returns nothing
set chances = CreateTimer()
set cast = GetSpellAbilityUnit()
set trg = GetSpellTargetUnit()
set LvlOfSpell = GetUnitAbilityLevel(cast,RawC())
call TimerStart(chances, I2R(LvlOfSpell)+4, false, null)
    call TriggerAddAction(AimTimer, function Trig_AimTimer_Actions )
    call TriggerRegisterTimerExpireEvent(AimTimer, chances)
    call TriggerRegisterTimerEvent(AimCount, 0.5, true)
    call TriggerAddAction(AimCount, function Trig_AimCount_Actions )
    call TriggerRegisterAnyUnitEventBJ( AimStop, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddAction(AimStop, function Trig_AimStop_Actions)
    call TriggerRegisterAnyUnitEventBJ(AimStopChannel, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
    call TriggerAddAction(AimStopChannel, function Trig_AimTimer_Actions )
call DisableTrigger(AimCount)
call EnableTrigger(AimTimer)
call UnitAddAbility(cast, RawS())
call EnableTrigger(AimCount)
set chances = null
endfunction
endscope

function Trig_AimSet_Actions takes nothing returns nothing
call trger_addreg()
endfunction

//===========================================================================
function InitTrig_AimSet takes nothing returns nothing
    set gg_trg_AimSet = CreateTrigger(  )
	call TriggerRegisterAnyUnitEventBJ(gg_trg_AimSet, EVENT_PLAYER_UNIT_SPELL_EFFECT)
	call TriggerAddCondition(gg_trg_AimSet, Condition(function AimSetCond))
    call TriggerAddAction( gg_trg_AimSet, function Trig_AimSet_Actions )
endfunction
 

Sim

Forum Administrator
Staff member
Reaction score
534
What do you mean by "buged"?

Does it crash or it just gives you error messages?

Or does nothing at all...?
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
it run successfull once....then does nothing the second time i cast
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top