HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Darky27 I need your help again.

06-03-2004, 11:07 PM#1
Kam
I got your Goblin Airstrike ability and it is awsome. However, it seems to be impossible to completely kill buildings. I can get them down to two or three hps, but no matter how many more times I hit it they will not die. Also, I want the actual plane to only reveal an area about 1/4 the current one, would I just edit the actual unit for that?

Edit: That reminds me, this spell disables the neutral Reveal spell when at the same building. I added this spell to the Goblin Labratory and now it just reveals the map when you click on either icon.

Edit2: I also would like it if you could only call an airstrike on an area that you can see. As of now you can strike anywhere, that's just asking for someone to take advantage of it.
06-03-2004, 11:12 PM#2
Vexorian
that's because he doesn't use my caster system and preffers to use hurl boulder for final spell (he didn't even make a new spell for that), try changing hurl boulder's targets to add structure
06-03-2004, 11:40 PM#3
Kam
Wha, huh? I just make maps, I don't know JASS. Here is the code, mabye just edit it and post it, eh?

--------------------------------------------------------------------------

function GetAirstrikeGameCache takes nothing returns gamecache
return gg_trg_Airstrike
return null
endfunction

function Initialize_Airstrike_Variables takes nothing returns nothing
local gamecache g = GetAirstrikeGameCache()
local integer AirstrikeAbility = 'Andt' // <-- You can adjust the Value
local integer AirstrikeJet = 'h007' // <-- You can adjust the Value
local integer AirstrikeGoldCost = 400 // <-- You can adjust the Value
local integer AirstrikeDamage = 300 // <-- You can adjust the Value
call StoreIntegerBJ( AirstrikeAbility, "Ability", "Ability", g )
call StoreIntegerBJ( AirstrikeJet, "Jet", "Unit", g )
call StoreIntegerBJ( AirstrikeGoldCost, "Gold", "Ability", g )
call StoreIntegerBJ( AirstrikeDamage, "Damage", "Damage", g )
endfunction

function AirstrikeErrorMessage takes player ForPlayer, string msg returns nothing
local sound error = CreateSound( "Sound\\Interface\\Error.wav", false, false, false, 10, 10, "HeroAcksEAX" )
if (GetLocalPlayer() == ForPlayer) then
call ClearTextMessages()
call DisplayTimedTextToPlayer( ForPlayer, 0.52, -1.00, 2.00, "|cffffcc00"+msg+"|r" )
call SetSoundParamsFromLabel( error, "InterfaceError" )
call SetSoundDuration( error, 614 )
call SetSoundChannel( error, 6 )
call PlaySoundBJ( error )
endif
endfunction

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

function AirstrikeInteger2Trigger takes integer i returns trigger
return i
return null
endfunction

function AirstrikeInteger2Effect takes integer i returns effect
return i
return null
endfunction

function AirstrikeHandle2Integer takes handle h returns integer
return h
return 0
endfunction

function AirstrikeInteger2Unit takes integer i returns unit
return i
return null
endfunction

function AirstrikeAbility takes nothing returns integer
return GetStoredInteger(GetAirstrikeGameCache(), "Ability", "Ability")
endfunction

function AirstrikeGoldCost takes nothing returns integer
return GetStoredInteger(GetAirstrikeGameCache(), "Ability", "Gold")
endfunction

function AirstrikeDamage takes nothing returns integer
return GetStoredInteger(GetAirstrikeGameCache(), "Damage", "Damage")
endfunction

function Trig_Airstrike_Ability_Conditions takes nothing returns boolean
local gamecache g = GetAirstrikeGameCache()
local location p = GetOrderPointLoc()
local location l = GetUnitLoc(GetOrderedUnit())
local real d = DistanceBetweenPoints(l,p)
call RemoveLocation(l)
if ((d < 700) and GetIssuedOrderIdBJ() == String2OrderIdBJ("neutraldetectaoe")) then
call StoreIntegerBJ( 1, "Error", "Error", g )
endif
return GetIssuedOrderIdBJ() == String2OrderIdBJ("neutraldetectaoe")
endfunction

function Trig_Airstrike_Ability_Actions takes nothing returns nothing
local integer i = 0
local gamecache g = GetAirstrikeGameCache()
local location p = GetOrderPointLoc()
loop
exitwhen i > 11
if ( GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING ) then
call StoreIntegerBJ( GetPlayerState(Player(i), PLAYER_STATE_RESOURCE_GOLD), "Player" + I2S(i+1), "Gold", g )
endif
set i = i + 1
endloop
call StoreRealBJ( GetLocationX(p), "X", "Point", g )
call StoreRealBJ( GetLocationY(p), "Y", "Point", g )
call StoreIntegerBJ( AirstrikeHandle2Integer(GetOrderedUnit()), "Caster", "Unit", g )
endfunction

function Trig_Airstrike_Return_Conditions takes nothing returns boolean
local gamecache g = GetAirstrikeGameCache()
local unit u = AirstrikeInteger2Unit( GetStoredInteger(g, I2S(AirstrikeHandle2Integer(GetTriggeringTrigger())), "Unit") )
local unit b = AirstrikeInteger2Unit( GetStoredInteger(g, I2S(AirstrikeHandle2Integer(u)), "Building") )
local unit t = AirstrikeInteger2Unit( GetStoredInteger(g, I2S(AirstrikeHandle2Integer(u)), "Target") )
local location l = GetUnitLoc(u)
local location s = GetUnitLoc(b)
local real d = DistanceBetweenPoints(l,s)
call RemoveLocation(l)
call RemoveLocation(s)
call StoreIntegerBJ( AirstrikeHandle2Integer(u), "return", "return", g )
return ((d > 150) and (( GetTriggerUnit() == b ) or ( GetTriggerUnit() == t )))
endfunction

function Trig_Airstrike_Return_Actions takes nothing returns nothing
local gamecache g = GetAirstrikeGameCache()
local unit u = AirstrikeInteger2Unit( GetStoredInteger(g, "return", "return") )
local trigger t = AirstrikeInteger2Trigger ( GetStoredInteger(g, I2S(AirstrikeHandle2Integer(u)), "Trigger") )
local effect e = AirstrikeInteger2Effect ( GetStoredInteger(g, I2S(AirstrikeHandle2Integer(u)), "Effect") )
local unit b = AirstrikeInteger2Unit( GetStoredInteger(g, I2S(AirstrikeHandle2Integer(u)), "Building") )
local unit a
local location l = GetUnitLoc(GetTriggerUnit())
local location s = GetUnitLoc(u)
local location bl = GetUnitLoc(b)
local location n
local real angle
local integer i = 0
if ( GetTriggerUnit() == b ) then
call SetUnitFlyHeightBJ( u, 20.00, 180.00 )
call TriggerSleepAction( 1.00 )
call UnitRemoveAbilityBJ( 'Aloc', u )
call RemoveUnit( u )
call DestroyTrigger( t )
else
call DestroyEffect( e )
set n = PolarProjectionBJ(s, 150.00, AngleBetweenPoints(s, l))
set a = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), GetStoredInteger(g, "Unit", "Jet"), n, AngleBetweenPoints(s, l))
call UnitAddAbilityBJ( 'Aloc', a )
call SetUnitUseFoodBJ( false, a )
call SetUnitFlyHeightBJ( a , GetUnitDefaultFlyHeight(a)-50, 0 )
call SetUnitTimeScalePercent( a, 0.00 )
call SetUnitScalePercent( a, 300.00, 300.00, 300.00 )
call SetUnitVertexColorBJ( a, 100, 100, 100, 100.00 )
call StoreIntegerBJ( GetPlayerId(GetOwningPlayer(u)) , "Player", I2S(AirstrikeHandle2Integer(a)), g )
call IssueTargetOrderBJ( a, "attack", GetTriggerUnit() )
call RemoveLocation(n)
set angle = AngleBetweenPoints(bl, l)
loop
exitwhen i > 10
call IssuePointOrderLocBJ( u, "move", PolarProjectionBJ(l, 900.00, angle - (i * 12) ) )
call PolledWait( 0.2 )
set i = i + 1
endloop
call IssuePointOrderLocBJ( u, "move", bl )
endif
call RemoveLocation(bl)
call RemoveLocation(l)
call RemoveLocation(s)
endfunction

