Need Help chapter 3

tuantai120

Cool Member
Reaction score
1
I want to make a spell Ice Wall
but i dont know how to do
JASS:
scope Ice initializer Init

globals  
    private constant integer SID = 'A000'
    private constant integer DID = 'h000'
    private constant integer max = 5
    private constant real Distance = 500.
    private constant real Life = 5.
endglobals

private constant function Lifes takes integer lvl returns real
    return Life*lvl
endfunction

private function Con takes nothing returns boolean
        return GetSpellAbilityId() == SID
endfunction

private struct IceData
    unit caster
    unit dummy
    real x
    real y
    real x2
    real y2
    integer lvl 
    timer t
    player P

static method take takes unit u returns IceData
    local IceData i = IceData.allocate()
    set i.caster = u
    set i.P = GetOwningPlayer(i.caster)
    set i.x = GetUnitX(i.caster)
    set i.y = GetUnitY(i.caster)
    set i.lvl = 0
    set i.dummy = CreateUnit(i.P,DID,i.x,i.y,0.)
    return i
endmethod

endstruct

function Act takes nothing returns nothing
endfunction


//===========================================================================
function Init takes nothing returns nothing
    local trigger ice = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( ice ,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition( ice , Condition ( function Con) )
    call TriggerAddAction( ice , function Act )
endfunction

endscope
 

Rainther

I guess I should write something of value here...
Reaction score
61
Could you be more specfic? You got all your ideas in your head, which I can read. :)
You want a longlasting wall? Want anything to get injured? How do you want it to target? etc.
 

tuantai120

Cool Member
Reaction score
1
Could you be more specfic? You got all your ideas in your head, which I can read. :)
You want a longlasting wall? Want anything to get injured? How do you want it to target? etc.

you're right
help me plzzzz
but not target , target-point
 

tuantai120

Cool Member
Reaction score
1
i'm so sorry because double post
this is the picture :
icewall.jpg
 

Tom Jones

N/A
Reaction score
437
I normally do stuff like that like this:

JASS:
scope IceWall initializer Init
globals
    private constant integer SPELL_ID           = ...
    private constant integer WALL_UNIT_ID       = ...
    private constant integer WALLS              = 5
    private constant real    WALL_OFFSET        = 75.
    private constant real    WALL_BIRTH_OFFSET  = 500.
endglobals

private function onCast_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == SPELL_ID
endfunction

private function onCast takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local location loc = GetSpellTargetLoc()
    local real locX = GetLocationX(loc)
    local real locY = GetLocationY(loc)
    local real uX = GetUnitX(u)
    local real uY = GetUnitY(u)
    local real angle = Atan2(locY-uY,locX-uX)
    local real x = uX+WALL_BIRTH_OFFSET*Cos(angle)
    local real y = uY+WALL_BIRTH_OFFSET*Sin(angle)
    local real end = WALL_OFFSET*WALLS/2
    local real r = -end
    
    set angle = bj_PI/2-angle
    loop
        exitwhen r >= end
        call CreateUnit(Player(15),WALL_UNIT_ID,x+r*Cos(angle),y+r*Sin(-angle),angle*bj_RADTODEG)
        set r = r+WALL_OFFSET
    endloop
    call RemoveLocation(loc)
    set loc = null
    set u = null
endfunction

private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger()
    
    call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(trig,Condition(function onCast_Conditions))
    call TriggerAddAction(trig,function onCast)
endfunction
endscope
 

tuantai120

Cool Member
Reaction score
1
I normally to stuff like that like this:

JASS:
scope IceWall initializer Init
globals
    private constant integer SPELL_ID           = ...
    private constant integer WALL_UNIT_ID       = ...
    private constant integer WALLS              = 5
    private constant real    WALL_OFFSET        = 75.
    private constant real    WALL_BIRTH_OFFSET  = 500.
endglobals

private function onCast_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == SPELL_ID
endfunction

private function onCast takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local location loc = GetSpellTargetLoc()
    local real locX = GetLocationX(loc)
    local real locY = GetLocationY(loc)
    local real uX = GetUnitX(u)
    local real uY = GetUnitY(u)
    local real angle = Atan2(locY-uY,locX-uX)
    local real x = uX+WALL_BIRTH_OFFSET*Cos(angle)
    local real y = uY+WALL_BIRTH_OFFSET*Sin(angle)
    local real end = WALL_OFFSET*WALLS/2
    local real r = -end
    
    set angle = bj_PI/2-angle
    loop
        exitwhen r >= end
        call CreateUnit(Player(15),WALL_UNIT_ID,x+r*Cos(angle),y+r*Sin(-angle),angle*bj_RADTODEG)
        set r = r+WALL_OFFSET
    endloop
    call RemoveLocation(loc)
    set loc = null
    set u = null
endfunction

private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger()
    
    call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(trig,Condition(function onCast_Conditions))
    call TriggerAddAction(trig,function onCast)
endfunction
endscope

thanks very much :D:D:D
but why you dont use struct ??
 

_whelp

New Member
Reaction score
54
@The poster of this thread:
Can you be more descriptive, would the ice just block them?
Oh, and I thought it was against the forum rules to make that a thread name.
 
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