| 10-06-2006, 11:38 AM | #1 |
Rude Awakneing: Turns all trees in a radius of the caster into Ents for a brief period to fight for the caster. Ok, having difficulties with 'grouping' up the trees in a radius. I think so far ive got it to pick them. Now in GUI I just do kill 'picked' destructable, not sure can I do that in jass as well? (I only have 2 tree types in the map so used the following condition, is there a way to do if desctructable is a tree?) JASS:function Trig_rudeawakening_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A062' endfunction function rudeawakening_Conditions_group takes nothing returns boolean return (GetDestructableTypeId(GetFilterDestructable()) == 'CTtc' or GetDestructableTypeId(GetFilterDestructable()) == 'CTtr') endfunction function Trig_rudeawakening_Actions takes nothing returns nothing local unit caster = GetTriggerUnit() local real area local integer level = GetUnitAbilityLevel(caster,'A062') set area = 400 + (50 * level) call EnumDestructablesInCircleBJ( area, GetUnitLoc(caster), Condition (function rudeawakening_Conditions_group)) call KillDestructable(GetEnumDestructable()) call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), GetDestructableLoc(GetEnumDestructable()), bj_UNIT_FACING ) endfunction //=========================================================================== function InitTrig_rudeawakening takes nothing returns nothing set gg_trg_rudeawakening = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_rudeawakening, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddAction( gg_trg_rudeawakening, function Trig_rudeawakening_Actions ) call TriggerAddCondition( gg_trg_rudeawakening, Condition( function Trig_rudeawakening_Conditions ) ) endfunction It doesnt like the JASS:call KillDestructable(GetEnumDestructable()) thx for any help |
| 10-06-2006, 11:55 AM | #2 | |
Quote:
![]() |
| 10-06-2006, 12:27 PM | #3 |
It's a good practice to try and recreate default abilities. Err... Try this? JASS:constant function rudeawakening_abilid takes nothing returns integer return 'A062' endfunction constant function rudeawakening_buffid takes nothing returns integer return 'B000' endfunction constant function rudeawakening_duration takes integer level returns real return level * 10 + 30. endfunction constant function rudeawakening_area takes integer level returns real return level * 50 + 400. endfunction constant function rudeawakening_treestopwn takes nothing returns boolean return (GetDestructableTypeId(GetFilterDestructable()) == 'CTtc') or (GetDestructableTypeId(GetFilterDestructable()) == 'CTtr') // just add ---- or (GetDestructableTypeId(GetFilterDestructable()) == 'XXXX') --- if you want to add more trees to be converted. XXXX is doh, teh destructable 4-char id. endfunction function rudeawakening_cond takes nothing returns boolean return GetSpellAbilityId() == rudeawakening_abilid() endfunction function rudeawakening_wakeuptrees takes nothing returns nothing local integer c = 0 local integer level = GetUnitAbilityLevel(caster,rudeawakening_abilid()) if (rudeawakening_treestopwn()) then call KillDestructable(GetEnumDestructable()) set c = c + 1 call CreateUnit(Player(0), 'hfoo', GetDestructableX(GetEnumDestructable()), GetDestructableY(GetEnumDestructable()), bj_UNIT_FACING) call UnitApplyTimedLife(GetLastCreatedUnit(), rudeawakening_buffid(), rudeawakening_duration(level)) endif endfunction function rudeawakening takes nothing returns nothing local unit caster = GetTriggerUnit() local location targetloc = GetSpellTargetLoc() local integer level = GetUnitAbilityLevel(caster,rudeawakening_abilid()) local real area = rudeawakening_area(level) call EnumDestructablesInCircleBJ( area, targetloc, function rudeawakening_wakeuptrees) call RemoveLocation(targetloc) set caster = null set targetloc = null endfunction //=========================================================================== function InitTrig_rudeawakening takes nothing returns nothing set gg_trg_rudeawakening = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_rudeawakening, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddAction( gg_trg_rudeawakening, function rudeawakening ) call TriggerAddCondition( gg_trg_rudeawakening, Condition( function rudeawakening_cond ) ) endfunction Hopefully (for the 3rd edit time) this would do? The buffid could be any buff, just to make those silly Ents mortal. Hehe, isn't this a card from Magic: The Gathering? Anyway, as you can see, I used a JESP-like config for uber easy edit (out of habit lol). I also shortened the names to save some bytes and uhh.. that's all I guess. |
| 10-06-2006, 01:36 PM | #4 |
Alrighty, no. JASS:local integer level = GetUnitAbilityLevel(caster,rudeawakening_abilid()) Will not work, locals will not pass from function to function. K, so for this, I am *hoping* that when these ents run out of time(not by death, only by elapsed life-time) they turn back into trees. Just cause it would look super cool. To pass stuff to an enumeration of a group, you need to either globalize it it(in a global variable or in the gamecache). Can't pimp out any code atm, since warcraft is temporarily trashed on my computer, but come 6 hours from now, I'll have my fix again and can be done with this withdrawl(will also finish up the LaneOrder function and the Bounty stuff.) |
| 10-06-2006, 02:08 PM | #5 | |||
Quote:
I tried that initially, but force of nature, teleports the ents automatically to the center of the circle. Meaning If I made with triggers a Force Of nature cast over the caster, all ents would teleport from the tree locations around him. Making it look very 'crappy' and trapping / making movement difficult each time. Quote:
Yup I was working on an MTG AoS ages ago, I still have lots of card ideas transferred into spells written down. This was one of my favourites as it does pretty much exactly what the card does :D But also very practical/useful spell. Quote:
What global could I use? I assume a Destructable ARRAY, for each tree, then individually with a loop transform each one? |
| 10-06-2006, 02:47 PM | #6 |
Not for the trees, GetEnumDestructable() will do you for that. You need to globalize your caster so you know who to make them for. |
| 10-06-2006, 06:32 PM | #7 | ||
Quote:
Oh yeah that was such a stupid mistake -_- thanks for pointing that out. Fulla, you may attach the caster to the trigger JASS:call AttachObject(gg_trg_rudeawakening, "caster", caster) JASS:call GetAttachedUnit(gg_trg_rudeawakening, "caster") ...
|
| 10-06-2006, 08:28 PM | #8 |
Nope, I am helping him with DoD, only Tables. Change that to: call SetTableObject("[GlobalInfo]","Caster",cast) and local unit caster = GetTableUnit("[GlobalInfo]","Caster") |
| 10-06-2006, 11:03 PM | #9 |
I tried your way arpha_method, by replacing the bit with Chucks bit. came up JASS:return (GetDestructableTypeId(GetFilterDestructable()) == 'CTtc') or (GetDestructableTypeId(GetFilterDestructable()) == 'CTtr') Constant function is being called from a non constant function. |
| 10-07-2006, 08:12 AM | #10 |
Change JASS:constant function rudeawakening_treestopwn JASS:function rudeawakening_treestopwn |
| 10-07-2006, 09:16 AM | #11 |
ok, awesome it works now :-) 1 problem thou, the expiration timer doesnt apply to the Ents made instead it gets the last crated unit, which happens to be my hero. So he just dies after X seconds when casting spell hehe ------------------ Also Id like to further upgrade it by having a differnet Ent per level. To follow the JESP standard how could I do this? JASS:constant function rudeawakening_tree takes nothing returns unit return level1 unit ?? level 2 unit ?? endfunction thx |
| 10-07-2006, 09:44 AM | #12 |
Hmm ok I'll try to fix that. EDIT: After 3 tests, I think this should work now. JASS:constant function RudeAwakening_AbilId takes nothing returns integer return 'A062' endfunction constant function RudeAwakening_BuffId takes nothing returns integer return 'B000' endfunction constant function RudeAwakening_Duration takes integer level returns real return level * 10 + 30. endfunction constant function RudeAwakening_Area takes integer level returns real return level * 50 + 400. endfunction constant function RudeAwakening_EntType takes integer level returns integer if (level == 1) then return 'ent1' elseif (level == 2) then return 'ent2' elseif (level == 3) then return 'ent3' elseif (level == 4) return 'ent4' endif return 'ent1' // just add more elseifs if your rudeawakening has more than 4 levels. endfunction constant function RudeAwakening_TreesToPwn takes nothing returns boolean return (GetDestructableTypeId(GetFilterDestructable()) == 'CTtc') or (GetDestructableTypeId(GetFilterDestructable()) == 'CTtr') // just add ---- or (GetDestructableTypeId(GetFilterDestructable()) == 'XXXX') --- if you want to add more trees to be converted. XXXX is doh, teh destructable 4-char id. endfunction function RudeAwakening_Cond takes nothing returns boolean return GetSpellAbilityId() == RudeAwakening_AbilId() endfunction function RudeAwakening_WakeUpTrees takes nothing returns nothing local unit caster = GetTableUnit("[GlobalInfo]", "Caster") local integer level = GetUnitAbilityLevel(caster,RudeAwakening_AbilId()) if (RudeAwakening_TreesToPwn() and (GetDestructableLife(GetEnumDestructable()) > 0.405)) then call KillDestructable(GetEnumDestructable()) call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\NightElf\\ManaBurn\\ManaBurnTarget.mdl", GetDestructableX(GetEnumDestructable()), GetDestructableY(GetEnumDestructable()))) call UnitApplyTimedLife(CreateUnit(Player(0), RudeAwakening_EntType(level), GetDestructableX(GetEnumDestructable()), GetDestructableY(GetEnumDestructable()), bj_UNIT_FACING), RudeAwakening_BuffId(), RudeAwakening_Duration(level)) endif set caster = null endfunction function RudeAwakening takes nothing returns nothing local unit caster = GetTriggerUnit() local location targetloc = GetSpellTargetLoc() local integer level = GetUnitAbilityLevel(caster,RudeAwakening_AbilId()) local real area = RudeAwakening_Area(level) call SetTableObject("[GlobalInfo]", "Caster", caster) call EnumDestructablesInCircleBJ(area, targetloc, function RudeAwakening_WakeUpTrees) call RemoveLocation(targetloc) set caster = null set targetloc = null endfunction //=========================================================================== function InitTrig_RudeAwakening takes nothing returns nothing set gg_trg_RudeAwakening = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_RudeAwakening, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddAction( gg_trg_RudeAwakening, function RudeAwakening ) call TriggerAddCondition( gg_trg_RudeAwakening, Condition( function RudeAwakening_Cond ) ) endfunction Another bug fix: The one I made last time will turn _DEAD_ trees into Ents, so, there, fixed that. Thanks to blu_da_noob for his post (a unit dies when hp is equal or less than 0.405). Although I'm not quite sure if he's the one who said that lol (I can't seem to find it argh -- oh yes found it: http://www.wc3campaigns.net/showpost...&postcount=17). And please rename your trigger from rudeawakening to RudeAwakening. XD |
| 10-07-2006, 12:47 PM | #13 |
Yup works fine now :-) thx for help |
| 10-07-2006, 04:42 PM | #14 |
No problem, happy to help :) |
