Warcraft III resources & community, 2003–2006 · archived

Spell Help(JASS)

19 posts
#1

Spell Help(JASS)

Ok im learning JASS and know the basics, but I ran into a problem with the spell I was making:
Inferno: The hero draws in nearby fire energy in a spiral, then unleashes it in 12 straight lines of pure flame. The lines of fire then start spinning around the hero, and the force of them is so strong that units caught up in the fire are pushed around the fiery circle.

The first spiral part works but when i got to the part where it creates 8 straight lines of fire it doesnt work, and ive tried everything.
#2
Hmm it works if i dont add the units to a unit group, I'll try a unit array instead.

Ok i've got the 12 lines of fire to spin around the circle, but I have no clue how to do the unit spins. What i was going to do was give the fie lines a dummy immolation and then pick the units by buff and spin them, i noticed that if you pick all units in a group, it creates 3 seperate functions. Is there anyway to do it one, or will I have to create a seperate trigger? Heres the entire code if anyones interested:
function Trig_Fire_Ultimate_Start_Actions takes nothing returns nothing
    local integer count
    local unit caster
    local location point
    local unit array x
    local integer countII
    local trigger stop
    local unit burn
    set stop = CreateTrigger()
    set caster = GetTriggerUnit()
    call TriggerRegisterUnitEvent(stop,caster,EVENT_UNIT_SPELL_ENDCAST)
    set point = GetUnitLoc(caster)
    call SetUnitAnimation( caster, "spell channel" )
    set count = 1
    set countII = 1
    loop
        exitwhen count > 12
        loop
            exitwhen countII > 8
            call CreateNUnitsAtLoc( 1, 'e000', GetOwningPlayer(caster), PolarProjectionBJ(point, ( ( I2R(count) * -50.00 ) + 650.00 ), ( ( I2R(countII) * 45.00 ) + ( I2R(count) * 15.00 ) )), bj_UNIT_FACING )
            set countII = countII + 1
        endloop
        set countII = 1
        call TriggerSleepAction( 0.01 )
        set count = count + 1
    endloop
    call SetUnitAnimation( caster, "spell" )
    call PlaySoundAtPointBJ( gg_snd_BreathOfFire1, 100, point, 0 )
    set count = 1
    loop
        exitwhen count > 12
        call CreateNUnitsAtLoc( 1, 'e001', GetOwningPlayer(caster), PolarProjectionBJ(point, ( I2R(count) * 50.00 ),30.00), 30.00 )
        set x[count] = GetLastCreatedUnit()
        call CreateNUnitsAtLoc( 1, 'e001', GetOwningPlayer(caster), PolarProjectionBJ(point, ( I2R(count) * 50.00 ),60.00), 60.00 )
        set x[(count + 12)] = GetLastCreatedUnit()
        call CreateNUnitsAtLoc( 1, 'e001', GetOwningPlayer(caster), PolarProjectionBJ(point, ( I2R(count) * 50.00 ),90.00), bj_UNIT_FACING )
        set x[(count + 24)] = GetLastCreatedUnit()
        call CreateNUnitsAtLoc( 1, 'e001', GetOwningPlayer(caster), PolarProjectionBJ(point, ( I2R(count) * 50.00 ),120.00), bj_UNIT_FACING )
        set x[(count + 36)] = GetLastCreatedUnit()
        call CreateNUnitsAtLoc( 1, 'e001', GetOwningPlayer(caster), PolarProjectionBJ(point, ( I2R(count) * 50.00 ),150.00), bj_UNIT_FACING )
        set x[(count + 48)] = GetLastCreatedUnit()
        call CreateNUnitsAtLoc( 1, 'e001', GetOwningPlayer(caster), PolarProjectionBJ(point, ( I2R(count) * 50.00 ),180.00), bj_UNIT_FACING )
        set x[(count + 60)] = GetLastCreatedUnit()
        call CreateNUnitsAtLoc( 1, 'e001', GetOwningPlayer(caster), PolarProjectionBJ(point, ( I2R(count) * 50.00 ),210.00), bj_UNIT_FACING )
        set x[(count + 72)] = GetLastCreatedUnit()
        call CreateNUnitsAtLoc( 1, 'e001', GetOwningPlayer(caster), PolarProjectionBJ(point, ( I2R(count) * 50.00 ),240.00), bj_UNIT_FACING )
        set x[(count + 84)] = GetLastCreatedUnit()
        call CreateNUnitsAtLoc( 1, 'e001', GetOwningPlayer(caster), PolarProjectionBJ(point, ( I2R(count) * 50.00 ),270.00), bj_UNIT_FACING )
        set x[(count + 96)] = GetLastCreatedUnit()
        call CreateNUnitsAtLoc( 1, 'e001', GetOwningPlayer(caster), PolarProjectionBJ(point, ( I2R(count) * 50.00 ),300.00), bj_UNIT_FACING )
        set x[(count + 108)] = GetLastCreatedUnit()
        call CreateNUnitsAtLoc( 1, 'e001', GetOwningPlayer(caster), PolarProjectionBJ(point, ( I2R(count) * 50.00 ),330.00), bj_UNIT_FACING )
        set x[(count + 120)] = GetLastCreatedUnit()
        call CreateNUnitsAtLoc( 1, 'e001', GetOwningPlayer(caster), PolarProjectionBJ(point, ( I2R(count) * 50.00 ),360.00), bj_UNIT_FACING )
        set x[(count + 132)] = GetLastCreatedUnit()
        call TriggerSleepAction( 0.01 )
        set count = count + 1
    endloop
    call SetUnitAnimation( caster, "spell channel" )
    call CreateNUnitsAtLoc( 1, 'e002', GetOwningPlayer(GetTriggerUnit()), point, bj_UNIT_FACING )
    set burn = GetLastCreatedUnit()
    loop
        exitwhen GetTriggerEvalCount(stop)>0
        set count=1
        loop
            exitwhen count > 144
            call SetUnitPositionLoc( x[count], PolarProjectionBJ(point, DistanceBetweenPoints(GetUnitLoc(x[count]),point), ( AngleBetweenPoints(GetUnitLoc(x[count]), point) - 10.00 )) )
            set count=count+1
        endloop
    call TriggerSleepAction(0.01)
    endloop
    set count=1
    call RemoveUnit (burn)
    loop
        exitwhen count > 144
        call RemoveUnit (x[count])
        set count=count + 1
    endloop
    set caster = null
    set burn = null
    set point = null
   
