| 03-11-2007, 03:10 PM | #1 |
I just downloaded one of tinki3's spell packs from thehelper.net, it contains the timed bomb spell, I imported everything like it said but it just won't work. Can someone help? |
| 03-11-2007, 04:39 PM | #2 |
Do you get any compile error messages when you save the map? If so, copy / past them into here with your code. If you don't get any compile errors but the ability doesn't work, make sure you configured the ability correctly when you copy / pasted it into your map. Abilities like that have to have minor things corrected in the code when you copy / paste it into your map (Ability codes have to be changed, etc. etc.). |
| 03-11-2007, 09:22 PM | #3 |
JASS:function Timed_Bomb_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A002' endfunction function Kill_Trees takes nothing returns nothing call KillDestructable(GetEnumDestructable()) endfunction function Timed_Bomb_Actions takes nothing returns nothing local unit m = GetTriggerUnit() local unit y = GetSpellTargetUnit() local texttag x local location b local integer Bomb_Duration = 12-(GetUnitAbilityLevelSwapped('A002', m)*2) //How much time to wait before the boom local effect e call AddSpecialEffectTargetUnitBJ("overhead", y, "Abilities\\Weapons\\GyroCopter\\GyroCopterMissile.mdl") set e = GetLastCreatedEffectBJ() loop exitwhen Bomb_Duration == 0 if IsUnitAliveBJ(y) == false then //If unit y is not alive, then the loop stops call DestroyEffectBJ(e) else call CreateTextTagUnitBJ(I2S(Bomb_Duration), y, 0, 9.00, 100, 0.00, 0.00, 0.00) set x = GetLastCreatedTextTag() call SetTextTagVelocityBJ(x, 80.00, 90) call SetTextTagPermanentBJ(x, false) call SetTextTagFadepointBJ(x, 1.75) call SetTextTagLifespanBJ(x, 3.25) call PlaySoundBJ(gg_snd_BattleNetTick) call TriggerSleepAction(1.) set Bomb_Duration = Bomb_Duration - 1 endif endloop set b = GetUnitLoc(y) call EnumDestructablesInCircleBJ(300.00, b, function Kill_Trees) call CreateNUnitsAtLoc(1, 'u002', GetOwningPlayer(m), GetUnitLoc(y), bj_UNIT_FACING) call SetUnitAbilityLevelSwapped('A003', GetLastCreatedUnit(), GetUnitAbilityLevelSwapped('A002', m)) call IssueImmediateOrderBJ(GetLastCreatedUnit(), "stomp") call UnitApplyTimedLifeBJ(1.25, 'BTLF', GetLastCreatedUnit()) call CreateNUnitsAtLoc(1, 'u003', GetOwningPlayer(m), GetUnitLoc(y), bj_UNIT_FACING) call UnitApplyTimedLifeBJ(1.25, 'BTLF', GetLastCreatedUnit()) call CreateNUnitsAtLoc(1, 'u004', GetOwningPlayer(m), GetUnitLoc(y), bj_UNIT_FACING) call UnitApplyTimedLifeBJ(1.25, 'BTLF', GetLastCreatedUnit()) call DestroyEffectBJ(e) call RemoveLocation(b) set m = null set y = null set b = null set e = null set x = null endfunction //=========================================================================== function InitTrig_Timed_Bomb takes nothing returns nothing set gg_trg_Timed_Bomb = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(gg_trg_Timed_Bomb, EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerAddCondition(gg_trg_Timed_Bomb, Condition(function Timed_Bomb_Conditions)) call TriggerAddAction(gg_trg_Timed_Bomb, function Timed_Bomb_Actions) endfunction |
| 03-11-2007, 10:34 PM | #4 |
Damn. That is one inefficient JASS script. Mind if I change it? In the meantime, look for anything that says "A002" in that code, and change that to the rawcode of your ability. Keep the apostrophies! |
| 03-12-2007, 01:34 AM | #5 |
BTW, JASS is uber case-sensitive, don't make a single mistake. Can't help much more until I learn more about JASS. Go tutorials! |
| 03-12-2007, 01:41 AM | #6 | |
Quote:
And who was that directed at, anyway? I'm sure not that much of an idiot... ![]() |
| 03-12-2007, 03:54 AM | #7 |
Here, Dwarf Zealot, try this; it includes a configuration section. Make a trigger called "Timed Bomb", and use this. If you have problems/questions, I'll troubleshoot for you. JASS://*************************************************************************** // Configuration Section * //*************************************************************************** constant function Timed_Bomb_Ability_Id takes nothing returns integer return 'A002' //Rawcode of the main hero/unit ability; KEEP THE APOSTROPHIES endfunction constant function Timed_Bomb_Dummy_Ability_Id takes nothing returns integer return 'A003' //Rawcode of the dummy unit's spell (Whatever it's for); KEEP THE APOSTROPHIES endfunction constant function Timed_Bomb_Dummy_Id_1 takes nothing returns integer return 'u002' //Rawcode of the dummy unit with the spell; KEEP THE APOSTROPHIES endfunction constant function Timed_Bomb_Dummy_Id_2 takes nothing returns integer return 'u003' //Rawcode of the 2nd dummy unit (Whatever it's for); KEEP THE APOSTROPHIES endfunction constant function Timed_Bomb_Dummy_Id_3 takes nothing returns integer return 'u004' //Rawcode of the 3rd dummy unit (Whatever it's for); KEEP THE APOSTROPHIES endfunction constant function Timed_Bomb_Radius takes nothing returns real return 300.00 //Radius to kill trees in when the bomb goes off; KEEP THE APOSTROPHIES endfunction constant function Timed_Bomb_Sound takes nothing returns sound return gg_snd_BattleNetTick //The sound variable for when you import the sound for a ticking noise. In the sound editor, find the sound, endfunction //Click "use as sound", and change this line to "gg_snd_" + the name under the "sound variable" column for the sound; CASE SENSITIVE //*************************************************************************** // End Config * //*************************************************************************** function Timed_Bomb_Conditions takes nothing returns boolean return GetSpellAbilityId() == Timed_Bomb_Ability_Id() endfunction function Timed_Bomb_Kill_Trees takes nothing returns nothing call KillDestructable(GetEnumDestructable()) endfunction function Timed_Bomb_Actions takes nothing returns nothing local unit Caster = GetTriggerUnit() local unit Target = GetSpellTargetUnit() local unit U local texttag Text local integer Bomb_Duration = 12-(GetUnitAbilityLevel(Caster, Timed_Bomb_Ability_Id())*2) //How much time to wait before the boom local effect SFX = AddSpecialEffectTarget("Abilities\\Weapons\\GyroCopter\\GyroCopterMissile.mdl", Target, "overhead") local integer Level = GetUnitAbilityLevel(Caster, Timed_Bomb_Ability_Id()) local real X = GetUnitX(Target) local real Y = GetUnitY(Target) local rect Explosion_Area = Rect(X-Timed_Bomb_Radius(), Y-Timed_Bomb_Radius(), X+Timed_Bomb_Radius(), Y+Timed_Bomb_Radius()) local integer I = 0 local integer array Dummies set Dummies[1] = Timed_Bomb_Dummy_Id_1() set Dummies[2] = Timed_Bomb_Dummy_Id_2() set Dummies[3] = Timed_Bomb_Dummy_Id_3() loop exitwhen Bomb_Duration == 0 or GetWidgetLife(Target) <= 0.405 set Text = CreateTextTag() call SetTextTagText(Text, I2S(Bomb_Duration), TextTagSize2Height(9.00)) call SetTextTagPosUnit(Text, Target, 0.00) call SetTextTagColor(Text, 255, 0, 0, 255) call SetTextTagVelocityBJ(Text, 80.00, 90) call SetTextTagPermanent(Text, false) call SetTextTagFadepoint(Text, 1.75) call SetTextTagLifespan(Text, 3.25) call AttachSoundToUnit(Timed_Bomb_Sound(), Target) call SetSoundVolume(Timed_Bomb_Sound(), PercentToInt(1.00, 127)) call StartSound(Timed_Bomb_Sound()) call TriggerSleepAction(1.00) set Bomb_Duration = Bomb_Duration - 1 endloop call DestroyEffect(SFX) set X = GetUnitX(Target) set Y = GetUnitY(Target) call MoveRectTo(Explosion_Area, X, Y) call EnumDestructablesInRect(Explosion_Area, null, function Timed_Bomb_Kill_Trees) loop set I = I+1 exitwhen I > 3 set U = CreateUnit(GetOwningPlayer(Caster), Dummies[i], X, Y, 0.00) if I == 1 then call SetUnitAbilityLevel(U, Timed_Bomb_Dummy_Ability_Id(), Level) call IssueImmediateOrder(U, "stomp") endif call UnitApplyTimedLife(U, 'BTLF', 1.25) endloop call RemoveRect(Explosion_Area) set Explosion_Area = null set Caster = null set Target = null set Text = null set SFX = null set U = null endfunction //=========================================================================== function InitTrig_Timed_Bomb takes nothing returns nothing set gg_trg_Timed_Bomb = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(gg_trg_Timed_Bomb, EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerAddCondition(gg_trg_Timed_Bomb, Condition(function Timed_Bomb_Conditions)) call TriggerAddAction(gg_trg_Timed_Bomb, function Timed_Bomb_Actions) endfunction |
| 03-12-2007, 05:48 PM | #8 |
thanks a lot man. rep added, but wait, how do i get the rawcode for the ability? (sorry i am a noob). and it has two dummy animations, a dummy caster, and a dummy ability. In that code it only has 3 dummies. should i just post the map? |
| 03-12-2007, 05:52 PM | #9 |
Go into the Object Editor and press ctrl + d then you'll see them. When it's a custom object it'll be written like this. xxxx:yyyy(Name) you need the xxxx part, the yyyy is the raw code of the unit which was used a base for the custom unit/ability/item/etc. |
| 03-12-2007, 06:20 PM | #10 |
JASS:set U = CreateUnit(GetOwningPlayer(Caster), Dummies[i], X, Y, 0.00) |
| 03-12-2007, 08:21 PM | #11 | |
Quote:
You have to change the i either to upper or lower case (its defined as I and called as i) |
| 03-12-2007, 09:40 PM | #12 |
so i just change the i to an I and it will work? |
| 03-12-2007, 09:50 PM | #13 |
Should be... as its the only thing I saw. |
| 03-12-2007, 09:54 PM | #14 |
i got it to do the countdown but it does no damage |
| 03-12-2007, 10:14 PM | #15 |
Damage is dealt exclusivly via the abilites. Don't know maybe the stomp or the dummy unit might have something like aoe damage on death |
