DuelPlayer
Member
- Reaction score
- 21
Hmm here is my code for..
yeah and the problem is that there is no message shown when i goes into the region
Please highlight any mistakes I made
Thanks in advance
JASS:
globals
region array Station_Turret_Rect
endglobals
function Trig_Station_Turrets_Condition takes nothing returns boolean
if IsUnitAliveBJ(udg_Station) == true then
if ( ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_ANCIENT) == true ) ) then
return true
endif
if ( ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_SAPPER) == true ) ) then
return true
endif
if ( ( GetTriggerUnit() == udg_AIMain ) ) then
return true
endif
endif
return false
endfunction
function Trig_Station_Turret_Actions takes nothing returns nothing
local integer i = 0
local location l
loop
exitwhen i == 4
set i = i + 1
if GetTriggeringRegion() == Station_Turret_Rect<i> and udg_Station_Turret_Using<i> == Player(PLAYER_NEUTRAL_PASSIVE) and udg_StationLanded == false then
call DisplayTextToPlayer(GetOwningPlayer(GetTriggerUnit()),0,0,"|cFF00FF00Now controlling the turret on station, to fire the turret, issue a move order and when you want to stop using it, walk off the circle .|r")
set l = GetUnitLoc(udg_Station)
set udg_Station_Turret_Using<i> = GetOwningPlayer(GetTriggerUnit())
call SetUnitOwner( udg_Station_Turret<i>, GetOwningPlayer(GetTriggerUnit()), true )
call ShowUnit(udg_Station_Turret<i>, true)
call SelectUnitForPlayerSingle( udg_Station_Turret<i>, GetOwningPlayer(GetTriggerUnit()) )
call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetTriggerUnit()), l, 0 )
call RemoveLocation(l)
else
endif
endloop
endfunction
function Trig_Station_Turret_Actions2 takes nothing returns nothing
local integer i = 0
loop
exitwhen i == 4
set i = i + 1
if GetTriggeringRegion() == Station_Turret_Rect<i> and udg_Station_Turret_Using<i> == GetOwningPlayer(GetTriggerUnit()) then
call DisplayTextToPlayer(GetOwningPlayer(GetTriggerUnit()),0,0,"|cFF00FF00You have stopped using the turret on staton")
set udg_Station_Turret_Using<i> = Player(PLAYER_NEUTRAL_PASSIVE)
call SetUnitOwner( udg_Station_Turret<i>, Player(PLAYER_NEUTRAL_PASSIVE), true )
call ShowUnit(udg_Station_Turret<i>, false)
else
endif
endloop
endfunction
//===========================================================================
function InitTrig_Station_Turret takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger t2 = CreateTrigger()
local integer i = 0
set Station_Turret_Rect[1] = CreateRegion()
set Station_Turret_Rect[2] = CreateRegion()
set Station_Turret_Rect[3] = CreateRegion()
set Station_Turret_Rect[4] = CreateRegion()
call RegionAddRect(Station_Turret_Rect[1],gg_rct_Station_Turret_1)
call RegionAddRect(Station_Turret_Rect[2],gg_rct_Station_Turret_2)
call RegionAddRect(Station_Turret_Rect[3],gg_rct_Station_Turret_3)
call RegionAddRect(Station_Turret_Rect[4],gg_rct_Station_Turret_4)
loop
exitwhen i == 4
set i = i + 1
call TriggerRegisterEnterRegion(t, Station_Turret_Rect<i>, null)
call TriggerRegisterLeaveRegion(t2, Station_Turret_Rect<i>, null)
endloop
call TriggerAddCondition(t, Condition(function Trig_Station_Turrets_Condition))
call TriggerAddCondition(t2, Condition(function Trig_Station_Turrets_Condition))
call TriggerAddAction(t, function Trig_Station_Turret_Actions )
call TriggerAddAction(t2, function Trig_Station_Turret_Actions2 )
endfunction
</i></i></i></i></i></i></i></i></i></i></i></i></i>
yeah and the problem is that there is no message shown when i goes into the region
Please highlight any mistakes I made
Thanks in advance