Difference between revisions of "Playing custom Player Character"

From Dragon Age Toolset Wiki
Jump to: navigation, search
(Plot file)
(Module script)
Line 20: Line 20:
 
This is script of your module
 
This is script of your module
  
 +
//::///////////////////////////////////////////////
 +
//:: Module Template
 +
//:: Copyright (c) 2003 Bioware Corp.
 +
//:://////////////////////////////////////////////
 +
/*
 +
    Module events
 +
*/
 +
//:://////////////////////////////////////////////
 +
//:: Created By:
 +
//:: Created On:
 +
//:://////////////////////////////////////////////
 +
 +
#include "log_h"
 +
#include "utility_h"
 +
#include "wrappers_h"
 +
#include "events_h"
 +
 +
#include "sys_chargen_h"
 +
#include "sys_rewards_h"
 +
 +
const int FORCE_AUTOLEVEL = 0;  //to turn autolevel off
 +
 +
void main()
 +
{
 +
    event ev = GetCurrentEvent();
 +
    int nEventType = GetEventType(ev);
 +
    string sDebug;
 +
    object oPC = GetHero();
 +
    object oParty = GetParty(oPC);
 +
    int nEventHandled = FALSE;
 +
 +
    switch(nEventType)
 +
    {
 +
        ////////////////////////////////////////////////////////////////////////
 +
        // Sent by: The engine
 +
        // When: The module starts. This can happen only once for a single
 +
        //      game instance.
 +
        ////////////////////////////////////////////////////////////////////////
 +
        case EVENT_TYPE_MODULE_START:
 +
        {
 +
 +
            //normally we would go trough chargen
 +
            //PreloadCharGen();
 +
            //StartCharGen(GetHero());
 +
 +
            //but since we have fixed hero
 +
            object oHero = GetHero();
 +
 +
            // skip character generation and set some defaults
 +
            Chargen_InitializeCharacter(oHero);
 +
            Chargen_SelectGender(oHero, GENDER_FEMALE);
 +
            Chargen_SelectRace(oHero, RACE_HUMAN);
 +
            Chargen_SelectCoreClass(oHero,CLASS_ROGUE);
 +
            Chargen_SelectBackground(oHero, BACKGROUND_NOBLE);
 +
 +
            //give hero a name
 +
            SetName(oHero, "Ariana");
 +
 +
            //manually give the player some equipment
 +
            //EquipItem(oHero, UT_AddItemToInventory(R"gen_im_arm_cht_lgt_new.uti"));
 +
 +
            //or create your fixed character as template and then transfer everything on player.
 +
            LoadItemsFromTemplate(oHero, "lpt_000c_ariana.utc", TRUE);
 +
 +
            //NOTE!
 +
            //to get player appereance as you like, you must create blank char with desired facemorph
 +
            //then after export copy that char to "default_player.utc" in your module override directory
 +
            //so now this will be default char instead JADEN
 +
 +
            // lets go level 10 and set autolevel to off
 +
            RewardXP(oHero, RW_GetXPNeededForLevel(10), FALSE, FALSE);
 +
            SetAutoLevelUp(oHero, FORCE_AUTOLEVEL);
 +
 +
            PrintToLog("------> MODULE START - Ariana created");
 +
 +
            break;
 +
        }
 +
        ////////////////////////////////////////////////////////////////////////
 +
        // Sent by: The engine
 +
        // When: The module loads from a save game. This event can fire more than
 +
        //      once for a single module or game instance.
 +
        ////////////////////////////////////////////////////////////////////////
 +
        case EVENT_TYPE_MODULE_LOAD:
 +
        {
 +
            break;
 +
        }
 +
    ////////////////////////////////////////////////////////////////////////
 +
        // Sent by: The engine
 +
        // When: A player enters the module
 +
        ////////////////////////////////////////////////////////////////////////
 +
        case EVENT_TYPE_ENTER:
 +
        {
 +
            object oCreature = GetEventCreator(ev);
 +
 +
            break;
 +
        }
 +
    ////////////////////////////////////////////////////////////////////////
 +
        // Sent by: The engine
 +
        // When: the player clicks on a destination in the world map
 +
        ////////////////////////////////////////////////////////////////////////
 +
        case EVENT_TYPE_WORLD_MAP_USED:
 +
        {
 +
            int nFrom = GetEventInteger(ev, 0); // travel start location
 +
            int nTo = GetEventInteger(ev, 1); // travel target location
 +
            break;
 +
        }
 +
    }
 +
    if (!nEventHandled)
 +
    {
 +
        HandleEvent(ev, RESOURCE_SCRIPT_MODULE_CORE);
 +
    }
 +
}
  
 
== Area scipt ==
 
