- Joined
- Jan 4, 2010
- Messages
- 14
Hi, I'm the editor of Wintermaul One Revamped, and I'm trying to implement a function that prevents a tower from ksing a creep on another lane.
Some towers have 3000 range and they can attack another player's lane.
Therefore I have this trigger to solve that.
[move red] is the region which covers the entire of red's lane
Basically-
Event: Unit is attacked
Condition: If attacked unit is not in the same lane as attacking unit
Action: Stop attacking unit
The JASS version:
This is only one of the 9 copies of this trigger that I have (the other copies are for other lanes).
My problem is that as the game progresses, the map gets laggier, fps drops. I did numerous tests and found that this trigger is the problem (removing it solves the fps drop). Every level, the FPS will drop, from 50-60 at lvl 1, to 40-50 at lvl 2 and so on, until it gets unbearable.
I would appreciate if you could explain to me in GUI terms, or tell me what I should do because I dont understand too much of JASS.
Thanks
Some towers have 3000 range and they can attack another player's lane.
Therefore I have this trigger to solve that.
[move red] is the region which covers the entire of red's lane
Basically-
Event: Unit is attacked
Condition: If attacked unit is not in the same lane as attacking unit
Action: Stop attacking unit
The JASS version:
JASS:
function Trig_Attack_other_lane_Func005C takes nothing returns boolean
if ( ( GetLocationX(GetUnitLoc(GetAttackedUnitBJ())) < GetRectMinX(gg_rct_move_red) ) ) then
return true
endif
if ( ( GetLocationX(GetUnitLoc(GetAttackedUnitBJ())) > GetRectMaxX(gg_rct_move_red) ) ) then
return true
endif
if ( ( GetLocationY(GetUnitLoc(GetAttackedUnitBJ())) < GetRectMinY(gg_rct_move_red) ) ) then
return true
endif
if ( ( GetLocationY(GetUnitLoc(GetAttackedUnitBJ())) > GetRectMaxY(gg_rct_move_red) ) ) then
return true
endif
return false
endfunction
function Trig_Attack_other_lane_Conditions takes nothing returns boolean
if ( not ( GetLocationX(GetUnitLoc(GetAttacker())) >= GetRectMinX(gg_rct_move_red) ) ) then
return false
endif
if ( not ( GetLocationX(GetUnitLoc(GetAttacker())) <= GetRectMaxX(gg_rct_move_red) ) ) then
return false
endif
if ( not ( GetLocationY(GetUnitLoc(GetAttacker())) >= GetRectMinY(gg_rct_move_red) ) ) then
return false
endif
if ( not ( GetLocationY(GetUnitLoc(GetAttacker())) <= GetRectMaxY(gg_rct_move_red) ) ) then
return false
endif
if ( not Trig_Attack_other_lane_Func005C() ) then
return false
endif
return true
endfunction
function Trig_Attack_other_lane_Actions takes nothing returns nothing
call IssueImmediateOrderBJ( GetAttacker(), "stop" )
endfunction
//===========================================================================
function InitTrig_Attack_other_lane takes nothing returns nothing
set gg_trg_Attack_other_lane = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Attack_other_lane, Player(11), EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Attack_other_lane, Condition( function Trig_Attack_other_lane_Conditions ) )
call TriggerAddAction( gg_trg_Attack_other_lane, function Trig_Attack_other_lane_Actions )
endfunction
This is only one of the 9 copies of this trigger that I have (the other copies are for other lanes).
My problem is that as the game progresses, the map gets laggier, fps drops. I did numerous tests and found that this trigger is the problem (removing it solves the fps drop). Every level, the FPS will drop, from 50-60 at lvl 1, to 40-50 at lvl 2 and so on, until it gets unbearable.
I would appreciate if you could explain to me in GUI terms, or tell me what I should do because I dont understand too much of JASS.
Thanks