function Trig_Airstrike_Gold_Conditions takes nothing returns boolean
local gamecache g = GetAirstrikeGameCache()
local integer i = 0
local boolean b = false
local integer p
loop
exitwhen i > 11
if ( GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING ) then
if ( (GetStoredInteger(g, "Gold", "Player" + I2S(i+1)) - GetPlayerState(Player(i), PLAYER_STATE_RESOURCE_GOLD)) == AirstrikeGoldCost()) then
if (HaveStoredInteger(g,"Error","Error" )) then
set p = i
endif
set b = true
endif
if (HaveStoredInteger(g,"Error","Error" )) then
call FlushStoredInteger(g,"Gold", "Player" + I2S(i+1))
set b = false
endif
endif
set i = i + 1
endloop
if (HaveStoredInteger(g,"Error","Error" )) then
call AdjustPlayerStateBJ( AirstrikeGoldCost(), Player(p), PLAYER_STATE_RESOURCE_GOLD )
call FlushStoredInteger(g,"Error", "Error")
call AirstrikeErrorMessage(Player(p), "Jet launch too close to the goblin lab")
endif
return b
endfunction

function Trig_Airstrike_Gold_Actions takes nothing returns nothing
local integer i = 0
local integer p
local gamecache g = GetAirstrikeGameCache()
local unit u = AirstrikeInteger2Unit( GetStoredInteger(g, "Unit", "Caster") )
local location l = Location(GetStoredReal(g, "Point", "X"),GetStoredReal(g, "Point", "Y"))
local location s = GetUnitLoc(u)
local unit j
local unit v
local trigger t = CreateTrigger( )
local effect e
loop
exitwhen i > 11
if ( GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING ) then
if ( (GetStoredInteger(g, "Gold", "Player" + I2S(i+1)) - GetPlayerState(Player(i), PLAYER_STATE_RESOURCE_GOLD)) == AirstrikeGoldCost()) then
set p = i
endif
call FlushStoredInteger(g,"Gold", "Player" + I2S(i+1))
endif
set i = i + 1
endloop
set j = CreateUnitAtLoc(Player(p), GetStoredInteger(g, "Unit", "Jet"), s, AngleBetweenPoints(s, l))
set v = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), 'Hgam', l, 0)
call SetUnitUseFoodBJ( false, j )
call SetUnitUseFoodBJ( false, v )
call SetUnitScalePercent( v, 0.00, 0.00, 0.00 )
call SetUnitPathing( v, false )
call SetUnitPositionLoc( v, l )
call SetUnitVertexColorBJ( v, 100, 100, 100, 100.00 )
call UnitAddAbilityBJ( 'AIms', j )
set e = AddSpecialEffectLoc("Abilities\\Spells\\Orc\\CommandAura\\CommandAuraTarget.mdl", l)
call TriggerRegisterUnitInRangeSimple( t, 500, j )
call TriggerAddCondition( t, Condition( function Trig_Airstrike_Return_Conditions ) )
call TriggerAddAction( t, function Trig_Airstrike_Return_Actions )
call StoreIntegerBJ( AirstrikeHandle2Integer(j), "Unit", I2S(AirstrikeHandle2Integer(t)), g )
call StoreIntegerBJ( AirstrikeHandle2Integer(t), "Trigger", I2S(AirstrikeHandle2Integer(j)), g )
call StoreIntegerBJ( AirstrikeHandle2Integer(u), "Building", I2S(AirstrikeHandle2Integer(j)), g )
call StoreIntegerBJ( AirstrikeHandle2Integer(e), "Effect", I2S(AirstrikeHandle2Integer(j)), g )
call StoreIntegerBJ( AirstrikeHandle2Integer(v), "Target", I2S(AirstrikeHandle2Integer(j)), g )
call UnitAddAbilityBJ( 'Aloc', j )
call SetUnitPathing( j, false )
call SetUnitInvulnerable( j, true )
call SetUnitFlyHeightBJ( j, 20.00, 0 )
call IssuePointOrderLocBJ( j, "move", l )
call TriggerSleepAction( 0.10 )
call SetUnitFlyHeightBJ( j , GetUnitDefaultFlyHeight(j), 300.00 )
call RemoveLocation(l)
call RemoveLocation(s)
endfunction

