• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Life Drain casting help

Status
Not open for further replies.
Level 6
Joined
Mar 20, 2008
Messages
208
The basic Idea. Hero summons a sacrificial pit. Trigger made will catch the summon, and create X amount of dummy units, those dummy units will cast life drain onto the enemy.

I got up to the life drain casting part, it just doesn't seem to work. Its using the nuetral hostile unit ability life drain.

The dummy units I have were set to nuetral hostile, and wouldn't attack.
I've set the proper acquisiton range, and range of the spell.

Right now I'm picking units within the local location and im trying to force the spel lto be cast on them. The order - use/turn on string is currently "parasite"

they have the mana and proper ability level, I've tested them by making them under my own control and they can cast it fine manually.

Thier attacks are enabled, and if I give them an attack value, they will just go melee the nearby unit.

Here is the script.

JASS:
function PLC takes nothing returns boolean
    return GetUnitTypeId(GetSummonedUnit()) == 'usap'
endfunction

function PLA takes nothing returns nothing
     local unit u = GetSummoningUnit()    
     local unit z = GetSummonedUnit()
     local real x = GetUnitX(z)
     local real y = GetUnitY(z)
     local integer i = GetUnitAbilityLevel(u, 'A01O')
     local real d = i+5
     local integer c = i
     local location l =  GetUnitLoc(z)
     local group g = GetUnitsInRangeOfLocAll(1000.00, l)

     call UnitApplyTimedLife(z, 'BTLF', d)

     loop
         exitwhen c == 0
            set z = CreateUnit(Player(12), 'nanm', x, y, 0)
            call SetUnitVertexColor(z, 0, 0, 0, 0)
            call SetUnitAbilityLevel(z,'ACdr',i)
            call UnitApplyTimedLife(z, 'BTLF', d)
            call SetUnitState(z, UNIT_STATE_LIFE, 10)
            call IssueTargetOrder(z, "parasite", GroupPickRandomUnit(g))
            set c = c-1 
     endloop

     call RemoveLocation(l)
     call DestroyGroup(g)
  
     set g = null
     set l = null
     set z = null
     set u = null
endfunction

//===========================================================================
function InitTrig_PL_Sac takes nothing returns nothing
    set gg_trg_PL_Sac = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_PL_Sac, EVENT_PLAYER_UNIT_SUMMON )
    call TriggerAddCondition( gg_trg_PL_Sac, Condition( function PLC ) )
    call TriggerAddAction( gg_trg_PL_Sac, function PLA )
endfunction

Any help and/or suggestions are appreciated
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
To test: make dummy units visible and remove locust and remove TimedLife applying and try to make one cast the spell on enemy
 
Level 6
Joined
Mar 20, 2008
Messages
208
JASS:
 call IssueTargetOrder(z, "parasite", GroupPickRandomUnit(g))

Are they casting it on themselves?

Well, "self" isn't in the target allowables, but I imagine that would be a problem. Thanks for catching that.

However, its pick random unit, I would imagine after testing it over 10 times atleast one of them would hit the group i tossed them in the middle of.


Shyhalu, why are you even trying to change to order id? It's NOT possible to change it (ok, the spells channel and spellbook are an exception) and you have to use "siphonlife" (was it "siphonlife"? dunno, but you have to use the original id)

There was no original order/use ID in the spot. Using a differnet orderID should not matter as long as I tell them the correct orderID. The WE allows you to change the orderIDs with the object editor.

There is also no siphonlife id or anything that looks similiar.
But from what I understand about orderIDs is that they are just strings passed along to whatever unit manage blizzard built that makes them check for the ability thats tagged with that orderID.

To test: make dummy units visible and remove locust and remove TimedLife applying and try to make one cast the spell on enemy

The dummy units don't have locust.
I've tested them with visibility, they have the ability to cast the spell, they simply won't do it, not even under nuetral hostile AI or an enemy player AI. Which makes no sense to me because I have other units using abilities with that ingame prebuilt AI from blizz.

