模组内玩家人物产生教学:
一般刚创立的模组(Module)没有事件脚本(Script)来启动玩家创立人物,要让玩家可以使用DA内建的创立人物介面,可以使用以下的模组事件脚本来达到效果。
请先创立一个脚本,然后在脚本内输入以下的脚本,之后打开模组属性(档案-> 管理模组-> 属性)将Script 选择你创立的以下脚本资源即可
编码: :
#include "events_h"
#include "global_objects_h"
void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev); //extract event type from current event
int nEventHandled = FALSE; //keep track of whether the event has been handled
switch(nEventType)
{
case EVENT_TYPE_MODULE_START:
{
PreloadCharGen(); //preloads resources needed for character generation
StartCharGen(GetHero(),0); //initiates character generation
break;
}
}
if (!nEventHandled) //If this event wasn't handled by this script, let the core script try
{
HandleEvent(ev, RESOURCE_script_MODULE_CORE);
}
}
另一个快速的方法跳过人物产生介面
编码:
#include "sys_chargen_h"
#include "utility_h"
...
case EVENT_TYPE_MODULE_START:
{
// skip character generation
object oHero = GetHero();
Chargen_InitializeCharacter(oHero);
Chargen_SelectGender(oHero,GENDER_MALE);
Chargen_SelectRace(oHero,RACE_HUMAN);
Chargen_SelectCoreClass(oHero,CLASS_WARRIOR);
Chargen_SelectBackground(oHero,BACKGROUND_NOBLE);