- Joined
- Mar 23, 2007
- Messages
- 302
First of all, its all about a Hero that can summon and destroy trees and rocks.
1. spell is:
He summons an amount of Trees ans rocks depending on his lvl of the skill. the point is that i can not create Destructables and give them inventory or make them dropping items on death... so ... i just turned the created trees to units. Now the spell summons an amount of units that have inventory and drop stuff if they die.
2. spell is:
As a "Creating" Hero he is able do destroy the nature he created or even didnt created. So this spell picks all destructables and (to prevent them from dropping items) removes them, instantly creating a corpose at that point. BUT the created trees and rocks are units.... well.... so i implement this as well in this spell, picking every unit (that is a summoned-tree or summoned-rock) remove it and create a corpose for it there. additionaly i added a change of terrain to blight and a crater.
the mysterious thing is:
i can create the Trees but i cant kill them with the second spell. only black ground and a crater appears.
Would be realy happy about it, if someone would have the time to check this.
SUMMON-NATURE:
DESTROY-NATURE
holy mother.... just notized that i used only ANDs instead of ORs in the condition...
but mb here is somthing mor to do that i dont see...
EDIT:
i changed the ANDs to ORs and all seemed to work til i casted the creating spell ... look.
1. spell is:
He summons an amount of Trees ans rocks depending on his lvl of the skill. the point is that i can not create Destructables and give them inventory or make them dropping items on death... so ... i just turned the created trees to units. Now the spell summons an amount of units that have inventory and drop stuff if they die.
2. spell is:
As a "Creating" Hero he is able do destroy the nature he created or even didnt created. So this spell picks all destructables and (to prevent them from dropping items) removes them, instantly creating a corpose at that point. BUT the created trees and rocks are units.... well.... so i implement this as well in this spell, picking every unit (that is a summoned-tree or summoned-rock) remove it and create a corpose for it there. additionaly i added a change of terrain to blight and a crater.
the mysterious thing is:
i can create the Trees but i cant kill them with the second spell. only black ground and a crater appears.
Would be realy happy about it, if someone would have the time to check this.
SUMMON-NATURE:
JASS:
function Trig_Summon_Nature_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A025'
endfunction
function Trig_Summon_Nature_Actions takes nothing returns nothing
local real ran = 0
local integer R = 0
local unit C = GetTriggerUnit()
local real X = GetLocationX(GetSpellTargetLoc())
local real Y = GetLocationY(GetSpellTargetLoc())
local location L = Location(X,Y)
local integer lvl = GetUnitAbilityLevel( C,GetSpellAbilityId())
local player P = Player(0)
local real zu = GetRandomReal(0, 360.00)
local unit lu
loop
exitwhen R == 2*lvl // amount of repeats
call CreateNUnitsAtLoc( 1, 'h012', P, L, zu ) //rest is creating the units
set lu = GetLastCreatedUnit()
call UnitAddItemByIdSwapped( 'I001', lu )
call UnitAddItemByIdSwapped( 'I001', lu )
call CreateNUnitsAtLoc( 1, 'h014', P, L, zu )
set lu = GetLastCreatedUnit()
call UnitAddItemByIdSwapped( 'I001', lu )
call UnitAddItemByIdSwapped( 'I001', lu )
call CreateNUnitsAtLoc( 1, 'h013', P, L, zu )
set lu = GetLastCreatedUnit()
call UnitAddItemByIdSwapped( 'I001', lu )
call UnitAddItemByIdSwapped( 'I001', lu )
call CreateNUnitsAtLoc( 1, 'h015', P, L, zu ) // creating the rock that can contain 3 different items
set lu = GetLastCreatedUnit()
set ran = GetRandomReal(0.00,1.00)
if (ran > 50) then
call UnitAddItemByIdSwapped( 'I00V', lu )
call UnitAddItemByIdSwapped( 'I00V', lu )
elseif (ran < 25) then
call UnitAddItemByIdSwapped( 'I00T', lu )
call UnitAddItemByIdSwapped( 'I00V', lu )
elseif ((ran >= 25) and (ran <= 50)) then
call UnitAddItemByIdSwapped( 'I00V', lu )
call UnitAddItemByIdSwapped( 'I00U', lu )
endif
set R = R + 1
endloop
set C = null
set L = null
call RemoveLocation(L)
set lu = null
endfunction
DESTROY-NATURE
JASS:
function Trig_Destroy_Nature_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A026'
endfunction
function RD takes nothing returns nothing
local real X = GetDestructableX(GetEnumDestructable())
local real Y = GetDestructableY(GetEnumDestructable())
local real F = 0
local real S = 1
local destructable D = GetEnumDestructable()
local integer I = GetRandomInt(1, 5)
local integer Di = GetDestructableTypeId(D)
call RemoveDestructable( D )
call CreateDeadDestructable( Di,X,Y,F,S,I )
set D = null
endfunction
function Check takes nothing returns boolean
return( GetUnitTypeId(GetTriggerUnit()) == 'h015' ) or ( GetUnitTypeId(GetTriggerUnit()) == 'h012' ) or ( GetUnitTypeId(GetTriggerUnit()) == 'h014') or ( GetUnitTypeId(GetTriggerUnit()) == 'h013')
endfunction
function RU takes nothing returns nothing
local real X = GetUnitX(GetEnumUnit())
local real Y = GetUnitY(GetEnumUnit())
local real F = 0
local unit U = GetEnumUnit()
local integer Ui = GetUnitTypeId(U)
local player P = Player(PLAYER_NEUTRAL_AGGRESSIVE)
if ( Check() ) then
call RemoveUnit( U )
call CreateCorpse( P,Ui,X,Y,F )
endif
set U = null
set P = null
endfunction
function Trig_Destroy_Nature_Actions takes nothing returns nothing
local real X = GetLocationX(GetSpellTargetLoc())
local real Y = GetLocationY(GetSpellTargetLoc())
local player P = Player(PLAYER_NEUTRAL_AGGRESSIVE)
local location L = Location(X,Y)
call TerrainDeformationCraterBJ( 0.5, false, L , 300.00, 64 )
call SetBlightLoc( P,L, 400.00,true )
call EnumDestructablesInCircleBJ( 300.00, L, function RD )
call ForGroup( GetUnitsInRangeOfLocAll(300.00, L), function RU )
set P = null
set L = null
call RemoveLocation(L)
endfunction
holy mother.... just notized that i used only ANDs instead of ORs in the condition...
but mb here is somthing mor to do that i dont see...
EDIT:
i changed the ANDs to ORs and all seemed to work til i casted the creating spell ... look.
Last edited: