PRCSCR Script Templates/ru

From Dragon Age Toolset Wiki
< PRCSCR Script Templates
Revision as of 06:58, 4 June 2012 by Kelamor (Talk | contribs) (Небольшие правки)

Jump to: navigation, search
Шаблоны скриптов PRCSCR
Начало / Русская DA Builder Wiki / Поделиться ВКонтакте

На этой странице собираются скрипты, готовые к использованию в системе PRCSCR в сочетании с M2DA-файлом PRCSCR.

Ссылки:


Содержание:

- Размещение объекта на локации - Этот скрипт позволяет разместить объект на загружаемой локации.
- Размещение НПС на локации - Этот скрипт позволяет разместить НПС на загружаемой локации.
- Активация локации на карте мира - Этот скрипт позволяет активировать иконку локации на карте мира.
- Добавление вещей в инвентарь - Этот скрипт позволяет добавить любую вещь в инвентарь игрока.
- Добавление вещей торговцу или в контейнер - Этот скрипт позволяет добавлять предметы существующим на локации торговцам или в контейнеры.
- Adding a Working Door into an existing Area - This Script serves to add a custom Door into a existing Area, that the Player can enter into a custom Area.
- Adding a Quest to an existing Chanters Board - This Script serves to add a new Quest to a existing Chanters Board, at any chosen time into the Game.


Размещение объекта на локации

Требования к PRCSCR-файлу:

  1. "AreaListName" не может быть "any". Укажите определённую локацию.
  2. Скопируйте PRCSCR-файл в папку "override" вашего модуля.

Скрипт: (пример взят из мода "Storage Chest", созданного одним из сотрудников Bioware)

const string TAL_IP_STORAGE_CHEST = "tal_ip_storage_chest";
const resource TAL_RESOURCE_IP_STORAGE_CHEST = R"tal_ip_storage_chest.utp";
 
void main()
{
    object oMainControlled = GetMainControlled();
    // ПРОВЕРЯЕМ, ЕСТЬ ЛИ В ЛОКАЦИИ  ОБЪЕКТ С ТАКИМ ТЕГОМ 
    object oChest = UT_GetNearestObjectByTag(oMainControlled, TAL_IP_STORAGE_CHEST);
 
    //DisplayFloatyMessage(oMainControlled, "Storage script working", FLOATY_MESSAGE, 16777215, 30.0);
 
    // ЕСЛИ ТАКОГО ОБЪЕКТА ЕЩЁ НЕТ, ТО СОЗДАЁМ ЕГО
    if (!IsObjectValid(oChest))
    {
        location lSpawn = Location(GetArea(oMainControlled), Vector(148.77, 117.68, -0.94), 0.0);
        CreateObject(OBJECT_TYPE_PLACEABLE, TAL_RESOURCE_IP_STORAGE_CHEST, lSpawn);          
 
        //DisplayFloatyMessage(oMainControlled, "Storage script working", FLOATY_MESSAGE, 16777215, 30.0);
    }
}
  1. Замените "tal_ip_storage_chest" в 1-й строке на тэг объекта, который вы хотите разместить (обязательно в нижнем регистре).
  2. Замените "tal_ip_storage_chest.utp" во 2-й строке на имя файла вашего объекта.
  3. В 13-ой строке укажите координаты, по которым будет размещён объект. Как определить координаты? В следующем пункте.
  4. Создайте временный дубликат локации (можете и в оригинале сделать, но не сохраняйте изменения) и поместите объект в нужное место (впоследствии не экспортируйте изменённую локацию).
  5. В инспекторе свойств объекта найдите свойство "Position". Это координаты позиции объекта, замените на них числа в скобках за словом "Vector".
  6. В инспекторе свойств объекта найдите свойство "Rotation" (вращение). Это свойство определяет то, куда объект направлен своим фэйсом. На значение этого свойства поменяйте третий аргумент процедуры "Location". Правда перед его указанием в скрипте это свойство надо пересчитать (kelamor - не понял как). For positive angles do (180-angle). For negative angles do (-180-(-angle)).