function Trig_Airstrike_Attacker_Conditions takes nothing returns boolean
return (( GetUnitTypeId(GetAttacker()) == GetStoredInteger(GetAirstrikeGameCache(), "Unit", "Jet") ) and ( GetUnitTypeId(GetAttackedUnitBJ()) == 'Hgam' ))
endfunction

function Trig_Airstrike_Damage_Units takes nothing returns boolean
return ((IsUnitAliveBJ(GetFilterUnit())) and ( GetUnitTypeId(GetFilterUnit()) != 'Hgam' ))
endfunction

function Trig_Airstrike_Damage_Doodads takes nothing returns nothing
if (not IsDestructableInvulnerableBJ(GetEnumDestructable())) then
call SetDestructableLife( GetEnumDestructable(), ( GetDestructableLife(GetEnumDestructable()) - AirstrikeDamage() ) )
endif
endfunction

function Trig_Airstrike_Attacker_Actions takes nothing returns nothing
local gamecache g = GetAirstrikeGameCache()
local unit a = GetAttacker()
local unit v = GetAttackedUnitBJ()
local unit k
local location s = GetUnitLoc(v)
local location l
local integer i = 1
local integer p
local integer vp
local group targets = GetUnitsInRangeOfLocMatching(400, s, Condition(function Trig_Airstrike_Damage_Units))
local group targets2 = CreateGroup()
local effect array fires
local unit target
call PolledWait( 0.1 )
call RemoveUnit( a )
call RemoveUnit( v )
loop
set target = GroupPickRandomUnit(targets)
exitwhen target == null
set l = GetUnitLoc(target)
if ( GetUnitStateSwap(UNIT_STATE_LIFE, target) > AirstrikeDamage() ) then
call GroupAddUnitSimple( target, targets2 )
else
call SetUnitLifeBJ( target, 5 )
set vp = GetPlayerId(GetOwningPlayer(target))
set p = GetStoredInteger(g, I2S(AirstrikeHandle2Integer(a)), "Player")
if (IsUnitAlly(target, Player(p))) then
set p = PLAYER_NEUTRAL_AGGRESSIVE
endif
set k = CreateUnitAtLoc(Player(p), 'uktg', l, 0)
call UnitAddAbilityBJ( 'ACtb', k )
call SetUnitUseFoodBJ( false, k )
call SetUnitPathing( k, false )
call SetUnitPositionLoc( k, l )
call SetUnitVertexColorBJ( k, 100, 100, 100, 100.00 )
call UnitAddAbilityBJ( 'Aloc', k )
call SetUnitInvulnerable( k, true )
call UnitApplyTimedLifeBJ( 1.00, 'BTLF', k )
call IssueTargetOrderBJ( k, "creepthunderbolt", target )
endif
call GroupRemoveUnitSimple( target, targets )
endloop
call PolledWait( 0.4 )
loop
exitwhen i > 6
set l = PolarProjectionBJ(s, 200.00, 60*i)
call DestroyEffect( AddSpecialEffectLoc("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion .mdl", l) )
call RemoveLocation(l)
set l = GetRandomLocInRect(RectFromCenterSizeBJ(s, 600.00, 600.00))
call DestroyEffect( AddSpecialEffectLoc("Abilities\\Weapons\\BallsOfFireMissile\\BallsOfFireMissile.mdl", l) )
call RemoveLocation(l)
set i = i + 1
endloop
call DestroyEffect( AddSpecialEffectLoc("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion .mdl", s) )
set i = 1
loop
exitwhen i > 20
set l = GetRandomLocInRect(RectFromCenterSizeBJ(s, 600.00, 600.00))
set fires[i] = AddSpecialEffectLoc("Doodads\\Cinematic\\FireRockSmall\\FireRockSmall.mdl", l)
call RemoveLocation(l)
set i = i + 1
endloop
call EnumDestructablesInCircleBJ( 400, s, function Trig_Airstrike_Damage_Doodads )
loop
set target = GroupPickRandomUnit(targets2)
exitwhen target == null
set l = GetUnitLoc(target)
call DestroyEffect( AddSpecialEffectLoc("Abilities\\Weapons\\BallsOfFireMissile\\BallsOfFireMissile.mdl", l) )
call SetUnitLifeBJ( target, ( GetUnitStateSwap(UNIT_STATE_LIFE, target) - AirstrikeDamage() ) )
call GroupRemoveUnitSimple( target, targets2 )
endloop
set i = 1
call PolledWait( 0.1 )
loop
exitwhen i > 20
call DestroyEffect( fires[i] )
call TriggerSleepAction( 0.1 )
set i = i + 1
endloop
call RemoveLocation(s)
endfunction

