I know my resting script is firing because it is giving me my debug message, but it is not altering behavior. I've looked at the MOTB resting scripts and apparently there is a flag that must be set somewhere, but i don't know where.
How do I make my resting script override the normal resting behavior?
Implementing Resting Scripts
Débuté par
M. Rieder
, mai 19 2011 01:16
#1
Posté 19 mai 2011 - 01:16
#2
Posté 19 mai 2011 - 01:21
I found where the switch is initialized. It is in the on module load script and is done with the following code:
SetModuleSwitch (MODULE_SWITCH_USE_NX1_SINGLE_PARTY_RESTSYSTEM, TRUE);
SetModuleSwitch (MODULE_SWITCH_USE_NX1_SINGLE_PARTY_RESTSYSTEM, TRUE);
#3
Posté 19 mai 2011 - 01:31
It looks like I will have to implement a custom UI/modify the existing MOTB or SOZ rest UI to use my custom script instead of the MOTB/SOZ scripts.
Any advice is welcomed. I am still tyring to figure the whole mechanics of resting out.
Any advice is welcomed. I am still tyring to figure the whole mechanics of resting out.
#4
Posté 19 mai 2011 - 02:56
Can you post your script? I've just stuck scripts in the module OnPlayerRest event and as far as I can tell they worked ok. I wasn't totally changing how resting occurs though, only under what circumstances resting is allowed.
#5
Posté 19 mai 2011 - 08:55
When someone rests, they fire the module's OnPlayerRest event, as KM says. You can do pretty much whatever you want from here. If you're using MotB's or SoZ's resting system, though, it might behave differently.
If you want an easy-to-customise resting GUI, I can offer you my own system (shameless plug), which is based on the MotB one, but to use the MotB/SoZ ones your best bet is probably to try and crack open all the scripts and things and see what's actually going on.
P.S. What changes are you actually trying to make?
If you want an easy-to-customise resting GUI, I can offer you my own system (shameless plug), which is based on the MotB one, but to use the MotB/SoZ ones your best bet is probably to try and crack open all the scripts and things and see what's actually going on.
P.S. What changes are you actually trying to make?
#6
Posté 19 mai 2011 - 12:30
@The Fred
I looked but didn't find your GUI. Maybe its becuase I didn't check UI and only checked scripts. Yes, I believe I will use your GUI.
Here's what I want to do:
1) Have the possibility of encounter hinge on the ranks of survival skill
2) Insert my own selection of creatures as the encounters triggered by the resting if the survival check fails.
I looked but didn't find your GUI. Maybe its becuase I didn't check UI and only checked scripts. Yes, I believe I will use your GUI.
Here's what I want to do:
1) Have the possibility of encounter hinge on the ranks of survival skill
2) Insert my own selection of creatures as the encounters triggered by the resting if the survival check fails.
#7
Posté 19 mai 2011 - 12:33
@KM
I'll post it when I get home. All the script does is call up a conversation which gives the player the option to rest or not. The script looks fine, but when I rest, the conversation doesn't start, the player just rests.
All the other scripts to check for encounters and generate encounters are called from the conversation.
I'll post it when I get home. All the script does is call up a conversation which gives the player the option to rest or not. The script looks fine, but when I rest, the conversation doesn't start, the player just rests.
All the other scripts to check for encounters and generate encounters are called from the conversation.
Modifié par M. Rieder, 19 mai 2011 - 12:37 .
#8
Posté 19 mai 2011 - 01:08
As your first real script "command" use a ClearAllActions() call to stop the resting sequence. Then call for your convo to begin.
Note that the OnPlayerRest event fires twice (when they enter rest and again when they exit rest), so you may want to have an if(IsInConversation(oPC)) return; call at/towards the beginning of your script.
Note that the OnPlayerRest event fires twice (when they enter rest and again when they exit rest), so you may want to have an if(IsInConversation(oPC)) return; call at/towards the beginning of your script.
Modifié par _Knightmare_, 19 mai 2011 - 01:11 .
#9
Posté 19 mai 2011 - 03:41
I did call ClearAllActions(), but I didn't assign it as a command to anyone. I assumed that the creature resting would be calling the script, but I just remembered that when I referenced the rester using OBJECT_SELF, it didn't work and I had to use GetLastPCRested(). I bet that is my problem, I need to assign ClearAllActions() to GetLastPCRested() and it will probably all fall into place, right?
I'm going to try it tonight. Thanks for the help KM.
I'm going to try it tonight. Thanks for the help KM.
#10
Posté 19 mai 2011 - 04:35
M. Rieder wrote...
I did call ClearAllActions(), but I didn't assign it as a command to anyone. I assumed that the creature resting would be calling the script, but I just remembered that when I referenced the rester using OBJECT_SELF, it didn't work and I had to use GetLastPCRested(). I bet that is my problem, I need to assign ClearAllActions() to GetLastPCRested() and it will probably all fall into place, right?
I'm going to try it tonight. Thanks for the help KM.
Yup you are correct. You need to assign the command as you stated. In general OBJECT_SELF is the object to which the script is attached (or is actually firing the script - not that which causes the script to fire), so in this case, since it is a module level event OBJECT_SELF would be the module itself.
#11
Posté 19 mai 2011 - 04:46
Ahhh, yes. That makes sense. Can't wait to get home and see how this works. I thought I was going to have to use a UI or something like that. This will save lots of time.
#12
Posté 19 mai 2011 - 04:59
The conversation that you arer firing is it a party convo or a NWN1 style convo?
Don't know how you are starting the convo but I found that if you have a party convo start AssignCommand(oPC,ActionStartConversation(oPC,"rest_convo"))); The character defined as oPC won't appear as one of the companions in the party chat. To work around that, I would check for an ipoint in the area, if it wasn't there I would spawn it in then have it start the conversation with the oPC ignoring the convo distance.
Don't know how you are starting the convo but I found that if you have a party convo start AssignCommand(oPC,ActionStartConversation(oPC,"rest_convo"))); The character defined as oPC won't appear as one of the companions in the party chat. To work around that, I would check for an ipoint in the area, if it wasn't there I would spawn it in then have it start the conversation with the oPC ignoring the convo distance.
#13
Posté 19 mai 2011 - 06:20
Yeah, ClearAllActions() needs to be applied to the PC, it will make the PC clear their actions (but not clear other creatures' actions). You may need to apply it to all party members.
Running the conversation on an ipoint or similar might work best too, as Shaughn says.
R.E. My UI, it's basically just the MotB UI but more customisable. This means you can enable or disable extra options (e.g. "wait until dawn/dusk") based on various factors. However, it doesn't do any of the actual resting stuff (such as wandering monsters), it just fires off a script based upon the option selected. It would really only be doing the job of your conversation here (and you would still need to call ClearAllActions(), though I think that's in the default scripts).
One other (minor) point, if you haven't turned off resting messages, you might want to do that (via the campaign editor, if you're running a campaign) and send them manually, if at all, so that you don't get them popping up when they shouldn't etc.
Running the conversation on an ipoint or similar might work best too, as Shaughn says.
R.E. My UI, it's basically just the MotB UI but more customisable. This means you can enable or disable extra options (e.g. "wait until dawn/dusk") based on various factors. However, it doesn't do any of the actual resting stuff (such as wandering monsters), it just fires off a script based upon the option selected. It would really only be doing the job of your conversation here (and you would still need to call ClearAllActions(), though I think that's in the default scripts).
One other (minor) point, if you haven't turned off resting messages, you might want to do that (via the campaign editor, if you're running a campaign) and send them manually, if at all, so that you don't get them popping up when they shouldn't etc.





Retour en haut






