|
发表于 2008-2-10 11:08:09
|
显示全部楼层
虽然威望不够,但是能看到Jass就行了,呵呵~~~~
能看得懂J文又没有威望的来这里看吧
[codes=jass]
//-----------------------------------------------------
//
//总的原理是,当一个单位离开一个区域时
//用SetUnitX和SetUnitY将单位移动到镜头的另一侧。
//我解密的时候为了可读性,修改了大部分变量和函数的名字,
//并合并了两个函数,加入了一部分注释
//
//当然,仅仅依靠这个脚本,会让玩家看出来
//所以在制作地形上也要下功夫
globals
real udg_z=165 //这个初值貌似没有必要,在初始化触发器的时候又被赋值了
location udg_p=null
location udg_tp=null
trigger Trigger1=CreateTrigger()
trigger Trigger2=CreateTrigger()
trigger Trigger3=CreateTrigger()
trigger Trigger4=CreateTrigger()
rect Rect1
rect Rect2
unit udg_u//就是这个演示的主角了
camerasetup Camera=CreateCameraSetup()
endglobals
function delp takes nothing returns nothing
set udg_tp=GetUnitLoc(udg_u)
set udg_p=PolarProjectionBJ(udg_tp,900.,udg_z)
call SetCameraFieldForPlayer(Player(0),CAMERA_FIELD_ROTATION,GetUnitFacing(udg_u),2.)
call IssuePointOrderByIdLoc(udg_u,851986,udg_p)
call RemoveLocation(udg_tp)
call RemoveLocation(udg_p)
endfunction
function Init takes nothing returns nothing
//电影模式
call CinematicModeBJ(true,bj_FORCE_ALL_PLAYERS)
//创建迷雾效果
call EnableWorldFogBoundaryBJ(false,bj_FORCE_ALL_PLAYERS)
call CreateFogModifierRectBJ(true,Player(0),FOG_OF_WAR_VISIBLE,GetWorldBounds())
call SetTerrainFogEx(0,500.,2700.,0,1,1,1)
//设置天空模型
call SetSkyModel("Environment\\\\Sky\\\\BlizzardSky\\\\BlizzardSky.mdl")
call CameraSetupApplyForceDuration(Camera,true,1.)
call delp()
set udg_z=GetUnitFacing(udg_u)
call SetCameraFieldForPlayer(Player(0),CAMERA_FIELD_ROTATION,udg_z,1.)
call SetCameraTargetControllerNoZForPlayer(Player(0),udg_u,0,0,false)
endfunction
function SetX takes nothing returns nothing
call SetUnitX(GetTriggerUnit(),(GetUnitX(GetTriggerUnit())-((RAbsBJ(GetUnitX(GetTriggerUnit()))/GetUnitX(GetTriggerUnit()))*8192.)))
call delp()
endfunction
function SetY takes nothing returns nothing
call SetUnitY(GetTriggerUnit(),(GetUnitY(GetTriggerUnit())-((RAbsBJ(GetUnitY(GetTriggerUnit()))/GetUnitY(GetTriggerUnit()))*8192.)))
call delp()
endfunction
function Action4 takes nothing returns nothing
set udg_z=I2R(GetRandomInt(163,168))
call delp()
endfunction
function InitCustomTeams takes nothing returns nothing
call SetPlayerTeam(Player(0),0)
endfunction
function main takes nothing returns nothing
//---------------------------------------------
//游戏初始化
//---------------------------------------------
//与这个系统没有关系
local weathereffect we
local player p
local unit u
local integer unitID
local trigger t
local real life
call SetCameraBounds(-4736.+GetCameraMargin(CAMERA_MARGIN_LEFT),-4480.+GetCameraMargin(CAMERA_MARGIN_BOTTOM),4736.-GetCameraMargin(CAMERA_MARGIN_RIGHT),4480.-GetCameraMargin(CAMERA_MARGIN_TOP),-4736.+GetCameraMargin(CAMERA_MARGIN_LEFT),4480.-GetCameraMargin(CAMERA_MARGIN_TOP),4736.-GetCameraMargin(CAMERA_MARGIN_RIGHT),-4480.+GetCameraMargin(CAMERA_MARGIN_BOTTOM))
call SetDayNightModels("Environment\\\\DNC\\\\DNCLordaeron\\\\DNCLordaeronTerrain\\\\DNCLordaeronTerrain.mdl","Environment\\\\DNC\\\\DNCLordaeron\\\\DNCLordaeronUnit\\\\DNCLordaeronUnit.mdl")
call NewSoundEnvironment("Default")
call SetAmbientDaySound("LordaeronSummerDay")
call SetAmbientNightSound("LordaeronSummerNight")
call SetMapMusic("Music",true,0)
call CameraSetupSetField(Camera,CAMERA_FIELD_ZOFFSET,300.,.0)
call CameraSetupSetField(Camera,CAMERA_FIELD_ROTATION,270.,.0)
call CameraSetupSetField(Camera,CAMERA_FIELD_ANGLE_OF_ATTACK,322.2,.0)
call CameraSetupSetField(Camera,CAMERA_FIELD_TARGET_DISTANCE,1024.5,.0)
call CameraSetupSetField(Camera,CAMERA_FIELD_ROLL,.0,.0)
call CameraSetupSetField(Camera,CAMERA_FIELD_FIELD_OF_VIEW,70.,.0)
call CameraSetupSetField(Camera,CAMERA_FIELD_FARZ,3000.,.0)
call CameraSetupSetDestPosition(Camera,-673.5,1638.4,.0)
//------------------------------------------------
//创造单位
//------------------------------------------------
set p=Player(0)
set udg_u=CreateUnit(p,'hdhw',3593.6,-3908.5,155.)
//主角在这里登场
call InitBlizzard()
//------------------------------------------------
//初始化区域变量
//------------------------------------------------
set Rect1=Rect(-4096.,-5504.,4096.,5632.)
set Rect2=Rect(-5728.,-4096.,5632.,4096.)
//从地图正上看,Rect1是立着的长方形,Rect2是躺着的长方形
//两个区域的公共区域是一个正方形
//也就是我们实际用到的地图区域
//------------------------------------------------
//创建触发器
//------------------------------------------------
//------------------------------------------------
//没有事件,准确的说是地图初始化
call TriggerAddAction(Trigger1,function Init)
//动作是开启电影模式
//------------------------------------------------
//这个事件是玩家离开区域
call TriggerRegisterLeaveRectSimple(Trigger2,Rect1)
call TriggerAddAction(Trigger2,function SetX)
//离开这个区域则马上调整单位的X坐标
//如果单位从左离开这个区域,则调整单位的X坐标到区域的最右侧
//反之亦然
//------------------------------------------------
//这个事件是玩家离开区域
call TriggerRegisterLeaveRectSimple(Trigger3,Rect2)
call TriggerAddAction(Trigger3,function SetY)
//离开这个区域则马上调整单位的Y坐标
//如果单位从又离开这个区域,则调整单位的Y坐标到区域的最左侧
//反之亦然
//------------------------------------------------
//这个事件是每2.5秒运行一次
call TriggerRegisterTimerEventPeriodic(Trigger4,2.5)
call TriggerAddAction(Trigger4,function Action4)
//随机调整主角的下一个移动大方向
//------------------------------------------------
//Trigger1是初始化的触发器 ,直接执行
call ConditionalTriggerExecute(Trigger1)
endfunction
function config takes nothing returns nothing
call SetMapName("TRIGSTR_001")
call SetMapDescription("TRIGSTR_003")
call SetPlayers(1)
call SetTeams(1)
call SetGamePlacement(MAP_PLACEMENT_USE_MAP_SETTINGS)
call DefineStartLocation(0,256.,-64.)
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)
call SetPlayerSlotAvailable(Player(0),MAP_CONTROL_USER)
call InitGenericPlayerSlots()
endfunction
[/codes] |
|