endfunction

Hmm it doesnt seem to want to work. Hopefully you can make sense of that last little jumbled up bit.
#3
There is a forum for jass why dont you check there?
#4
Well... I MIGHT be able to help but... Dr.Nitro said that he solved the problem. And yeah, he can try into the JASS forum as well.
#5
Well I posted here because its for a spell, and the JASS forums is mainly just for new functions and things. So any ideas on how I can do that?
#6
My thought is at Game Caches... Multiple functions which share the same unit group or something like that... The last part of the script is screwed up. Can you fix it?
#7
I know nothing about game caches, how do they work? Not thats it neccisary, because I got it to work with two seperate triggers. Thanks anyways though. I tried fixing last part but it didnt work, must be an error in Darky's script or something. Ill post the spell once im done the others in a demo spell pack.

Well im stuck on the next spell :cry: . What happens is the hero splits up into 4 shadow images which bombard an area with mana, and the hero recieves 10 mana for every unit hit. The problem im having is the hero doesnt recieve any mana. Heres the second part of the code, the part where the hero recieves mana:

function Trig_Mana_Drain_Conditions takes nothing returns boolean 
if ( not ( GetSpellAbilityId() == 'A002' ) ) then 
return false 
endif 
return true 
endfunction 

function Trig_Mana_Drain_Check takes nothing returns boolean 
return ( IsPlayerEnemy(GetTriggerPlayer(), GetOwningPlayer(GetFilterUnit())) == true ) 
endfunction 

function Trig_Mana_Drain takes nothing returns nothing 
local location point 
local unit caster 
local group managroup 

set caster = GetTriggerUnit() 
set point = GetUnitLoc (caster) 

