HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Modal Energy Drain + Effect

09-07-2005, 06:00 PM#1
Elven Ronin
Trying to develop two abilities that function in a fashion similar to immolation. Turn them on, they start draining energy and do a triggered effect (one gives a unit hardened skin, the other gives it the ghost ability). Turn them off, the effect stops.

I tried using the orderstrings, but then I realized that when it automatically shuts off because a unit ran out of energy, it doesn't actually give it an order.

I'd prefer to avoid triggering it heavily because it would involve working for up to 9 units at once per effect.

I know something similar is possible, because i've seen it in SWAT: aftermath.

Any ideas?
09-08-2005, 07:09 AM#2
Anitarf
Maybe the cast event happens when the spell is turned off due to mana loss, tried that? You cold also trigger it with a buff comparison on a periodic event.
09-08-2005, 05:29 PM#3
Elven Ronin
Quote:
Originally Posted by Anitarf
Maybe the cast event happens when the spell is turned off due to mana loss, tried that? You cold also trigger it with a buff comparison on a periodic event.

I'll try the casting bit. or see if for some reason the order issued isn't a untargetted one. I'll save the perdiodic trigger for a last resort.
09-08-2005, 08:44 PM#4
Panto
I did something very similar for a mana-draining slow aura. Let me find my triggers...

Ooops, sorry, I don't have them in GUI anymore. Here's the jass, however.

This adds the aura when it's activated.
Quote:
//======================
// Functi0ns
//======================
function Trig_Mummification_start_Actions takes nothing returns nothing
//== Loc4ls ============
local unit unitPharaoh = GetOrderedUnit()

//== Ac7ions ===========
if ((GetUnitTypeId(unitPharaoh) == 'Udea') and (GetIssuedOrderIdBJ() == String2OrderIdBJ("immolation"))) then
call UnitAddAbilityBJ('A02P', unitPharaoh)
call SetUnitAbilityLevelSwapped('A02P', unitPharaoh, GetUnitAbilityLevelSwapped('ACim', unitPharaoh))
endif

//== Cl3anup ===========
set unitPharaoh = null
endfunction

//======================
// Event5
//======================
function InitTrig_Mummification_start takes nothing returns nothing
set gg_trg_Mummification_start = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Mummification_start, EVENT_PLAYER_UNIT_ISSUED_ORDER)
call TriggerAddAction(gg_trg_Mummification_start, function Trig_Mummification_start_Actions)
endfunction

This removes it when it's deactivated.
Quote:
//======================
// Functi0ns
//======================
function Trig_Mummification_stop_Actions takes nothing returns nothing
//== Loc4ls ============
local unit unitPharaoh = GetOrderedUnit()

//== Ac7ions ===========
if ((GetUnitTypeId(unitPharaoh) == 'Udea') and (GetIssuedOrderIdBJ() == String2OrderIdBJ("unimmolation"))) then
call UnitRemoveAbilityBJ('A02P', unitPharaoh)
endif

//== Cl3anup ===========
set unitPharaoh = null
endfunction

//======================
// Event5
//======================
function InitTrig_Mummification_stop takes nothing returns nothing
set gg_trg_Mummification_stop = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Mummification_stop, EVENT_PLAYER_UNIT_ISSUED_ORDER)
call TriggerAddAction(gg_trg_Mummification_stop, function Trig_Mummification_stop_Actions)
endfunction

This adds the event to the next trigger to turn it off when mana runs out.
Quote:
//======================
// Functi0ns
//======================
function Trig_Mummification_event_Actions takes nothing returns nothing
//== Loc4ls ============
local unit unitPharaoh = GetLearningUnit()

//== Ac7ions ===========
if ((GetLearnedSkillBJ() == 'ACim') and (GetUnitAbilityLevelSwapped('ACim', unitPharaoh) == 1)) then
call TriggerRegisterUnitManaEvent(gg_trg_Mummification_mana, unitPharaoh, LESS_THAN, 3.00)
endif

//== Cl3anup ===========
set unitPharaoh = null
endfunction

//======================
// Event5
//======================
function InitTrig_Mummification_event takes nothing returns nothing
set gg_trg_Mummification_event = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Mummification_event, EVENT_PLAYER_HERO_SKILL)
call TriggerAddAction(gg_trg_Mummification_event, function Trig_Mummification_event_Actions)
endfunction

And this one actually does it.
Quote:
//======================
// Functi0ns
//======================
function Trig_Mummification_mana_Actions takes nothing returns nothing
//== Ac7ions ===========
call UnitRemoveAbilityBJ('A02P', GetTriggerUnit())
endfunction

//======================
// Event5
//======================
function InitTrig_Mummification_mana takes nothing returns nothing
set gg_trg_Mummification_mana = CreateTrigger()
call TriggerAddAction(gg_trg_Mummification_mana, function Trig_Mummification_mana_Actions)
endfunction

And this one does everything else.
Quote:
Your mom.

I've never had any problems with this system whatsoever. It's worked since I wrote it with no known glitches.
09-09-2005, 10:31 PM#5
Elven Ronin
I knew never learning jass was going to come up and bite me on the ass one of these days...
09-10-2005, 06:33 AM#6
Panto
It's really not too hard. If you just convert some of your gui trigs to jass and look at 'em, you'll get a sense for generally how the code works. Do you know any programming languages?

P.S. I don't, unless Jass and the C++esque NWN script count.
09-11-2005, 05:20 PM#7
Elven Ronin
Quote:
Originally Posted by Panto
It's really not too hard. If you just convert some of your gui trigs to jass and look at 'em, you'll get a sense for generally how the code works. Do you know any programming languages?

P.S. I don't, unless Jass and the C++esque NWN script count.

The only programming language I've used is basic, which I admit did help get a hang of some of the stuff I didn't have a clue how to use before in world editor.

How do you convert gui to jass?
09-11-2005, 06:18 PM#8
Tim.
Quote:
Originally Posted by World Editor (Edit Menu)
Convert to Custom Text
09-11-2005, 06:53 PM#9
Elven Ronin
Alright, I'll try that out and see how much it helps.
09-12-2005, 06:23 AM#10
Anitarf
Hey, I was thinking about remaining a GUI expert until the end of my days just a few months ago as well, and look at me now, already making most of my triggers in JASS. My previous programming experience consisted of only basic as well. I encourage you to learn it.