Well I have recently got into the toolset, everything is coming fairly nicely, but having a little trouble with adding party members. When i run this script (by changing a plot to true in a conversation) using toolset 1.0.1008.0. On another note, I have no idea how to make killing an enemy trigger a plot.
The script im trying to use to add the follower is the following;
/////////QuestSCripts/////////
#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "plot_h"
#include "plt_questa"
#include "deadswamp_constants"
void main()
{
}
int StartingConditional()
{
event eParms = GetCurrentEvent(); // Contains all input parameters
int nType = GetEventType(eParms); // GET or SET call
string strPlot = GetEventString(eParms, 0); // Plot GUID
int nFlag = GetEventInteger(eParms, 1); // The bit flag # being affected
object oParty = GetEventCreator(eParms); // The owner of the plot table for this script
object oConversationOwner = GetEventObject(eParms, 0); // Owner on the conversation, if any
int nResult = FALSE; // used to return value for DEFINED GET events
object oPC = GetHero();
plot_GlobalPlotHandler(eParms); // any global plot operations
if(nType == EVENT_TYPE_SET_PLOT) // actions -> normal flags only
{
int nValue = GetEventInteger(eParms, 2);
int nOldValue = GetEventInteger(eParms, 3);
switch(nFlag)
{
case JANICA_JOIN:
{ object ojanica = UT_GetNearestCreatureByTag(oPC, janica);
SetPlotGiver(ojanica, FALSE);
SetPlot(ojanica, FALSE);
UT_HireFollower(ojanica);
break;
}
case REWARD_RECIEVED:
{
UT_AddItemToInventory(LLVT_STAFREWARD);
break;
}
}
}
plot_OutputDefinedFlag(eParms, nResult);
return nResult;
}
Trouble with adding NPC as a Follower
Débuté par
FinalSquall
, avril 03 2010 03:24
#1
Posté 03 avril 2010 - 03:24
#2
Posté 03 avril 2010 - 04:20
You should use the scripts in the wiki - there is a tutorial on how to work followers. I have used them without any trouble.
#3
Posté 03 avril 2010 - 04:32
Hmm ok, they didnt seem to work for me. When i Use
if(IsPlayer(oCreature)) {
object oFollower = GetObjectByTag("myfollower");
UT_HireFollower(oCreature, oFollower);
}Which is the script from the wiki
/////////QuestSCripts/////////
#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "plot_h"
#include "plt_questa"
#include "deadswamp_constants"
void main()
{
}
int StartingConditional()
{
event eParms = GetCurrentEvent(); // Contains all input parameters
int nType = GetEventType(eParms); // GET or SET call
string strPlot = GetEventString(eParms, 0); // Plot GUID
int nFlag = GetEventInteger(eParms, 1); // The bit flag # being affected
object oParty = GetEventCreator(eParms); // The owner of the plot table for this script
object oConversationOwner = GetEventObject(eParms, 0); // Owner on the conversation, if any
int nResult = FALSE; // used to return value for DEFINED GET events
object oPC = GetHero();
plot_GlobalPlotHandler(eParms); // any global plot operations
if(nType == EVENT_TYPE_SET_PLOT) // actions -> normal flags only
{
int nValue = GetEventInteger(eParms, 2);
int nOldValue = GetEventInteger(eParms, 3);
switch(nFlag)
{
case JANICA_JOIN:
if(IsPlayer(ojanica)) {
object oJanica = GetObjectByTag("janica");
UT_HireFollower(ojanica, ojanica);
}
}
case REWARD_RECIEVED:
{
UT_AddItemToInventory(LLVT_STAFREWARD);
break;
}
}
}
plot_OutputDefinedFlag(eParms, nResult);
return nResult;
}
I get this error: E: 17:31:34 - questscript.nss - questscript.nss(38): No right bracket on expression
Additionally couldnt find how to make killing an enemy trigger a flag on the wiki, its very unclear tbh.
if(IsPlayer(oCreature)) {
object oFollower = GetObjectByTag("myfollower");
UT_HireFollower(oCreature, oFollower);
}Which is the script from the wiki
/////////QuestSCripts/////////
#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "plot_h"
#include "plt_questa"
#include "deadswamp_constants"
void main()
{
}
int StartingConditional()
{
event eParms = GetCurrentEvent(); // Contains all input parameters
int nType = GetEventType(eParms); // GET or SET call
string strPlot = GetEventString(eParms, 0); // Plot GUID
int nFlag = GetEventInteger(eParms, 1); // The bit flag # being affected
object oParty = GetEventCreator(eParms); // The owner of the plot table for this script
object oConversationOwner = GetEventObject(eParms, 0); // Owner on the conversation, if any
int nResult = FALSE; // used to return value for DEFINED GET events
object oPC = GetHero();
plot_GlobalPlotHandler(eParms); // any global plot operations
if(nType == EVENT_TYPE_SET_PLOT) // actions -> normal flags only
{
int nValue = GetEventInteger(eParms, 2);
int nOldValue = GetEventInteger(eParms, 3);
switch(nFlag)
{
case JANICA_JOIN:
if(IsPlayer(ojanica)) {
object oJanica = GetObjectByTag("janica");
UT_HireFollower(ojanica, ojanica);
}
}
case REWARD_RECIEVED:
{
UT_AddItemToInventory(LLVT_STAFREWARD);
break;
}
}
}
plot_OutputDefinedFlag(eParms, nResult);
return nResult;
}
I get this error: E: 17:31:34 - questscript.nss - questscript.nss(38): No right bracket on expression
Additionally couldnt find how to make killing an enemy trigger a flag on the wiki, its very unclear tbh.
Modifié par FinalSquall, 03 avril 2010 - 04:35 .
#4
Posté 03 avril 2010 - 06:01
I'm interested where you found the excerpt on the wiki. Last time I looked (month ago) the tutorial there worked well but your excerpt will not.
To get things started, please only use
object oJanica = GetObjectByTag("janica");
UT_HireFollower(oJanica);
break;
between case JANICA_JOIN: and case REWARD_RECIEVED:
and then delete the part from case REWARD_RECIEVED: and the following four lines. Does this work for you? Please use copy&paste, as there are several problems in your current script. I'll post some troubleshooting meanwhile.
To get things started, please only use
object oJanica = GetObjectByTag("janica");
UT_HireFollower(oJanica);
break;
between case JANICA_JOIN: and case REWARD_RECIEVED:
and then delete the part from case REWARD_RECIEVED: and the following four lines. Does this work for you? Please use copy&paste, as there are several problems in your current script. I'll post some troubleshooting meanwhile.
Modifié par Magic, 03 avril 2010 - 06:02 .
#5
Posté 03 avril 2010 - 06:15
- IsPlayer() is not a standard function. Have you written it yourself? What do you want to achieve with it?
- ojanica is not defined at that point in the script.
I assume the "error in line 38" is pointing here, yes?
- The object declaration of oJanica is case-sensitive, so you must type it exactly the same afterwards.
- UT_HireFollower() takes only 1 object as parameter (plus optionally an integer). You can find the function's syntax in the "Help Window" tab of the toolset.
- There should be a "break;" after the UT_HireFollower() call, else the script will continue execution for the following case.
There's a typo in REWARD_RECIEVED. Anyway, the important part is that it matches the plot flag definition in the plot file. And is LLVT_STAFREWARD really an item resource?
Other things to check:
- You have a plot with the name: questa.plo
- You have a header file with the name: deadswamp_constants.nss
- JANICA_JOIN is a plot flag in questa.plo.
I hope this helps a bit.
- ojanica is not defined at that point in the script.
I assume the "error in line 38" is pointing here, yes?
- The object declaration of oJanica is case-sensitive, so you must type it exactly the same afterwards.
- UT_HireFollower() takes only 1 object as parameter (plus optionally an integer). You can find the function's syntax in the "Help Window" tab of the toolset.
- There should be a "break;" after the UT_HireFollower() call, else the script will continue execution for the following case.
There's a typo in REWARD_RECIEVED. Anyway, the important part is that it matches the plot flag definition in the plot file. And is LLVT_STAFREWARD really an item resource?
Other things to check:
- You have a plot with the name: questa.plo
- You have a header file with the name: deadswamp_constants.nss
- JANICA_JOIN is a plot flag in questa.plo.
I hope this helps a bit.
Modifié par Magic, 03 avril 2010 - 06:16 .
#6
Posté 03 avril 2010 - 08:53
Thanks for the reply mate, will give these a try, all other things to check you mentioned were all fine, will try your previous suggestions, the script im using i found on the "Useful Scripts" section of the wiki, if you know of a tutorial section for adding followers that would be useful. Will try your suggestions now though. Also the no that isnt a staff however I linked it to that string in my constants script so.
Modifié par FinalSquall, 03 avril 2010 - 09:01 .
#7
Posté 03 avril 2010 - 09:17
Script is now as Follows:
/////////QuestSCripts/////////
#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "plot_h"
#include "plt_questa"
#include "deadswamp_constants"
void main()
{
}
int StartingConditional()
{
event eParms = GetCurrentEvent(); // Contains all input parameters
int nType = GetEventType(eParms); // GET or SET call
string strPlot = GetEventString(eParms, 0); // Plot GUID
int nFlag = GetEventInteger(eParms, 1); // The bit flag # being affected
object oParty = GetEventCreator(eParms); // The owner of the plot table for this script
object oConversationOwner = GetEventObject(eParms, 0); // Owner on the conversation, if any
int nResult = FALSE; // used to return value for DEFINED GET events
object oPC = GetHero();
plot_GlobalPlotHandler(eParms); // any global plot operations
if(nType == EVENT_TYPE_SET_PLOT) // actions -> normal flags only
{
int nValue = GetEventInteger(eParms, 2);
int nOldValue = GetEventInteger(eParms, 3);
switch(nFlag)
{
case JANICA_JOIN:
{
object oJanica = GetObjectByTag("janica");
UT_HireFollower(oJanica);
}
break;
case REWARD_RECIEVED:
}
}
plot_OutputDefinedFlag(eParms, nResult);
return nResult;
}
Doesnt do anything when i click the dialog response, wasnt sure exacetly what u meant to remove so removed the 4 lines after Case Reward. (Also does this script have to be attached to the area in Object Insepctor to work?)
/////////QuestSCripts/////////
#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "plot_h"
#include "plt_questa"
#include "deadswamp_constants"
void main()
{
}
int StartingConditional()
{
event eParms = GetCurrentEvent(); // Contains all input parameters
int nType = GetEventType(eParms); // GET or SET call
string strPlot = GetEventString(eParms, 0); // Plot GUID
int nFlag = GetEventInteger(eParms, 1); // The bit flag # being affected
object oParty = GetEventCreator(eParms); // The owner of the plot table for this script
object oConversationOwner = GetEventObject(eParms, 0); // Owner on the conversation, if any
int nResult = FALSE; // used to return value for DEFINED GET events
object oPC = GetHero();
plot_GlobalPlotHandler(eParms); // any global plot operations
if(nType == EVENT_TYPE_SET_PLOT) // actions -> normal flags only
{
int nValue = GetEventInteger(eParms, 2);
int nOldValue = GetEventInteger(eParms, 3);
switch(nFlag)
{
case JANICA_JOIN:
{
object oJanica = GetObjectByTag("janica");
UT_HireFollower(oJanica);
}
break;
case REWARD_RECIEVED:
}
}
plot_OutputDefinedFlag(eParms, nResult);
return nResult;
}
Doesnt do anything when i click the dialog response, wasnt sure exacetly what u meant to remove so removed the 4 lines after Case Reward. (Also does this script have to be attached to the area in Object Insepctor to work?)
Modifié par FinalSquall, 03 avril 2010 - 09:19 .
#8
Posté 03 avril 2010 - 10:42
The script should be fine now. From what I see, it's mostly the template, and you checked your additional lines. So the script compiles now, is that correct? case REWARD_RECIEVED is fine for now. Let's get it work in principle first.
Not sure if I understand your last question correctly but the script has to be the plot's script. So yes, using the Object Inspector on questa.plo has to list this script under Script.
With regard to the conversation, the node in question needs to be placed under the Action's Plot and Flag. Just checking, if you don't mind. Maybe re-export all resources in question to be sure. If you still don't get any effect, please place a
SetName(GetHero(),"test");
right after
int StartingConditional()
{
to see if your script is called at all.
Not sure if I understand your last question correctly but the script has to be the plot's script. So yes, using the Object Inspector on questa.plo has to list this script under Script.
With regard to the conversation, the node in question needs to be placed under the Action's Plot and Flag. Just checking, if you don't mind. Maybe re-export all resources in question to be sure. If you still don't get any effect, please place a
SetName(GetHero(),"test");
right after
int StartingConditional()
{
to see if your script is called at all.
#9
Posté 03 avril 2010 - 11:38
Right iv got it too work, after following your advise and it compiled I decided it couldnt be the script so I followed the Follower tutorial on the wiki, took me a while =P, hadnt done all the stuff before making the script (save making the pc and her convo and placing the script it in the conversation). Thanks for all your help!!
Modifié par FinalSquall, 04 avril 2010 - 12:33 .





Retour en haut