//===========================================================================
function InitTrig_Airstrike takes nothing returns nothing
local integer i = 0
local trigger t = CreateTrigger( )
local trigger g = CreateTrigger( )
set gg_trg_Airstrike = AirstrikeGameCache2Trigger(InitGameCache( "Airstrike.w3v" ))
call Initialize_Airstrike_Variables()
loop
exitwhen i > 11
if ( GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING ) then
call TriggerRegisterPlayerUnitEventSimple( t, Player(i), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerRegisterPlayerStateEvent( g, Player(i), PLAYER_STATE_RESOURCE_GOLD, GREATER_THAN_OR_EQUAL, 0.00 )
endif
set i = i + 1
endloop
call TriggerRegisterPlayerUnitEventSimple( t, Player(15), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerAddAction( t, function Trig_Airstrike_Ability_Actions )
call TriggerAddCondition( t, Condition( function Trig_Airstrike_Ability_Conditions ) )
call TriggerAddAction( g, function Trig_Airstrike_Gold_Actions )
call TriggerAddCondition( g, Condition( function Trig_Airstrike_Gold_Conditions ) )
set t = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( t, Player(PLAYER_NEUTRAL_PASSIVE), EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, Condition( function Trig_Airstrike_Attacker_Conditions ) )
call TriggerAddAction( t, function Trig_Airstrike_Attacker_Actions )
endfunction
06-03-2004, 11:53 PM#4
Vexorian
But you are able to change the targets allowed of a neutral hostile spell used by the rock golem called hurl boulder, right?
06-03-2004, 11:55 PM#5
Kam
Quote:
Originally Posted by Lord Vexorian
But you are able to change the targets allowed of a neutral hostile spell used by the rock golem called hurl boulder, right?

Yes, but I'm using that spell in a unit.

I changed my first message at the top, there were more problems. Mabye could you get all of this fixed using the JASS code and then I could copy and paste it in? I can't really give you anything for the work.
06-04-2004, 12:00 AM#6
Vexorian
ok, make a new spell, based of hurl boulder, make it be allowed to target vulnerable, then find this line:

call UnitAddAbilityBJ( 'ACtb', k )

in the script

Take the new ability and find its rawcode, a 4 letters code
then replace ACtb with the 4 letters code
06-04-2004, 04:55 PM#7
xGT4x
I thought he uses Devour since when I tried to kill the big drake it's hp sunk down to 1 and then it said: Target can't be devoured.
Btw: I think 'Death Finger' would be the best for that since it kills all units, magic immune, buildings, just everything...
Little question: I know it's stupid but how can I make that the trigger damages only to 1 hp and not less? In my maps I always used one ability which does 1 damage and can target every unit type and then ordered the dummy to:
For each Integer from 1 to (Damage) do Order (Last Created Unit) to (Dummy Ability) (Unit)
06-04-2004, 08:24 PM#8
Kam
Could I make it only usable on areas that are revealed to the user?

Edit: Damn. I just realized that the ground marker is a unit that is clickable and has a collision. wtf? I need that fixed please. O and btw Vex that fixed the dmg problem, now it kills structures. Can you help me with these two problems?

HELP ME PLEASE
06-05-2004, 01:56 AM#9
Kam
Ok, here is what I need to do:
Make the unit that is used as a target:
A. Non-selectable
B. No collision!!!
C. No shadow, and for gods sake NO SOUND. Whenever you drop the bomb on the target you hear the archmages damage sound.
D. Make it so you can only bomb where you can see.
E. This spell for some reason disables ALL versions of the reveal spell. The human, neutral, all of them. WHY?

Basically the target needs to be like the actual bomber and have no physical properties other than that they can be seen.

I NEED HELP.
Here is the code:
-----------------------------------------------------------------------

function GetAirstrikeGameCache takes nothing returns gamecache
return gg_trg_Airstrike
return null
endfunction

function Initialize_Airstrike_Variables takes nothing returns nothing
local gamecache g = GetAirstrikeGameCache()
local integer AirstrikeAbility = 'Andt' // <-- You can adjust the Value
local integer AirstrikeJet = 'h007' // <-- You can adjust the Value
local integer AirstrikeGoldCost = 400 // <-- You can adjust the Value
local integer AirstrikeDamage = 300 // <-- You can adjust the Value
call StoreIntegerBJ( AirstrikeAbility, "Ability", "Ability", g )
call StoreIntegerBJ( AirstrikeJet, "Jet", "Unit", g )
call StoreIntegerBJ( AirstrikeGoldCost, "Gold", "Ability", g )
call StoreIntegerBJ( AirstrikeDamage, "Damage", "Damage", g )
endfunction

function AirstrikeErrorMessage takes player ForPlayer, string msg returns nothing
local sound error = CreateSound( "Sound\\Interface\\Error.wav", false, false, false, 10, 10, "HeroAcksEAX" )
if (GetLocalPlayer() == ForPlayer) then
call ClearTextMessages()
call DisplayTimedTextToPlayer( ForPlayer, 0.52, -1.00, 2.00, "|cffffcc00"+msg+"|r" )
call SetSoundParamsFromLabel( error, "InterfaceError" )
call SetSoundDuration( error, 614 )
call SetSoundChannel( error, 6 )
call PlaySoundBJ( error )
endif
endfunction

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

function AirstrikeInteger2Trigger takes integer i returns trigger
return i
return null
endfunction

function AirstrikeInteger2Effect takes integer i returns effect
return i
return null
endfunction

function AirstrikeHandle2Integer takes handle h returns integer
return h
return 0
endfunction

function AirstrikeInteger2Unit takes integer i returns unit
return i
return null
endfunction

function AirstrikeAbility takes nothing returns integer
return GetStoredInteger(GetAirstrikeGameCache(), "Ability", "Ability")
endfunction

function AirstrikeGoldCost takes nothing returns integer
return GetStoredInteger(GetAirstrikeGameCache(), "Ability", "Gold")
endfunction

function AirstrikeDamage takes nothing returns integer
return GetStoredInteger(GetAirstrikeGameCache(), "Damage", "Damage")
endfunction

function Trig_Airstrike_Ability_Conditions takes nothing returns boolean
local gamecache g = GetAirstrikeGameCache()
local location p = GetOrderPointLoc()
local location l = GetUnitLoc(GetOrderedUnit())
local real d = DistanceBetweenPoints(l,p)
call RemoveLocation(l)
if ((d < 700) and GetIssuedOrderIdBJ() == String2OrderIdBJ("neutraldetectaoe")) then
call StoreIntegerBJ( 1, "Error", "Error", g )
endif
return GetIssuedOrderIdBJ() == String2OrderIdBJ("neutraldetectaoe")
endfunction

function Trig_Airstrike_Ability_Actions takes nothing returns nothing
local integer i = 0
local gamecache g = GetAirstrikeGameCache()
local location p = GetOrderPointLoc()
loop
exitwhen i > 11
if ( GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING ) then
call StoreIntegerBJ( GetPlayerState(Player(i), PLAYER_STATE_RESOURCE_GOLD), "Player" + I2S(i+1), "Gold", g )
endif
set i = i + 1
endloop
call StoreRealBJ( GetLocationX(p), "X", "Point", g )
call StoreRealBJ( GetLocationY(p), "Y", "Point", g )
call StoreIntegerBJ( AirstrikeHandle2Integer(GetOrderedUnit()), "Caster", "Unit", g )
endfunction

function Trig_Airstrike_Return_Conditions takes nothing returns boolean
local gamecache g = GetAirstrikeGameCache()
local unit u = AirstrikeInteger2Unit( GetStoredInteger(g, I2S(AirstrikeHandle2Integer(GetTriggeringTrigger())), "Unit") )
local unit b = AirstrikeInteger2Unit( GetStoredInteger(g, I2S(AirstrikeHandle2Integer(u)), "Building") )
local unit t = AirstrikeInteger2Unit( GetStoredInteger(g, I2S(AirstrikeHandle2Integer(u)), "Target") )
local location l = GetUnitLoc(u)
local location s = GetUnitLoc(b)
local real d = DistanceBetweenPoints(l,s)
call RemoveLocation(l)
call RemoveLocation(s)
call StoreIntegerBJ( AirstrikeHandle2Integer(u), "return", "return", g )
return ((d > 150) and (( GetTriggerUnit() == b ) or ( GetTriggerUnit() == t )))
endfunction

function Trig_Airstrike_Return_Actions takes nothing returns nothing
local gamecache g = GetAirstrikeGameCache()
local unit u = AirstrikeInteger2Unit( GetStoredInteger(g, "return", "return") )
local trigger t = AirstrikeInteger2Trigger ( GetStoredInteger(g, I2S(AirstrikeHandle2Integer(u)), "Trigger") )
local effect e = AirstrikeInteger2Effect ( GetStoredInteger(g, I2S(AirstrikeHandle2Integer(u)), "Effect") )
local unit b = AirstrikeInteger2Unit( GetStoredInteger(g, I2S(AirstrikeHandle2Integer(u)), "Building") )
local unit a
local location l = GetUnitLoc(GetTriggerUnit())
local location s = GetUnitLoc(u)
local location bl = GetUnitLoc(b)
local location n
local real angle
local integer i = 0
if ( GetTriggerUnit() == b ) then
call SetUnitFlyHeightBJ( u, 20.00, 220.00 )
call TriggerSleepAction( 1.00 )
call UnitRemoveAbilityBJ( 'Aloc', u )
call RemoveUnit( u )
call DestroyTrigger( t )
else
call DestroyEffect( e )
set n = PolarProjectionBJ(s, 150.00, AngleBetweenPoints(s, l))
set a = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), GetStoredInteger(g, "Unit", "Jet"), n, AngleBetweenPoints(s, l))
call UnitAddAbilityBJ( 'Aloc', a )
call SetUnitUseFoodBJ( false, a )
call SetUnitFlyHeightBJ( a , GetUnitDefaultFlyHeight(a)-50, 0 )
call SetUnitTimeScalePercent( a, 0.00 )
call SetUnitScalePercent( a, 300.00, 300.00, 300.00 )
call SetUnitVertexColorBJ( a, 100, 100, 100, 100.00 )
call StoreIntegerBJ( GetPlayerId(GetOwningPlayer(u)) , "Player", I2S(AirstrikeHandle2Integer(a)), g )
call IssueTargetOrderBJ( a, "attack", GetTriggerUnit() )
call RemoveLocation(n)
set angle = AngleBetweenPoints(bl, l)
loop
exitwhen i > 10
call IssuePointOrderLocBJ( u, "move", PolarProjectionBJ(l, 900.00, angle - (i * 12) ) )
call PolledWait( 0.2 )
set i = i + 1
endloop
call IssuePointOrderLocBJ( u, "move", bl )
endif
call RemoveLocation(bl)
call RemoveLocation(l)
call RemoveLocation(s)
endfunction

