I have already posted this script in another thread (in the custom content sub-forum). I did ask for that thread to be moved here to the scripting sub-forum but no moderator seems to noticed that request so I have decided to post my query here. I apologise if anyone is annoyed by there being two separate threads relating to the same issue but the custom content sub-forum is rather quiet and there is more likelihood of a response here.
I have created a module which adds a custom item to Bodahn's inventory in the main single player game. So far everything is working fine and the module functions as desired. I wish to extend this by adding a legendary item codex entry when the item is bought.
I know I need to add the ITEM_ACQUIRED variable to the item itself and set up the codex plot but I have next to no understanding of scripting. I want to try to combine a script from this thread with the script I already have which adds the item to the merchant inventory. I have come up with this:
#include "wrappers_h"
#include "events_h"
#include "plt_ros_bodahn_plot"
#include "plt_ros_acquired_codex"
void main()
{
if ( WR_GetPlotFlag( PLT_ROS_ACQUIRED_CODEX, ROS_ACQUIRED ) == TRUE ) return;
event ev=GetCurrentEvent();
if (GetEventType(ev)==EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED)
{
object oItem=GetEventObject(ev,0);
object oPC=GetEventCreator(ev);
if (GetTag(oItem)=="ring_of_souls")
WR_SetPlotFlag(PLT_ROS_ACQUIRED_CODEX, ROS_ACQUIRED, TRUE);
}
if ( WR_GetPlotFlag( PLT_ROS_BODAHN_PLOT, ROS_ITEM_GIVEN ) == TRUE ) return;
object oStore = GetObjectByTag("store_camp_bodahn");
if (IsObjectValid(oStore))
{
CreateItemOnObject(R"ring_of_souls.uti", oStore, 1, "", TRUE);
WR_SetPlotFlag( PLT_ROS_BODAHN_PLOT, ROS_ITEM_GIVEN, TRUE );
}
}
//---SCRIPT END---
Firstly, because I have such limited knowledge this script could be riddled with errors and schoolboy blunders as far as I know. Secondly, when I try to compile it I get an error report saying that "wrappers_h" requires a "main or StartingConditional". I would be very grateful if someone with scripting expertise could cast their eyes over it and point out any errors.
Legendary Item Codex Entry Script
Débuté par
darrenr22
, juin 22 2010 07:53
#1
Posté 22 juin 2010 - 07:53
#2
Posté 22 juin 2010 - 04:28
I don't know if the party camp area is loaded always so adding the item to Bodahn's store through a module script will not always work. Of course, since you haven't specified a particular event in which the item is added, the item will get added whenever a module event is fired (I suppose). It's cleaner to put that script as a PRCSCR script so it will fire once when the party camp is loaded and the plot flag is not set.
For the codex entry, you could just name your plot (the one currently called ROS_ACQUIRED_CODEX) the same as the item tag (ring_of_souls) and put the plot flag number in the ITEM_CODEX_FLAG variable on the item and set the ITEM_SEND_ACQUIRED_EVENT to 1. You don't need to do anything else as the default code will automatically set the plot flag and you will have the codex entry.
For the codex entry, you could just name your plot (the one currently called ROS_ACQUIRED_CODEX) the same as the item tag (ring_of_souls) and put the plot flag number in the ITEM_CODEX_FLAG variable on the item and set the ITEM_SEND_ACQUIRED_EVENT to 1. You don't need to do anything else as the default code will automatically set the plot flag and you will have the codex entry.
Modifié par TimelordDC, 22 juin 2010 - 04:29 .





Retour en haut