Далее экспортируете скрипт, объект и запускаете игру. Когда вы войдёте в локацию, с которой ассоциируете этот скрипт, ваш объект появится в нужном месте.

Примечание:

  • Данный метод позволяет избежать дублирования объектов на локации с помощью функции "IsObjectValid". Такого же результат можно добиться и с помощью Plot-файла.
  • Если база не русифицирована, то удалите из скрипта русские примечания.
  • Для проверки работы скрипта можно раскомментировать строки с функцией "DisplayFloatyMessage". Тогда скрипт сообщит вам при срабатывании - "Storage script working", и при создании объекта - "Storage script working".
  • При указании числовых значений в функции "Location" обязательно указывайте с точностью до сотых и обязательно с точкой. Если в инспекторе объекта целое число, то добавьте к нему ".00".

Размещение НПС на локации

M2DA Setup:

  1. AreaListName must be "any". This Script is Plot driven.
  2. Copy the GDA into your modules override folder.

Script:

// this is the name of a precreated plot file "joblos_quest" prefixed with the special "plt_"
// "plt_" + quest name allows you to reference the flag names as constants.
#include "plt_joblos_quest" 
#include "wrappers_h"
 
void main()
{
    //Check whether we've added Joblo already.
    if (WR_GetPlotFlag(PLT_JOBLOS_QUEST, JOBLO_ADDED_TO_TOWN) == FALSE)
    {
        object oTown = GetObjectByTag("lot100ar_lothering"); //An area's tag is the same as its resource name
        vector vJobloLocation = Vector(126.745f, 120.724f, 0.460568f); // See below for how to get these coordinates
 
        CreateObject(
            OBJECT_TYPE_CREATURE,
            R"joblo.utc",
            Location(oTown, vJobloLocation, 180.0f) //See below for how to get the value for orientation
        ); //this semicolom was missing and caused errors 
 
        WR_SetPlotFlag("joblos_quest", JOBLO_ADDED_TO_TOWN, TRUE);
    }
}
  1. Replace "joblos_quest" (3x) with the name of your Plot.
  2. Replace "JOBLO_ADDED_TO_TOWN" (2x) with a custom Flag you create in your Plot.
  3. Replace "lot100ar_lothering" with the Tag of an Area ,the NPC should spawn in.
  4. Replace "joblo.utc" with the filename of your Creature.
  5. Exchange the (4) numbers ,which should be the location of your placable. How to determine?
  6. Create a temporary duplicate of the specific Area, and add the NPC until you see fit. (delete this Area afterwards, do not export)
  7. Note down the numbers in the Object Inspector, and get the first 3 numbers of Position, and the 4rth Number from Rotation. (only 1 number, the first)
  8. Rotation needs to be recalculated before entering it into the script. For positive angles do (180-angle). For negative angles do (-180-(-angle)).

Export the script, the creature ,and start the game. When you arrive at the specific Area in game, the Creature (Monsters or NPCs alike) will be there.

Активация локации на карте мира

Requirements: Your module must extend Single Player.

M2DA Setup:

  1. AreaListName must be "any". Because Waypoint activation should be universal and it is Plot driven.
  2. Copy the GDA into your modules override folder.

Script:

const string WML_WOW_Custom = "eshmeswp";
#include "plt_mnp000pt_main_events"
#include "wrappers_h"
void main()
{
    if(WR_GetPlotFlag( PLT_MNP000PT_MAIN_EVENTS, ARCHDEMON_EVENT_ONE) == TRUE )
    {
        WR_SetWorldMapLocationStatus(GetObjectByTag(WML_WOW_Custom), WM_LOCATION_ACTIVE);
    }
}
  1. Replace "eshmeswp" in the 1st line with the "Tag" of your Waypoint (Map Pin) which u created. That Map Pin can be greyed out or inactive or so. Map Pin information can be found at: Map.