function Trig_Airstrike_Gold_Conditions takes nothing returns boolean
local gamecache g = GetAirstrikeGameCache()
local integer i = 0
local boolean b = false
local integer p
loop
exitwhen i > 11
if ( GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING ) then
if ( (GetStoredInteger(g, "Gold", "Player" + I2S(i+1)) - GetPlayerState(Player(i), PLAYER_STATE_RESOURCE_GOLD)) == AirstrikeGoldCost()) then
if (HaveStoredInteger(g,"Error","Error" )) then
set p = i
endif
set b = true
endif
if (HaveStoredInteger(g,"Error","Error" )) then
call FlushStoredInteger(g,"Gold", "Player" + I2S(i+1))
set b = false
endif
endif
set i = i + 1
endloop
if (HaveStoredInteger(g,"Error","Error" )) then
call AdjustPlayerStateBJ( AirstrikeGoldCost(), Player(p), PLAYER_STATE_RESOURCE_GOLD )
call FlushStoredInteger(g,"Error", "Error")
call AirstrikeErrorMessage(Player(p), "Jet launch too close to the goblin lab")
endif
return b
endfunction

function Trig_Airstrike_Gold_Actions takes nothing returns nothing
local integer i = 0
local integer p
local gamecache g = GetAirstrikeGameCache()
local unit u = AirstrikeInteger2Unit( GetStoredInteger(g, "Unit", "Caster") )
local location l = Location(GetStoredReal(g, "Point", "X"),GetStoredReal(g, "Point", "Y"))
local location s = GetUnitLoc(u)
local unit j
local unit v
local trigger t = CreateTrigger( )
local effect e
loop
exitwhen i > 11
if ( GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING ) then
if ( (GetStoredInteger(g, "Gold", "Player" + I2S(i+1)) - GetPlayerState(Player(i), PLAYER_STATE_RESOURCE_GOLD)) == AirstrikeGoldCost()) then
set p = i
endif
call FlushStoredInteger(g,"Gold", "Player" + I2S(i+1))
endif
set i = i + 1
endloop
set j = CreateUnitAtLoc(Player(p), GetStoredInteger(g, "Unit", "Jet"), s, AngleBetweenPoints(s, l))
set v = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), 'Hgam', l, 0)
call SetUnitUseFoodBJ( false, j )
call SetUnitUseFoodBJ( false, v )
call SetUnitScalePercent( v, 0.00, 0.00, 0.00 )
call SetUnitPathing( v, false )
call SetUnitPositionLoc( v, l )
call SetUnitVertexColorBJ( v, 100, 100, 100, 100.00 )
call UnitAddAbilityBJ( 'AIms', j )
set e = AddSpecialEffectLoc("Abilities\\Spells\\Orc\\CommandAura\\CommandAuraTarget.mdl", l)
call TriggerRegisterUnitInRangeSimple( t, 500, j )
call TriggerAddCondition( t, Condition( function Trig_Airstrike_Return_Conditions ) )
call TriggerAddAction( t, function Trig_Airstrike_Return_Actions )
call StoreIntegerBJ( AirstrikeHandle2Integer(j), "Unit", I2S(AirstrikeHandle2Integer(t)), g )
call StoreIntegerBJ( AirstrikeHandle2Integer(t), "Trigger", I2S(AirstrikeHandle2Integer(j)), g )
call StoreIntegerBJ( AirstrikeHandle2Integer(u), "Building", I2S(AirstrikeHandle2Integer(j)), g )
call StoreIntegerBJ( AirstrikeHandle2Integer(e), "Effect", I2S(AirstrikeHandle2Integer(j)), g )
call StoreIntegerBJ( AirstrikeHandle2Integer(v), "Target", I2S(AirstrikeHandle2Integer(j)), g )
call UnitAddAbilityBJ( 'Aloc', j )
call SetUnitPathing( j, false )
call SetUnitInvulnerable( j, true )
call SetUnitFlyHeightBJ( j, 20.00, 0 )
call IssuePointOrderLocBJ( j, "move", l )
call TriggerSleepAction( 0.10 )
call SetUnitFlyHeightBJ( j , GetUnitDefaultFlyHeight(j), 300.00 )
call RemoveLocation(l)
call RemoveLocation(s)
endfunction