call GroupClear( managroup ) 
call GroupAddUnitSimple( GetEnumUnit(), managroup ) 
call SetUnitManaBJ( caster, ( I2R(CountUnitsInGroup(managroup)) * 10.00 ) ) 
endfunction 

function Trig_Mana_Drain_Actions takes nothing returns nothing 
local location point 
local trigger stop 
local unit caster 
local integer x 

set stop = CreateTrigger() 
set caster = GetTriggerUnit() 
set point = GetUnitLoc (caster) 
call TriggerSleepAction ( 2.00 ) 

set x = 1 
loop 
exitwhen x > 10 
call ForGroupBJ( GetUnitsInRectMatching(RectFromCenterSizeBJ(point, 900.00, 900.00), Condition(function Trig_Mana_Drain_Check)), function Trig_Mana_Drain ) 
set x = x+1 
call TriggerSleepAction(1.00) 
endloop 
endfunction 


//=========================================================================== 
function InitTrig_Mana_Strike_Drain takes nothing returns nothing 
set gg_trg_Mana_Strike_Drain = CreateTrigger( ) 
call TriggerRegisterAnyUnitEventBJ( gg_trg_Mana_Strike_Drain, EVENT_PLAYER_UNIT_SPELL_CAST ) 
call TriggerAddCondition( gg_trg_Mana_Strike_Drain, Condition( function Trig_Mana_Drain_Conditions ) ) 
call TriggerAddAction( gg_trg_Mana_Strike_Drain, function Trig_Mana_Drain_Actions ) 
endfunction
#8
IsPlayerEnemy(GetTriggerPlayer()


Should be

IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit())


---
local group managroup
[/quote]

make a global group instead, udg_managroup. Then, do like this,


//put this before the ForGroup action where you pick the group and do actions etc.,
set udg_managroup = CreateGroup()
....
//in the ManaDrain function, call this
 call GroupAddUnitSimple(GetEnumUnit(),udg_managroup)
....
//after the ForGroup action,
call DestroyGroup(udg_managroup)
#9
Hmm but will it still be multi-instance? I acctualy tried a different approach by using gamecaches and giving the hero the mana after the spell finishes. Since i dont know a thing about them, I copied the ones from your OmniDrain, but there were errors and itjust wouldnt work. Heres the code:

function GameCache2Trigger takes gamecache g returns trigger
    return g
    return null
endfunction

function I2T takes integer t returns trigger
    return t
    return null
endfunction

function I2G takes integer g returns group
    return g
    return null
endfunction

function GetMultiDrainGameCache takes nothing returns gamecache
    return gg_trg_Mana_Strike_Drain
    return null
endfunction

function Trig_Mana_Drain_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A002' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Mana_Drain_Check takes nothing returns boolean
    return ( IsPlayerEnemy(GetTriggerPlayer(), GetOwningPlayer(GetFilterUnit())) == true )
endfunction

function Trig_Mana_Drain takes nothing returns nothing
    local gamecache g    = GetMultiDrainGameCache()
    local group managroup = I2G(GetStoredInteger(g, "managroup", I2S(H2I(GetTriggeringTrigger()))))

    call GroupAddUnitSimple( GetEnumUnit(), managroup )
endfunction

function Trig_Mana_Drain_Actions takes nothing returns nothing
    local gamecache g = GetMana_Strike_DrainGameCache()
    local location point
    local trigger stop
    local unit caster
    local group managroup
    local trigger t = CreateTrigger()
    local integer x

    set stop = CreateTrigger()
    set caster = GetTriggerUnit()
    set point = GetUnitLoc (caster)
    call StoreIntegerBJ( H2I(managroup), I2S(H2I(t)), "dummycasters", g )
    call TriggerSleepAction ( 2.00 )

    set x = 1
    loop
        exitwhen x > 10
        call ForGroupBJ( GetUnitsInRectMatching(RectFromCenterSizeBJ(point, 600.00, 600.00), Condition(function Trig_Mana_Drain_Check)), function Trig_Mana_Drain )
        set x = x+1
        call TriggerSleepAction(1.00)
    endloop

    call SetUnitManaBJ( caster, ( GetUnitStateSwap(UNIT_STATE_MANA, caster) + ( I2R(CountUnitsInGroup(managroup)) + ( 5.00 * I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(), caster)) ) ) ) )
    call FlushStoredInteger(g,"managroup", I2S(H2I(t)))