I have used the timedlife to cleanup units in other abilities, and they still cast their spells, but i'll try it anyway.

I'm thinking I screwed up somewhere with the object editor and not the jass, but I don't know what information other than what I already provided is relevant.
 
Level 13
Joined
Mar 16, 2008
Messages
941
No, the WE doesn't allow you to change it. Oh yes, for sure you can do it, but is has no effect! It's the "Text - Order String - Use/Turn on"... the only way to change it is a field called "Level X - Data - Base Order ID", and only channel/spellbook have this field, believe me.
But you're right with the other thingy, there is no id for siphon life oO why?
 
Level 6
Joined
Mar 20, 2008
Messages
208
I see....So it just changes the orderID that gets fired when the ability is used and not the ability's ID itself. Yay Blizzard.

I've found "drain" under the WE's built in orders, I'll try that instead. Thanks.
 
Level 4
Joined
Dec 10, 2005
Messages
73
Well, "self" isn't in the target allowables, but I imagine that would be a problem. Thanks for catching that.

However, its pick random unit, I would imagine after testing it over 10 times atleast one of them would hit the group i tossed them in the middle of.

After 10 test with the fixed random? :p

You should add a "call displaytext" to see if the trigger actually is set off or not.
 
Level 6
Joined
Mar 20, 2008
Messages
208
After 10 test with the fixed random? :p

You should add a "call displaytext" to see if the trigger actually is set off or not.

Its not a fixed random, each dummy unit created will pick a differnet random unit, provided theres more than one unit in the area.

I don't need the call display text, the dummy units showing up and etc is proof enough.

Anyway, it works iwth "drain" as the orderID. Still needs a little bit more polishing. Its based off the spirit beast summon spell.



JASS:
function PLC takes nothing returns boolean
    return GetUnitTypeId(GetSummonedUnit()) == 'usap'
endfunction

function TK takes nothing returns boolean
    return GetOwningPlayer(GetEnumUnit()) != Player(12)
endfunction

function PLA takes nothing returns nothing
     local unit z = GetSummonedUnit()
     local real x = GetUnitX(z)
     local real y = GetUnitY(z)
     local integer i = GetUnitAbilityLevel(GetSummoningUnit(), 'A01O')
     local real d = i+5
     local integer c = i
     local location l =  GetUnitLoc(z)
     local boolexpr f = Condition(function TK)
     local group g
   
     call TerrainDeformCrater(x, y, 800, 25, 7000, true)
     call TriggerSleepAction(7)
     call SetUnitAnimation(z,"stand")
     call UnitApplyTimedLife(z, 'BTLF', d)

     set g = GetUnitsInRangeOfLocMatching(900.00, l, f)

     loop
         exitwhen c == 0
            set z = CreateUnit(Player(12), 'nanm', x+GetRandomReal(-50,50), y+GetRandomReal(-50,50), GetRandomReal(0, 360))
            call SetUnitAnimation(z,"birth")
            call SetUnitAbilityLevel(z,'ACdr',i)
            call UnitApplyTimedLife(z, 'BTLF', d)           
            call IssueTargetOrder(z, "drain", GroupPickRandomUnit(g))
            set c = c-1 
     endloop

     call RemoveLocation(l)
     call DestroyGroup(g)
  
     set f = null
     set g = null
     set l = null
     set z = null
endfunction

//===========================================================================
function InitTrig_PL_Sac takes nothing returns nothing
    set gg_trg_PL_Sac = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_PL_Sac, EVENT_PLAYER_UNIT_SUMMON )
    call TriggerAddCondition( gg_trg_PL_Sac, Condition( function PLC ) )
    call TriggerAddAction( gg_trg_PL_Sac, function PLA )
endfunction

It summons a sacrifical pit, then summons tentacles in the middle of the pit, which then use life drain on enemies.
 