function Trig_Airstrike_Attacker_Conditions takes nothing returns boolean
return (( GetUnitTypeId(GetAttacker()) == GetStoredInteger(GetAirstrikeGameCache(), "Unit", "Jet") ) and ( GetUnitTypeId(GetAttackedUnitBJ()) == 'Hgam' ))
endfunction

function Trig_Airstrike_Damage_Units takes nothing returns boolean
return ((IsUnitAliveBJ(GetFilterUnit())) and ( GetUnitTypeId(GetFilterUnit()) != 'Hgam' ))
endfunction

function Trig_Airstrike_Damage_Doodads takes nothing returns nothing
if (not IsDestructableInvulnerableBJ(GetEnumDestructable())) then
call SetDestructableLife( GetEnumDestructable(), ( GetDestructableLife(GetEnumDestructable()) - AirstrikeDamage() ) )
endif
endfunction

function Trig_Airstrike_Attacker_Actions takes nothing returns nothing
local gamecache g = GetAirstrikeGameCache()
local unit a = GetAttacker()
local unit v = GetAttackedUnitBJ()
local unit k
local location s = GetUnitLoc(v)
local location l
local integer i = 1
local integer p
local integer vp
local group targets = GetUnitsInRangeOfLocMatching(400, s, Condition(function Trig_Airstrike_Damage_Units))
local group targets2 = CreateGroup()
local effect array fires
local unit target
call PolledWait( 0.1 )
call RemoveUnit( a )
call RemoveUnit( v )
loop
set target = GroupPickRandomUnit(targets)
exitwhen target == null
set l = GetUnitLoc(target)
if ( GetUnitStateSwap(UNIT_STATE_LIFE, target) > AirstrikeDamage() ) then
call GroupAddUnitSimple( target, targets2 )
else
call SetUnitLifeBJ( target, 5 )
set vp = GetPlayerId(GetOwningPlayer(target))
set p = GetStoredInteger(g, I2S(AirstrikeHandle2Integer(a)), "Player")
if (IsUnitAlly(target, Player(p))) then
set p = PLAYER_NEUTRAL_AGGRESSIVE
endif
set k = CreateUnitAtLoc(Player(p), 'uktg', l, 0)
call UnitAddAbilityBJ( 'A00A', k )
call SetUnitUseFoodBJ( false, k )
call SetUnitPathing( k, false )
call SetUnitPositionLoc( k, l )
call SetUnitVertexColorBJ( k, 100, 100, 100, 100.00 )
call UnitAddAbilityBJ( 'Aloc', k )
call SetUnitInvulnerable( k, true )
call UnitApplyTimedLifeBJ( 1.00, 'BTLF', k )
call IssueTargetOrderBJ( k, "creepthunderbolt", target )
endif
call GroupRemoveUnitSimple( target, targets )
endloop
call PolledWait( 0.4 )
loop
exitwhen i > 6
set l = PolarProjectionBJ(s, 200.00, 60*i)
call DestroyEffect( AddSpecialEffectLoc("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion .mdl", l) )
call RemoveLocation(l)
set l = GetRandomLocInRect(RectFromCenterSizeBJ(s, 600.00, 600.00))
call DestroyEffect( AddSpecialEffectLoc("Abilities\\Weapons\\BallsOfFireMissile\\BallsOfFireMissile.mdl", l) )
call RemoveLocation(l)
set i = i + 1
endloop
call DestroyEffect( AddSpecialEffectLoc("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion .mdl", s) )
set i = 1
loop
exitwhen i > 20
set l = GetRandomLocInRect(RectFromCenterSizeBJ(s, 600.00, 600.00))
set fires[i] = AddSpecialEffectLoc("Doodads\\Cinematic\\FireRockSmall\\FireRockSmall.mdl", l)
call RemoveLocation(l)
set i = i + 1
endloop
call EnumDestructablesInCircleBJ( 400, s, function Trig_Airstrike_Damage_Doodads )
loop
set target = GroupPickRandomUnit(targets2)
exitwhen target == null
set l = GetUnitLoc(target)
call DestroyEffect( AddSpecialEffectLoc("Abilities\\Weapons\\BallsOfFireMissile\\BallsOfFireMissile.mdl", l) )
call SetUnitLifeBJ( target, ( GetUnitStateSwap(UNIT_STATE_LIFE, target) - AirstrikeDamage() ) )
call GroupRemoveUnitSimple( target, targets2 )
endloop
set i = 1
call PolledWait( 0.1 )
loop
exitwhen i > 20
call DestroyEffect( fires[i] )
call TriggerSleepAction( 0.1 )
set i = i + 1
endloop
call RemoveLocation(s)
endfunction