endfunction
    

//===========================================================================
function InitTrig_Mana_Strike_Drain takes nothing returns nothing
    set gg_trg_Mana_Strike_Drain = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Mana_Strike_Drain, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Mana_Strike_Drain, Condition( function Trig_Mana_Drain_Conditions ) )
    call TriggerAddAction( gg_trg_Mana_Strike_Drain, function Trig_Mana_Drain_Actions )
endfunction
#10
I don't think it will be multi-instance... Hmm... I'm a noob in JASS and so, I know only how to do my own skills. Sorry...
#11
It should be:


IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit())

and

local group managroup = CreateGroup()


Since what you did was to add units to a group that was never created.

Hope this helps.

Also, using globals do not always mean non multi instance. It depends on the situation, and what I suggested earlier would still make it multi-instance.
#12
Daelin is now good enough at gamecaches 8)!

Edit:I teached him
#13
Yeah thanks for the shield spell you just submitted(cant rememebr name :P), i think i understand game caches now.
#14
Hi everyone, again.

I am pretty sure this is off section, but anyway:

2 months ago I started on a special mapping project, Aeon of Magic, about the apocalyptic battle between magical creatures from the four dimensional planes: Chaos, Light, Dark and Nature.

To survive the incoming destruction of the world, all beings must obtain a large enough amount of energies from the Earth's Magic Core to form a protective barrier.

However.. this resource is limited, and so, the last and greatest battle in history begins, to escape extinction.

----

Aeon of Magic has a unique concept of Unit, Hero, Ability, and Warfare.

-The Unit:
+Every unit belongs to one Alignment, or Class: Chaos, Light, Dark, Nature, or Unclassified.
+Every unit is specified by it's aspects: Water (water elemental), Fire (lava spawn), Elemental, Mechanical, Undead, Demon, etc.
+Every unit has vulnerabilities, and resistances.
+Every unit is magically potential, it has at least one active ability.
* All of the above are dynamically implemented, some of which will be described below.

-The Hero: all Heroes have the same basic properties as a unit. But there are a lot more:
+Every Hero has one major ability, and one Ultimate ability. All Hero abilities are unique.
+Every Hero has the capability to learn abilities, transform abilities, combine 2 abilities into one. There are schools of magic allowing the learning of nearly limitless number of abilities, most of which are unique and thoughfully made.
+Every Hero has a Specialty. Specialty is not considered ability, but, a unique new feature in AoM. For example: The Planeswalker leaves fiery footprints wherever he walks, each footprint gives him a small vision at the place. The Elementalist's summon spells have greater effects. The Holy Knight has a 15% resistance to Dark Class spells.
+Restrictions: some Heroes can not learn certain spells, can not use certain items.

-The Abilities:
+Unlike normal spells, AoM spells generally have different effects on different Classes, or creature types. They are divided into 5 areas: Chaos, Light, Dark, Nature, and Unclassified.
+For example, True Lightning, a Light spell, deals less damage to any unit of the Light Class, and more damage to any unit of the Dark Class. Vampiric Aura, a Dark Spell, does NOT work on Undead units but has a 50% increased effect on Nature Class units.
+All of the abilities are multi-instance.
+If you know the item combination in DotA, I hereby gives you the first ever ability combination system.

-The Warfare: chaotic, immense with a lot of actions and strategies. The vast number of units/spells make AoM have no upper limit. I am still developing gameplay.

----

The great amount of trigger work is pretty big for one person. I was hoping to finish the project by the middle of this month, but I got a 3 week business making it impossible. If any of you are good at spell making/triggering (I know you are!) and are willing to help me in any of the map's aspects, I will really appreciate it and you will be greatly credited. The work will be fun and challenging I promise!

For further discussion, you can either comment down here or send an email to [email protected].
#15
so,why didn't you posted it in the Discussion Forum?The story is deliateful!I may join ja finish it!