• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Wild Axes

Status
Not open for further replies.
Level 3
Joined
Dec 18, 2007
Messages
40
How can i create A skill like Rexxar's In dota? That with the Axes :explain-->

when Rexxars uses that skill he Drops two axes to target..
I tryed to make sth like that but the probs were that :
Event :
A unit begins casting an ability
Condition:
(Ability Being cast) equal to XxX
Action:
Set :positionOfCastingUnit = (position of casting unit)
Unit create a dummy unit to position of (casting unit) facing default degrees Unit order (last created unit) to move to Target point of ability being cast
Wait 1.3 sec (cuz that i expect that the ability Does for the max range<-- I think this one of problems
Unit order (last created unit to move to (PositionOfCastingUnit)
Wait 1.3 sec Unit remove (last created unit) from the game

What i think is that '' TIme is one of the problems as it is not the current time Also If Casting unit moves from that position Where he cast the ability The unit doesnt realise that and comes back to 1st position.. i tryed to set Event: evry 1 sec Action : set:positionOfCastingUnit=positon of (casting unit)

Plz help me!!
tip (I am sry If my questions of dota make people angry
 
Level 17
Joined
Jun 17, 2007
Messages
1,433
/A000= Spell Ability
/e01T= The axes
/Amrf = Crow Form
JASS:
function WildAxesSpell takes nothing returns boolean
    return GetSpellAbilityId()=='A000'
endfunction

function WildAxesTreeCut takes nothing returns nothing
    call KillDestructable(GetEnumDestructable())
endfunction

function WildAxesDamage takes unit pWho,real pxx,real pyy,group pVictims returns nothing
    local group lGroup=CreateGroup()
    local unit lTMP
    local rect lMx=Rect(pxx-150,pyy-150,pxx+150,pyy+150)
    call GroupEnumUnitsInRange(lGroup,pxx,pyy,150,null)
    loop
        set lTMP=FirstOfGroup(lGroup)
        exitwhen lTMP==null
        if(IsUnitInGroup(lTMP,pVictims)==false and IsUnitEnemy(lTMP,GetOwningPlayer(pWho))and IsUnitVisible(lTMP,GetOwningPlayer(pWho)))then
            if(GetUnitAbilityLevel(lTMP,'A04R')!=1 and GetUnitState(lTMP,UNIT_STATE_LIFE)>0 and IsUnitType(lTMP,UNIT_TYPE_STRUCTURE)==false)then
                call GroupAddUnit(pVictims,lTMP)
                call UnitDamageTarget(pWho,lTMP,60+GetUnitAbilityLevel(pWho,'A0O1')*30,true,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_METAL_HEAVY_SLICE)
                call AddSpecialEffectTarget("Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl",lTMP,"overhead")
            endif
        endif
        call GroupRemoveUnit(lGroup,lTMP)
    endloop
    call EnumDestructablesInRect(lMx,null,function WildAxesTreeCut)
    call RemoveRect(lMx)
    call DestroyGroup(lGroup)
endfunction

function WildAxesTimer takes nothing returns nothing
    local string lTable=H2Tx(GetExpiredTimer())
    local unit lAxe=GetUnit(lTable,"Axe")
    local unit lCaster=GetUnit(lTable,"Hero")
    local real lAx=GetReal(lTable,"Ax")
    local real lAy=GetReal(lTable,"Ay")
    local real lCx=GetReal(lTable,"Cx")
    local real lCy=GetReal(lTable,"Cy")
    local real lBx=GetReal(lTable,"Bx")
    local real lBy=GetReal(lTable,"By")
    local real laa=GetReal(lTable,"a")
    local real lbb=1-laa
    local boolean lIsPassed=GetBoolean(lTable,"FirstPass")
    local group lCheckGroup=GetGroup(lTable,"AlreadyDamaged")
    call SetUnitX(lAxe,SafeX(lAx*laa*laa+lBx*2*laa*lbb+lCx*lbb*lbb))
    call SetUnitY(lAxe,SafeY(lAy*laa*laa+lBy*2*laa*lbb+lCy*lbb*lbb))
    call WildAxesDamage(lCaster,GetUnitX(lAxe),GetUnitY(lAxe),lCheckGroup)
    if(lIsPassed)then
        call SetReal(lTable,"a",laa-.02)
    else
        call SetReal(lTable,"a",laa+.02)
        call SetReal(lTable,"Ax",GetUnitX(lCaster))
        call SetReal(lTable,"Ay",GetUnitY(lCaster))
    endif
    if(laa<0 and lIsPassed)then
        call SetBoolean(lTable,"FirstPass",false)
        call SetReal(lTable,"Bx",lAx+300*Cos(Atan2(lCy-lAy,lCx-lAx)+GetReal(lTable,"AngleOffset")))
        call SetReal(lTable,"By",lAy+300*Sin(Atan2(lCy-lAy,lCx-lAx)+GetReal(lTable,"AngleOffset")))
    endif
    if(laa>1 and lIsPassed==false)then
        call PauseTimer(GetExpiredTimer())
        call DestroyGroup(lCheckGroup)
        call FastFlush(lTable)
        call RemoveUnit(lAxe)
        call DestroyTimer(GetExpiredTimer())
    endif
endfunction

function WildAxesSettings takes nothing returns nothing
    local unit lCaster=GetTriggerUnit()
    local real lCasterX=GetUnitX(lCaster)
    local real lCasterY=GetUnitY(lCaster)
    local real lTargetX=GetLocationX(GetSpellTargetLoc())
    local real lTargetY=GetLocationY(GetSpellTargetLoc())
    local unit lAxe1=CreateUnit(GetOwningPlayer(lCaster),'e01T',lCasterX,lCasterY,270.)
    local unit lAxe2=CreateUnit(GetOwningPlayer(lCaster),'e01T',lCasterX,lCasterY,270.)
    local string lTable1
    local string lTable2
    local timer lTimer1=CreateTimer()
    local timer lTimer2=CreateTimer()
    if GetSpellTargetUnit()!=null then
        set lTargetX=GetUnitX(GetSpellTargetUnit())
        set lTargetY=GetUnitY(GetSpellTargetUnit())
    endif
    call UnitAddAbility(lAxe1,'Amrf')
    call UnitRemoveAbility(lAxe1,'Amrf')
    call SetUnitFlyHeight(lAxe1,150,0)
    call UnitAddAbility(lAxe2,'Amrf')
    call UnitRemoveAbility(lAxe2,'Amrf')
    call SetUnitFlyHeight(lAxe2,150,0)
    set lTable1=H2Tx(lTimer1)
    call SetHandle(lTable1,"Hero",lCaster)
    call SetHandle(lTable1,"Axe",lAxe1)
    call SetHandle(lTable1,"AlreadyDamaged",CreateGroup())
    call SetReal(lTable1,"Ax",lCasterX)
    call SetReal(lTable1,"Ay",lCasterY)
    call SetReal(lTable1,"Cx",lTargetX)
    call SetReal(lTable1,"Cy",lTargetY)
    call SetReal(lTable1,"Bx",lCasterX+300*Cos(Atan2(lTargetY-lCasterY,lTargetX-lCasterX)+45))
    call SetReal(lTable1,"By",lCasterY+300*Sin(Atan2(lTargetY-lCasterY,lTargetX-lCasterX)+45))
    call SetReal(lTable1,"a",1)
    call SetReal(lTable1,"AngleOffset",-45)
    call SetBoolean(lTable1,"FirstPass",true)
    set lTable2=H2Tx(lTimer2)
    call SetHandle(lTable2,"Hero",lCaster)
    call SetHandle(lTable2,"Axe",lAxe2)
    call SetHandle(lTable2,"AlreadyDamaged",CreateGroup())
    call SetReal(lTable2,"Ax",lCasterX)
    call SetReal(lTable2,"Ay",lCasterY)
    call SetReal(lTable2,"Cx",lTargetX)
    call SetReal(lTable2,"Cy",lTargetY)
    call SetReal(lTable2,"Bx",lCasterX+300*Cos(Atan2(lTargetY-lCasterY,lTargetX-lCasterX)-45))
    call SetReal(lTable2,"By",lCasterY+300*Sin(Atan2(lTargetY-lCasterY,lTargetX-lCasterX)-45))
    call SetReal(lTable2,"a",1)
    call SetReal(lTable2,"AngleOffset",45)
    call SetBoolean(lTable2,"FirstPass",true)
    call TimerStart(lTimer1,.025,true,function WildAxesTimer)
    call TimerStart(lTimer2,.025,true,function WildAxesTimer)
endfunction

function WildAxesInit takes nothing returns nothing
    local trigger ltt=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(ltt,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(ltt,Condition(function WildAxesSpell))
    call TriggerAddAction(ltt,function WildAxesSettings)
endfunction
 
Level 3
Joined
Dec 18, 2007
Messages
40
It could take me 2 days to understand this SKill and then 2 days to use it !!

IS there anything more easy to use ? thx for help anyway :):)
 
Level 3
Joined
Oct 23, 2007
Messages
36
The return function is to make the code easier to edit. Imagine if you copied the spell or changed the spell it was based on. You would have to go through the code to find every reference of the spell.
 
Level 3
Joined
Dec 18, 2007
Messages
40
Question, I don't know JASS much either, but why do you need a function to return the spell's ID?

By the way, warcryergr, spell-related threads go on the Spells and Systems forum.
~Thread Moved

I am really sry , but i have seen such questions on this forum..
I need this because i am making a map like Ninja Vs samurai And i need to make such skill ( this wont be axes but shuriken)
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
The return function is to make the code easier to edit. Imagine if you copied the spell or changed the spell it was based on. You would have to go through the code to find every reference of the spell.
Rui, its used as a condition. When you make a condition in GUI, what its really doing is making a function ask whether or not this condition is true, then returning the answer.
Nevermind, I had forgotten that. Thanks:wgrin:
 
Status
Not open for further replies.
Top