Modifié par UnrealJedi, 30 décembre 2011 - 05:24 .
Ending a module
#1
Posté 30 décembre 2011 - 05:24
#2
Posté 30 décembre 2011 - 05:59
#3
Posté 31 décembre 2011 - 12:41
Thanks!
#4
Posté 31 décembre 2011 - 01:19
If you wanted to force the game to do that in a script, you would use ExportSingleCharacter
#5
Posté 31 décembre 2011 - 02:20
//Add these two lines to the OnClientEnter script
object oPC = GetEnteringObject();
if(GetLocalInt(oPC, "JUMPTONEXTMODULE"){ExecuteScript("transfer", oPC); return;}
---------------------------------------------------------
//Script name "transfer"
//Call this script both at the point of module completion and in OnClientEnter as noted above
void SaveAndEnd()
{
DoSinglePlayerAutoSave();
ExportSingleCharacter(OBJECT_SELF);
EndGame("INSERT_END_MOVIE_HERE");
}
void main()
{
StartNewModule("INSERT_NEXT_MODULE_HERE");
SetLocalInt(OBJECT_SELF, "JUMPTONEXTMODULE", TRUE);
DelayCommand(1.0, SaveAndEnd());
}
Modifié par WhiZard, 31 décembre 2011 - 02:21 .
#6
Posté 31 décembre 2011 - 04:01
#7
Posté 26 janvier 2012 - 03:15
I simply need a script that fires when a PC crosses a trigger. The way I am ending the module is that the PC falls into a magically-induced sleep. After the sleep happens, the script needs to save the character, run an ending movie I have created that simply says "To Be Continued...", and then return to the main menu. Instead of jumping to the next module I want to give the player the option of loading up the next one or taking a break and coming back to play the next module at a later time.
I have a script that successfully puts the PC to sleep but then nothing else happens. The PC just lays there asleep while his/her henchman just stands there. Nothing else happens.
I am at work or I would post my script. I can do that later tonight after I get home if it would help.
What am I missing?
#8
Posté 26 janvier 2012 - 04:17
#9
Posté 26 janvier 2012 - 05:59
#10
Posté 01 février 2012 - 03:12
I am posting them here. I cannot recall how to do it in a window so I am
posting them in the body of this entry.
The OnClientEnter Script (compiled without a problem, but will it
still do its thing???)
/*69_client_enter
OnClientEnter Module Event
Checks for Leadership, if TRUE sets maximum
henchmen on PC
Created by: 69MEH69
Created on: Sep2004
*/
#include "69_hench_lib"
void main()
{
object oPC = GetEnteringObject();
int nLeadership = GetLocalInt(GetModule(),
"nLeadership");
if(nLeadership == 1)
{
//SendMessageToPC(oPC, "Leadership =
1"); //Test
SetMaxHenchmen69(oPC);
object oPC =
GetEnteringObject();
if(GetLocalInt(oPC,
"JUMPTONEXTMODULE")){ExecuteScript("transfer", oPC);
return;}
}}
The Endgame Trigger Script (did not compile; I have notated where
the compiler states the issue is and the error)
/* Script generated by
Lilac Soul's NWN
Script Generator, v. 2.3
For download info, please visit:
http://nwvault.ign.c...=4683&id=625 */
//Put this
script OnEnter
void main()
{
object oPC =
GetEnteringObject();
if
(!GetIsPC(oPC)) return;
if
(GetLocalInt(oPC, "talkedtokriston")!= 2)
return;
object oTarget;
oTarget = oPC;
effect eEffect;
eEffect =
EffectSleep();
eEffect =
SupernaturalEffect(eEffect);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget, 60.0f);
DoSinglePlayerAutoSave();
ExportSingleCharacter(OBJECT_SELF);
EndGame("INSERT_END_MOVIE_HERE");
}
StartNewModule("INSERT_NEXT_MODULE_HERE");
//compiler doesn't like this line and
gives an INVALID DECLARATION TYPE error
SetLocalInt(OBJECT_SELF,
"JUMPTONEXTMODULE", TRUE);
DelayCommand(1.0,
SaveAndEnd());
If I put in a "void main()" before the bolded line above then the
compiler gives me an UNKNOWN STATE IN COMPILER ERROR.
Any insight is greatly appreciated!
Thanks guys!
Modifié par UnrealJedi, 01 février 2012 - 03:18 .
#11
Posté 01 février 2012 - 03:19
#12
Posté 01 février 2012 - 11:15
You have defined oPC twice. All you need to do is put the conditional immediately after the oPC declaration as shown above.UnrealJedi wrote...
Okay, I am STILL having some problems with these scripts so
I am posting them here. I cannot recall how to do it in a window so I am
posting them in the body of this entry.
The OnClientEnter Script (compiled without a problem, but will it still do its thing???)
/*69_client_enter
OnClientEnter Module Event
Checks for Leadership, if TRUE sets maximum henchmen on PC
Created by: 69MEH69
Created on: Sep2004
*/
#include "69_hench_lib"
void main()
{
object oPC = GetEnteringObject();
if(GetLocalInt(oPC, "JUMPTONEXTMODULE")){ExecuteScript("transfer", oPC); return;}
int nLeadership = GetLocalInt(GetModule(), "nLeadership");
if(nLeadership == 1)
{
//SendMessageToPC(oPC, "Leadership = 1"); //Test
SetMaxHenchmen69(oPC);
}
}
For the end game condition you should just do an execute script (as shown below) to initiate the ending sequence.The Endgame Trigger Script (did not compile; I have notated where
the compiler states the issue is and the error)
/* Script generated by Lilac Soul's NWN Script Generator, v. 2.3
For download info, please visit: http://nwvault.ign.c...=4683&id=625 */
//Put this script OnEnter
void main()
{
object oPC = GetEnteringObject();
if(!GetIsPC(oPC)) return;
if(GetLocalInt(oPC, "talkedtokriston")!= 2)
return;
object oTarget;
oTarget = oPC;
effect eEffect;
eEffect = EffectSleep();
eEffect = SupernaturalEffect(eEffect);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget);
ExecuteScript("transfer", oPC);
}
Now you can just use the script I gave you above for the "transfer" script, (name it accordingly) and you should be done. Just so that you have the correct code for "transfer" I am reposting it below
//Script name "transfer"
//Call this script both at the point of module completion and in OnClientEnter as noted above
void SaveAndEnd()
{
DoSinglePlayerAutoSave();
ExportSingleCharacter(OBJECT_SELF);
EndGame("INSERT_END_MOVIE_HERE");
}
void main()
{
StartNewModule("INSERT_NEXT_MODULE_HERE");
SetLocalInt(OBJECT_SELF, "JUMPTONEXTMODULE", TRUE);
DelayCommand(1.0, SaveAndEnd());
}
Modifié par WhiZard, 01 février 2012 - 11:22 .
#13
Posté 02 février 2012 - 05:08
#14
Posté 02 février 2012 - 01:07
#15
Posté 03 février 2012 - 09:50
There are two names I used that you will need to replace with the appropriate name you use.
These are:
INSERT_END_MOVIE_HERE
INSERT_NEXT_MODULE_HERE
Edit: fixing misspelling
Modifié par WhiZard, 04 février 2012 - 12:35 .
#16
Posté 04 février 2012 - 08:42





Retour en haut






