globals // User-defined unit array udg_Unit real array udg_Magnitude real array udg_Direction integer udg_Index = 0 real array udg_Scalar real array udg_BaseHeight // Generated trigger gg_trg_Physics_Engine = null trigger gg_trg_init = null endglobals //=========================================================================== // // Just another Warcraft III map // // Warcraft III map script // Generated by the Warcraft III World Editor // Date: Tue Dec 19 05:04:12 2006 // Map Author: Unknown // //=========================================================================== //*************************************************************************** //* //* Global Variables //* //*************************************************************************** function InitGlobals takes nothing returns nothing local integer i= 0 set i = 0 loop exitwhen (i > 8192) set udg_Magnitude[i] = 0 set i = i + 1 endloop set i = 0 loop exitwhen (i > 8192) set udg_Direction[i] = 0 set i = i + 1 endloop set udg_Index = 0 set i = 0 loop exitwhen (i > 8192) set udg_Scalar[i] = 0 set i = i + 1 endloop set i = 0 loop exitwhen (i > 8192) set udg_BaseHeight[i] = 0 set i = i + 1 endloop endfunction //*************************************************************************** //* //* Triggers //* //*************************************************************************** //=========================================================================== // Trigger: Physics Engine //=========================================================================== function InitTrig_Physics_Engine takes nothing returns nothing endfunction //******************************************************** //* * //*______________________________________________________* //* Physics Engine by xombie * //* * //*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯* //* -BETA- * //******************************************************** //====================================================================================================== //function VectorAddition takes location vector1, location vector2 returns location //new vector // local real mag1 = GetLocationX(vector1) // local real mag2 = GetLocationX(vector2) // local real dir1 = GetLocationY(vector1) // local real dir2 = GetLocationY(vector2) // local real x1 = mag1 * Cos( dir1 * bj_RADTODEG ) // local real y1 = mag1 * Sin( dir1 * bj_RADTODEG ) // local real x2 = mag2 * Cos( dir2 * bj_RADTODEG ) // local real y2 = mag2 * Sin( dir2 * bj_RADTODEG ) // set x1 = x1+x2 // set y1 = y1+y2 // set x2 = SquareRoot( x1*x1 + y1*y1 ) // set y2 = Atan2(y1,x1)*bj_RADTODEG // return Location(x2, y2) //endfunction //====================================================================================================== function GetNewUnitIndex takes nothing returns integer local integer i= 0 loop exitwhen i==8193 if udg_Unit[i] == null then return i endif set i = i + 1 endloop return 8193 endfunction //====================================================================================================== function GetUnitIndex takes unit u returns integer local integer i= 0 loop exitwhen i==8193 if udg_Unit[i]==u then return i endif set i=i+1 endloop set i = GetNewUnitIndex() if i!=8193 then set udg_Unit[i] = u return i endif return 8193 endfunction //====================================================================================================== function UnitAddVector takes unit whichUnit,real magnitude,real direction returns nothing local real temp1= udg_Magnitude[ GetUnitIndex(whichUnit) ] local real temp2= udg_Direction[ GetUnitIndex(whichUnit) ] local real temp3 local real temp4 set temp3 = temp1 * Cos( temp2 * bj_DEGTORAD ) set temp4 = temp1 * Sin( temp2 * bj_DEGTORAD ) set temp1 = temp3 + (magnitude*Cos(direction*bj_DEGTORAD)) set temp2 = temp4 + (magnitude*Sin(direction*bj_DEGTORAD)) set temp3 = SquareRoot( temp1*temp1 + temp2*temp2 ) set temp4 = Atan2(temp2,temp1)*bj_RADTODEG set udg_Magnitude[ GetUnitIndex(whichUnit) ] = temp3 set udg_Direction[ GetUnitIndex(whichUnit) ] = temp4 endfunction function UnitAddScalar takes unit whichUnit,real scalar returns nothing local real temp1= udg_Scalar[ GetUnitIndex(whichUnit) ] set temp1 = temp1 + scalar set udg_Scalar[ GetUnitIndex(whichUnit) ] = temp1 endfunction //====================================================================================================== function MoveUnit takes unit u,real x,real y returns nothing local rect r= bj_mapInitialPlayableArea local real t= GetRectMaxX(r) if x>t then set x=t else set t=GetRectMinX(r) if xt then set y=t else set t=GetRectMinY(r) if y0 then call UnitAddScalar(u,-0.1) endif if magnitude>1.5 then call MoveUnit( u, x, y ) call SetUnitFacing( u, direction ) //if GetTerrainCliffLevel( GetUnitX(u), GetUnitY(u) ) > r then // call UnitAddVector( u, magnitude, if GetUnitFlyHeight(u)<=0.0 and scalar==0 then call SetUnitFlyHeight(u,0,999999) call UnitAddVector( u, 0.09, direction-180.0 ) endif endif call RemoveLocation(temp) endloop call DestroyGroup(g) set udg_Index = index set temp=null set g=null set u=null endfunction //====================================================================================================== function Physics_Engine_Core_Setup takes nothing returns nothing local timer core= CreateTimer() set udg_Index = 0 call TimerStart(core,0.01,true,function Physics_Engine_Core) set core = null endfunction //=========================================================================== // Trigger: init //=========================================================================== function Trig_init_Actions takes nothing returns nothing call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING ) endfunction //=========================================================================== function InitTrig_init takes nothing returns nothing set gg_trg_init = CreateTrigger( ) call TriggerAddAction( gg_trg_init, function Trig_init_Actions ) endfunction //=========================================================================== function InitCustomTriggers takes nothing returns nothing call InitTrig_Physics_Engine( ) call InitTrig_init( ) endfunction //=========================================================================== function RunInitializationTriggers takes nothing returns nothing call ConditionalTriggerExecute( gg_trg_init ) endfunction //*************************************************************************** //* //* Players //* //*************************************************************************** function InitCustomPlayerSlots takes nothing returns nothing // Player 0 call SetPlayerStartLocation( Player(0), 0 ) call SetPlayerColor( Player(0), ConvertPlayerColor(0) ) call SetPlayerRacePreference( Player(0), RACE_PREF_HUMAN ) call SetPlayerRaceSelectable( Player(0), true ) call SetPlayerController( Player(0), MAP_CONTROL_USER ) endfunction function InitCustomTeams takes nothing returns nothing // Force: TRIGSTR_002 call SetPlayerTeam( Player(0), 0 ) endfunction //*************************************************************************** //* //* Main Initialization //* //*************************************************************************** //=========================================================================== function main takes nothing returns nothing call SetCameraBounds( -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM) ) call SetDayNightModels( "Environment\\DNC\\DNCDalaran\\DNCDalaranTerrain\\DNCDalaranTerrain.mdl", "Environment\\DNC\\DNCDalaran\\DNCDalaranUnit\\DNCDalaranUnit.mdl" ) call NewSoundEnvironment( "Default" ) call SetAmbientDaySound( "DalaranDay" ) call SetAmbientNightSound( "DalaranNight" ) call SetMapMusic( "Music", true, 0 ) call InitBlizzard( ) call InitGlobals( ) call InitCustomTriggers( ) call RunInitializationTriggers( ) endfunction //*************************************************************************** //* //* Map Configuration //* //*************************************************************************** function config takes nothing returns nothing call SetMapName( "Just another Warcraft III map" ) call SetMapDescription( "Nondescript" ) call SetPlayers( 1 ) call SetTeams( 1 ) call SetGamePlacement( MAP_PLACEMENT_USE_MAP_SETTINGS ) call DefineStartLocation( 0, 0.0, -256.0 ) // Player setup call InitCustomPlayerSlots( ) call SetPlayerSlotAvailable( Player(0), MAP_CONTROL_USER ) call InitGenericPlayerSlots( ) endfunction