== Area scipt ==

Revision as of 04:33, 15 July 2014

Author: dr. dummie

This tutorial:

  • Allows you to play custom character.
  • Start your module with cutscene.
  • Allows you to create character 10 lvl and set it's characteristics as you want.


Characters

Plot file

You need to create plot file of your module

There is only one

Module script

This is script of your module

//:://///////////////////////////////////////////// //:: Module Template //:: Copyright (c) 2003 Bioware Corp. //::////////////////////////////////////////////// /*

   Module events
  • /

//::////////////////////////////////////////////// //:: Created By: //:: Created On: //:://////////////////////////////////////////////

  1. include "log_h"
  2. include "utility_h"
  3. include "wrappers_h"
  4. include "events_h"
  1. include "sys_chargen_h"
  2. include "sys_rewards_h"

const int FORCE_AUTOLEVEL = 0; //to turn autolevel off

void main() {

   event ev = GetCurrentEvent();
   int nEventType = GetEventType(ev);
   string sDebug;
   object oPC = GetHero();
   object oParty = GetParty(oPC);
   int nEventHandled = FALSE;
   switch(nEventType)
   {
       ////////////////////////////////////////////////////////////////////////
       // Sent by: The engine
       // When: The module starts. This can happen only once for a single
       //       game instance.
       ////////////////////////////////////////////////////////////////////////
       case EVENT_TYPE_MODULE_START:
       {
           //normally we would go trough chargen
           //PreloadCharGen();
           //StartCharGen(GetHero());
           //but since we have fixed hero
           object oHero = GetHero();
           // skip character generation and set some defaults
           Chargen_InitializeCharacter(oHero);
           Chargen_SelectGender(oHero, GENDER_FEMALE);
           Chargen_SelectRace(oHero, RACE_HUMAN);
           Chargen_SelectCoreClass(oHero,CLASS_ROGUE);
           Chargen_SelectBackground(oHero, BACKGROUND_NOBLE);
           //give hero a name
           SetName(oHero, "Ariana");
           //manually give the player some equipment
           //EquipItem(oHero, UT_AddItemToInventory(R"gen_im_arm_cht_lgt_new.uti"));
           //or create your fixed character as template and then transfer everything on player.
           LoadItemsFromTemplate(oHero, "lpt_000c_ariana.utc", TRUE);
           //NOTE!
           //to get player appereance as you like, you must create blank char with desired facemorph
           //then after export copy that char to "default_player.utc" in your module override directory
           //so now this will be default char instead JADEN
           // lets go level 10 and set autolevel to off
           RewardXP(oHero, RW_GetXPNeededForLevel(10), FALSE, FALSE);
           SetAutoLevelUp(oHero, FORCE_AUTOLEVEL);
           PrintToLog("------> MODULE START - Ariana created");
           break;
       }
       ////////////////////////////////////////////////////////////////////////
       // Sent by: The engine
       // When: The module loads from a save game. This event can fire more than
       //       once for a single module or game instance.
       ////////////////////////////////////////////////////////////////////////
       case EVENT_TYPE_MODULE_LOAD:
       {
           break;
       }
   ////////////////////////////////////////////////////////////////////////
       // Sent by: The engine
       // When: A player enters the module
       ////////////////////////////////////////////////////////////////////////
       case EVENT_TYPE_ENTER:
       {
           object oCreature = GetEventCreator(ev);
           break;
       }
   ////////////////////////////////////////////////////////////////////////
       // Sent by: The engine
       // When: the player clicks on a destination in the world map
       ////////////////////////////////////////////////////////////////////////
       case EVENT_TYPE_WORLD_MAP_USED:
       {
           int nFrom = GetEventInteger(ev, 0); // travel start location
           int nTo = GetEventInteger(ev, 1); // travel target location
           break;
       }
   }
   if (!nEventHandled)
   {
       HandleEvent(ev, RESOURCE_SCRIPT_MODULE_CORE);
   }

}

Area scipt

This is script of your starting area