|
楼主 |
发表于 2012-6-12 00:30:30
|
显示全部楼层
看还有很多人不理解这个的东西,请看图:
还不明白的话我也不知道说什么好了。。。
*Race.mpq中存放自定义种族单位数据;
*Interface文件夹中按序列放置自定义UI mpq包;
*Blizzard.j 中实现种族判断的脚本:(核心为MeleeStartingUnits()这个函数)globals
//... ...
// race constant
constant integer mc_RACE_HUMAN = 1
constant integer mc_RACE_ORC = 2
constant integer mc_RACE_UNDEAD = 3
constant integer mc_RACE_NIGHTELF = 4
constant integer mc_RACE_5 = 5
constant integer mc_RACE_6 = 6
constant integer mc_RACE_7 = 7
constant integer mc_RACE_8 = 8
constant integer mc_RACE_9 = 9
constant integer mc_RACE_10 = 10
endglobals
//====================================================================
function MeleeStartingUnits takes nothing returns nothing
local integer index
local player indexPlayer
local location indexStartLoc
local integer indexRace
set index = 0
loop
set indexPlayer = Player(index)
if (GetPlayerSlotState(indexPlayer) == PLAYER_SLOT_STATE_PLAYING) then
set indexStartLoc = GetStartLocationLoc(GetPlayerStartLocation(indexPlayer))
set indexRace = R2I(GetPlayerHandicapBJ(indexPlayer))
if (indexRace == 100) then
// Player choose Random
else
// indexRace is a integer converted from real, so automatically add 1
set indexRace=indexRace+1
endif
// Debug message, shows each player's choice.
call BJDebugMsg( ( "Player"+I2S(index)+" RaceIndex:" + I2S(indexRace) ) )
// Create initial race-specific starting units
if (indexRace == mc_RACE_HUMAN) then
call MeleeStartingUnitsHuman(indexPlayer, indexStartLoc, true, true, true)
elseif (indexRace == mc_RACE_ORC) then
call MeleeStartingUnitsOrc(indexPlayer, indexStartLoc, true, true, true)
elseif (indexRace == mc_RACE_UNDEAD) then
call MeleeStartingUnitsUndead(indexPlayer, indexStartLoc, true, true, true)
elseif (indexRace == mc_RACE_NIGHTELF) then
call MeleeStartingUnitsNightElf(indexPlayer, indexStartLoc, true, true, true)
elseif (indexRace == mc_RACE_5) then
call MeleeStartingUnitsUnknownRace(indexPlayer, indexStartLoc, true, true, true)
elseif (indexRace == mc_RACE_6) then
call MeleeStartingUnitsUnknownRace(indexPlayer, indexStartLoc, true, true, true)
elseif (indexRace == mc_RACE_7) then
call MeleeStartingUnitsUnknownRace(indexPlayer, indexStartLoc, true, true, true)
elseif (indexRace == mc_RACE_8) then
call MeleeStartingUnitsUnknownRace(indexPlayer, indexStartLoc, true, true, true)
elseif (indexRace == mc_RACE_9) then
call MeleeStartingUnitsUnknownRace(indexPlayer, indexStartLoc, true, true, true)
elseif (indexRace == mc_RACE_10) then
call MeleeStartingUnitsUnknownRace(indexPlayer, indexStartLoc, true, true, true)
else
call MeleeStartingUnitsUnknownRace(indexPlayer, indexStartLoc, true, true, true)
endif
endif
set index = index + 1
exitwhen index == bj_MAX_PLAYERS
endloop
endfunction
-还原玩家handicap为100%,初始化自定义触发都可以在这条函数中完成。
*最后还需要对这三条函数做相应修改:
MeleeStartingAI()
MeleeStartingHeroLimit()
MeleeGetAllyKeyStructureCount()
一个自定义种族MOD完成了。就是这么简单
|
|