Export the script, the Map ,and start the game. The Waypoint will now be activated once you leave Lothering, just like the other main Waypoints. This is to get in line with the Story. However to change the time of it happening..

  1. Choose which Plot should activate the Waypoint. The above example uses the Archdemon quest, when your nightmare triggers for example.
  2. Exchange "mnp000pt_main_events" in the 2nd and 6th line with the name of that other Plot. Leaving the "plt_" there.
  3. Exchange "ARCHDEMON_EVENT_ONE" with a "Flag" of your choice from that Plot.

This "should" work for any plot. Actually, waypoints dont need all this PRCSCR stuff and can be set "Active" in the first place. But the above example is to get in line with the Main Campaign, and potential gamebreaking Plot conflicts if able to leave Lothering too early.

Добавление вещей в инвентарь

Requirements:

M2DA Setup:

  1. AreaListName is "any".
  2. Copy the GDA into your modules override folder.

Script:

//include utility_h for the UT_AddItemToInventory() function.
#include "utility_h"
//include the custom made plot file
#include "plt_$plot_file_name$"
 
void main()
{
    // If plot flag is TRUE then item already given.
    // Otherwise add item to inventory.
    if ( WR_GetPlotFlag( PLT_$plot_file_name$, $check_flag_name$ ) == FALSE )
    {
        UT_AddItemToInventory(R"$item_file_name$.uti");
        //Set the plot flag to TRUE to indicate that the item was given.
        WR_SetPlotFlag( PLT_$plot_file_name$, $check_flag_name$, TRUE );
    }
}
  1. Replace everything between and including the $ signs with appropriate names (without the file extensions).

Adding an Item to an existing Vendor or Container

Requirements:

M2DA Setup:

Campaign Container ContainerTag AreaListName
Origins Bodahn store_camp_bodahn cam100ar_camp_plains
Origins daytime King's Camp quartermaster pre100sr_quartermaster pre01al_kings_camp
Awakening Yuriah store_vgk100cr_merchant vgk210ar_throne_room
Awakening Party Chest in Vigil's Keep vgk210ip_party_chest vgk210ar_throne_room
Leliana's Song first Lem encounter store_lel00cr_lem lel100ar_market
  1. Create a PRCSCR M2DA override using the desired AreaListName from the above table
  2. Copy this new PRCSCR M2DA into your module's override folder (AddIns\{YourMod}\core\override)

Script:

#include "wrappers_h"
#include "plt_$plot_file_name$"  // include your custom plot
 
void main()
{
  if ( WR_GetPlotFlag( PLT_$plot_file_name$, $check_flag_name$ ) == TRUE ) return;
 
  object oContainer = GetObjectByTag($ContainerTag$);
 
  if (IsObjectValid(oContainer))
  {
    CreateItemOnObject(R"$resource_name$.uti", oContainer, 1, "", TRUE); // repeat this for each item
 
    WR_SetPlotFlag( PLT_$plot_file_name$, $check_flag_name$, TRUE );
  }
}
  1. Replace "$plot_file_name$" and "$check_flag_name$" with the custom plot and plot flags you create for your module.
  2. Replace "$resource_name$" with the resource name of your custom item.
  3. Replace "$ContainerTag$" with the desired container tag from the table in the M2DA setup section.
  4. The very first time you go to the party camp in Origins (after leaving Lothering) and view the Archdemon cutscene, this script will NOT run when using "cam100ar_camp_plains" as the AreaListName. This is because the cutscene version of the camp is actually a different area. In this case you must exit and return to the "normal" (non-cutscene) party camp for the script to run for the first time.

Adding a Working Door into an existing Area

Requirements:

M2DA Setup:

Script: [Undocumented]

Adding a Quest to an existing Chanters Board

Requirements:

M2DA Setup:

Script: [Undocumented]


Язык: English  • русский