//===========================================================================
function InitTrig_Airstrike takes nothing returns nothing
local integer i = 0
local trigger t = CreateTrigger( )
local trigger g = CreateTrigger( )
set gg_trg_Airstrike = AirstrikeGameCache2Trigger(InitGameCache( "Airstrike.w3v" ))
call Initialize_Airstrike_Variables()
loop
exitwhen i > 11
if ( GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING ) then
call TriggerRegisterPlayerUnitEventSimple( t, Player(i), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerRegisterPlayerStateEvent( g, Player(i), PLAYER_STATE_RESOURCE_GOLD, GREATER_THAN_OR_EQUAL, 0.00 )
endif
set i = i + 1
endloop
call TriggerRegisterPlayerUnitEventSimple( t, Player(15), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerAddAction( t, function Trig_Airstrike_Ability_Actions )
call TriggerAddCondition( t, Condition( function Trig_Airstrike_Ability_Conditions ) )
call TriggerAddAction( g, function Trig_Airstrike_Gold_Actions )
call TriggerAddCondition( g, Condition( function Trig_Airstrike_Gold_Conditions ) )
set t = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( t, Player(PLAYER_NEUTRAL_PASSIVE), EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, Condition( function Trig_Airstrike_Attacker_Conditions ) )
call TriggerAddAction( t, function Trig_Airstrike_Attacker_Actions )
endfunction

-------------------------------------------------------------------
I find this funny, it is in the comment box at the top:

Goblin Airstrike
===========
Very easy to install:
Copy the Jet Unit and create the airstrike ability based on "reveal"
Just copy&paste the Trigger to your map and adjust the 4 values:
- AirstrikeAbility
- AirstrikeJet
- AirstrikeGoldCost
- AirstrikeDamage

Sure Darky27.....
06-06-2004, 05:03 AM#10
Kam
I'm sorry for my replies but I NEED an answer to this. I have listed everything the potential helper needs and even given the code. Please help me, I'm sure this has a simple solution.
06-06-2004, 05:53 AM#11
Darky28
as vex already said.. make hurl boulder target buildings as well... thats all
06-06-2004, 05:57 AM#12
Pheonix-IV
the target thing is easy, edit the unit he uses as target. You cannot fix the reveal bug however, the reason it dosnt work is because the airstrike spell is based off reveal, its not fixable without rewriting the entire spell.
06-06-2004, 07:36 AM#13
Kam
I tried to edit the archmage unit that it uses as the target point. I gave it no collision, but you can still select it. The unit shows up as a hero on the minimap(big brown blob) and it still uses a sound. I changed all of that in the editor for the archmage and the spell diddn't work. So?

Edit: Darky27 I was not talking about that one. I fixed that along time ago. The target thing is a BIG problem and invalidates the entire spell.
06-06-2004, 07:44 AM#14
Pheonix-IV
to make it unselectable give it the ability "Locust"
06-06-2004, 07:56 AM#15
Kam
Quote:
Originally Posted by Pheonix-IV
to make it unselectable give it the ability "Locust"

Could you point out what line of the code it is in? Also, will the locust take away the collision?

Also I need to get rid of the brown blob on the minimap, but when I changed the unit that is used to a non-hero one the ability no longer works. Also, when I try to make it soundless it no longer works.