- Joined
- Jul 18, 2010
- Messages
- 2,377
The uploaded Map contains all classes of Slider (7-11), each is a own Trigger-File.
wex is needed to use the precreated Map.
I changed the Filed "Value - can escape" of all Sliders in Object Editor to "false".
wex is needed to use the precreated Map.
I changed the Filed "Value - can escape" of all Sliders in Object Editor to "false".
JASS:
function InitTrig_Class_Slider takes nothing returns nothing
set udg_Hash = InitHashtable()
//Sliding Intervall = 1/32
set udg_SlidingSpeed = 400.0/32.0
endfunction
JASS:
function selectCar takes nothing returns nothing
local integer uType = LoadInteger(udg_Hash, GetHandleId(GetClickedButton () ),0)
local player p = GetTriggerPlayer()
local integer pStart = GetPlayerStartLocation(p)
local unit car = CreateUnit(p, uType, GetStartLocationX (pStart), GetStartLocationY (pStart), 270)
//Trick
call UnitAddAbility(car, 'Aloc')
call ShowUnit(car, false)
call ShowUnit(car, true)
call UnitRemoveAbility(car, 'Aloc')
//Select car, Move Cam
if ( GetLocalPlayer() == p) then
call PanCameraToTimed(GetUnitX(car),GetUnitY(car),0)
call ClearSelection()
call SelectUnit(car, true)
endif
set car = null
set p = null
endfunction
function initDialog takes nothing returns nothing
local trigger triggerSelectCar = CreateTrigger()
local dialog dia = DialogCreate()
local integer diaId = GetHandleId(dia)
local button but
local integer loopA = 0
//Create Dialog, Buttons and Save UnitTypes onto Buttons
call SaveDialogHandle(udg_Hash, GetHandleId(triggerSelectCar), 0, dia)
set but = DialogAddButton (dia, "Tank [1]", 49) //Asci 49 = "1"
call SaveButtonHandle(udg_Hash, diaId, 0, but)
call SaveInteger(udg_Hash, GetHandleId(but), 0, 'H000')
set but = DialogAddButton (dia, "Bike [2]", 50) //Asci 50 = "2"
call SaveButtonHandle(udg_Hash, diaId, 1, but)
call SaveInteger(udg_Hash, GetHandleId(but), 0, 'H001')
call TriggerRegisterDialogEvent (triggerSelectCar, dia)
call TriggerAddAction(triggerSelectCar, function selectCar)
call DialogSetMessage(dia, "Select a Car")
//Show Dialog to all Players
loop
exitwhen loopA > 11
call DialogDisplay (Player(loopA), dia, true)
set loopA = loopA + 1
endloop
call DestroyTimer( GetExpiredTimer ())
set triggerSelectCar = null
set dia = null
set but = null
endfunction
//===========================================================================
function InitTrig_Class_7 takes nothing returns nothing
//set udg_Hash = InitHashtable()
call TimerStart(CreateTimer(), 0.00, false, function initDialog)
endfunction
JASS:
function timerExpires takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit timerUnit = LoadUnitHandle(udg_Hash,GetHandleId(t),0)
local real x = GetUnitX(timerUnit)
local real y = GetUnitY(timerUnit)
local integer terrainType = GetTerrainType(x,y)
//Paused Units do not slide
if IsUnitPaused(timerUnit) then
return
endif
//Stands on Snow? -> Kill Unit and Timer
if ( terrainType == 'Nsnw') then
call KillUnit(timerUnit)
call PauseTimer(t)
//call DestroyTimer(t)
//call FlushChildHashtable(udg_Hash, GetHandleId(t))
return
endif
//Stands on "Northrend - Ice", "Icerown Glacier - Dark Ice" and "Underground - Lava"?
if ( terrainType == 'Nice' or terrainType == 'Idki' or terrainType == 'Glav') then
call SetUnitPropWindow(timerUnit, 0)
call SetUnitX(timerUnit,x + udg_SlidingSpeed*Cos(GetUnitFacing(timerUnit)*bj_DEGTORAD))
call SetUnitY(timerUnit,y + udg_SlidingSpeed*Sin(GetUnitFacing(timerUnit)*bj_DEGTORAD))
else
call SetUnitPropWindow(timerUnit, GetUnitDefaultPropWindow(timerUnit))
endif
endfunction
function registerSlider takes nothing returns nothing
local timer t
local unit triggerUnit = GetTriggerUnit()
if (GetUnitTypeId(triggerUnit) == 'H000' or GetUnitTypeId(triggerUnit) == 'H001') then
set t = CreateTimer()
call SaveUnitHandle(udg_Hash,GetHandleId(t),0,triggerUnit)
call TimerStart(t, 1.0/32.0, true, function timerExpires)
call SaveTimerHandle(udg_Hash,GetHandleId(triggerUnit),0,t)
endif
set t = null
set triggerUnit = null
endfunction
//===========================================================================
function InitTrig_Class_8 takes nothing returns nothing
local trigger triggerEnter = CreateTrigger()
//set udg_Hash = InitHashtable()
call TriggerRegisterEnterRectSimple( triggerEnter, GetPlayableMapRect() )
call TriggerAddAction(triggerEnter, function registerSlider)
endfunction
JASS:
function steeringCondition takes nothing returns boolean
// move=851986 smart=851971
return (GetUnitTypeId(GetTriggerUnit()) == 'H000' or GetUnitTypeId(GetTriggerUnit()) == 'H001' ) and ( GetIssuedOrderId() == 851986 or GetIssuedOrderId() == 851971)
endfunction
function steeringAction takes nothing returns nothing
local unit triggerUnit = GetTriggerUnit()
local real x = GetUnitX(triggerUnit)
local real y = GetUnitY(triggerUnit)
local real facing = GetUnitFacing(triggerUnit)
local integer terrainType = GetTerrainType(x,y)
if ( terrainType == 'Idki') then
call DisableTrigger(GetTriggeringTrigger())
set facing = facing*bj_DEGTORAD
call IssuePointOrder(triggerUnit, "move", x + 200*Cos(facing), y + 200*Sin(facing))
call EnableTrigger(GetTriggeringTrigger())
else
if ( terrainType == 'Glav') then
call DisableTrigger(GetTriggeringTrigger())
set facing = Atan2(GetOrderPointY() - y, GetOrderPointX() - x)
set facing = facing + bj_PI
call IssuePointOrder(triggerUnit, "move", x + 200*Cos(facing), y + 200*Sin(facing))
call EnableTrigger(GetTriggeringTrigger())
endif
endif
endfunction
//===========================================================================
function InitTrig_Class_9 takes nothing returns nothing
//set udg_Hash = InitHashtable()
set gg_trg_Class_9 = CreateTrigger( )
call TriggerAddAction(gg_trg_Class_9, function steeringAction)
call TriggerAddCondition(gg_trg_Class_9, Condition( function steeringCondition))
call TriggerRegisterAnyUnitEventBJ( gg_trg_Class_9, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
endfunction
JASS:
function ReviveCon takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 'H000' or GetUnitTypeId(GetTriggerUnit()) == 'H001'
endfunction
function Revive takes nothing returns nothing
local player p = GetTriggerPlayer()
local unit hero = GetTriggerUnit()
local integer pStart = GetPlayerStartLocation(p)
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 5, ( GetPlayerName(p) + " died!" ))
call TriggerSleepAction( 3.00 )
call ReviveHero (hero, GetStartLocationX (pStart),GetStartLocationY (pStart), true )
//Select hero, Move Cam
if ( GetLocalPlayer() == p) then
call PanCameraTo(GetUnitX(hero),GetUnitY(hero))
call ClearSelection()
call SelectUnit(hero, true)
endif
call TimerStart(LoadTimerHandle(udg_Hash,GetHandleId(hero),0), 1.0/32.0, true, function timerExpires)
set p = null
set hero = null
endfunction
//===========================================================================
function InitTrig_Class_10 takes nothing returns nothing
set gg_trg_Class_10 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Class_10, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Class_10, Condition( function ReviveCon ) )
call TriggerAddAction( gg_trg_Class_10, function Revive)
endfunction
JASS:
function Win takes nothing returns nothing
local unit hero = GetTriggerUnit()
local player p = GetOwningPlayer(hero)
local group g = CreateGroup()
local unit fog
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 99999, ( GetPlayerName(p) + " won!" ))
call PauseAllUnitsBJ(true)
call GroupEnumUnitsOfPlayer(g, Player(PLAYER_NEUTRAL_AGGRESSIVE), null)
loop
set fog = FirstOfGroup(g)
exitwhen fog == null
call GroupRemoveUnit(g,fog)
call RemoveUnit(fog)
endloop
call DestroyGroup(g)
set hero = null
set g = null
set p = null
endfunction
//===========================================================================
function InitTrig_Class_11 takes nothing returns nothing
local group g = CreateGroup()
local unit fog
set gg_trg_Class_11 = CreateTrigger( )
call TriggerRegisterUnitInRange(gg_trg_Class_11, gg_unit_n000_0001, 90, null)
call TriggerAddAction( gg_trg_Class_11, function Win )
//Make Preplaced Creeps locust
call GroupEnumUnitsOfPlayer(g, Player(PLAYER_NEUTRAL_AGGRESSIVE), null)
loop
set fog = FirstOfGroup(g)
exitwhen fog == null
call GroupRemoveUnit(g,fog)
//Trick
call UnitAddAbility(fog, 'Aloc')
// call ShowUnit(fog, false)
// call ShowUnit(fog, true)
// call UnitRemoveAbility(fog, 'Aloc')
endloop
call DestroyGroup(g)
set g = null
endfunction