Level 4
Joined
Dec 10, 2005
Messages
73
for this line,

JASS:
call IssueTargetOrder(z, "drain", GroupPickRandomUnit(g))

I would do this

JASS:
set w = GroupPickRandomUnit(g)
call IssueTargetOrder(z, "drain", w)
call GroupRemoveUnit( g , w)

removes the chance of that unit getting picked again.

Other than that, it's seem ok to me.
 
Level 6
Joined
Mar 20, 2008
Messages
208
for this line,

JASS:
call IssueTargetOrder(z, "drain", GroupPickRandomUnit(g))

I would do this

JASS:
set w = GroupPickRandomUnit(g)
call IssueTargetOrder(z, "drain", w)
call GroupRemoveUnit( g , w)

removes the chance of that unit getting picked again.

Other than that, it's seem ok to me.

Well I wouldn't....mostly because it spawns more than one tentacle after level 1.

If theres one unit in the spot, removing him would only make him targeted by one tentacle, with the rest of the dummies doing nothing.
 
Level 4
Joined
Dec 10, 2005
Messages
73
Ahh, thought you wanted one unit to drain only one unit.
This can be fixed. But before I tell you, I think you would have more fun trying to solve it yourself. :p

Some question for you since I don't know what your intentions are.
What are the chances of having all the unit draining one unit?
Is that a good thing or bad thing?
What if that pick unit is killed before the spawned tentacles expires?
What if the units run out of range and come back in?
Would it be better to have all unit in the region drained of some hp?
What if pick unit had magical immunity or some other blocking spell?

Have fun!
 
Level 6
Joined
Mar 20, 2008
Messages
208
Ahh, thought you wanted one unit to drain only one unit.
This can be fixed. But before I tell you, I think you would have more fun trying to solve it yourself. :p

Theres nothing to fix, everything works out nice with the exception of the tentacles not continiously using the attack animation.....but at the moment I couldn't care less because I got other things to finish building and I can polish it up later.

Its done, it works, I appreciate you catching the problem with it selecting itself, but I don't need anymore help.

Some question for you since I don't know what your intentions are.
What are the chances of having all the unit draining one unit?
Is that a good thing or bad thing?
What if that pick unit is killed before the spawned tentacles expires?
What if the units run out of range and come back in?
Would it be better to have all unit in the region drained of some hp?
What if pick unit had magical immunity or some other blocking spell?
Have fun!

I'll answer these for the sake of anyone who may happen to cross the thread.

The spell summons a sacrificial pit, then places several FLOATING (height 25) tentacles in the middle of it, who then randomly picks a unit nearby and drains its life.

For each level of the ability, 1 extra tentacle will spawn, and the overall summon only lasts 5+ability level seconds IRRC.

1. All the units WILL drain one unit if only one unit is in the area. Picking from a randomgroup of 1 without removing the unit will result in that same unit picked multiple times. Sucks for that unit, but its well within intention of the spell.

2. The range of the spell is 900, while a unit may be skirting on the edge of it, once broken the tentacle will simply wait there. Bad? Yes, easily solvable? Probably. But right now the spell simply doesn't last long enough to bother with that probability. Its nuetral hostile, so it will even start attacking the spell caster. I don't have any faith in the nuetral hostile AI to cast the spell again, but again its more trouble that its worth to polish it.

3. No, that was the original intention, but I find this to be a much cooler effect. Also taking into consideration the amount of units possible in one area as armies in my map grow over time, it would probably lag a bit with all the dummies and cleanup.

4. Then it won't cast and will stand there, Repicking units is something I should work into it in the future, as none of my races or heros have magic immunity, not yet atleast. I'm sure just adding an ability check for magic immunity should suffice.

On a side note, The map I'm building this for has heros with permadeath and have regular armor/attack, so their life expectancy is pretty short and allows me some good amount of leniency with the spell polishing.
 
Status
Not open for further replies.
Top