How to end custom modules using a portal or door?

I can’t find any information about how to link a portal or door transition to end the game, can someone point me in the right direction or explain what i need to do? For example when the PC finishes the final quest and is ready to end the game i will put a portal or door with a sign saying not to use this transition until you have finished the final quest and are ready to exit the module and when they do click it they see the original end movie/credits. Or if i could link the end game script to the final quest dialog line that would be ok too. I see where the end movie options are under module properties advanced tab but just not sure how to link to it in a toolset area. Thanks for any help…

The script function is EndGame() which accepts the movie name as a parameter.

It could go in the OnUsed script of a portal, or OnAreaTransitionClick for a door (assuming you link the door to a dummy target).

Better still, start a conversation in those events, with EndGame() in the action taken script if the player choses that option. That allows you to warn the player that this is the point of no return (in case they didn’t read the memo).

This one comes from my module “Bloodfeud” (here in the vault!).

#include “inc_jump”

void main()
{
object oClicker=GetClickingObject();
object oTarget=GetTransitionTarget(OBJECT_SELF);

if (GetLocalInt (GetModule(), “BigTreasureFound”) == 2)
{
ActionStartConversation (oClicker, “endgame”, FALSE, FALSE);
return;
}
JumpParty (oClicker, oTarget);
}

If the endgame condition is met (“BigTreasureFound” == 2), the door doesn’t work as normal door anymore, instead a dialogue is launched. Within this dialogue the Player may choose to roll the credits (the “endgame()” command is used) or just stay a little bit longer. The script is triggered on the “OnAreaTransitionClick”-event on the exit of the Jungle-Pyramid.

Thank you Proleric and Mmat for the good information! I will try to get my older module and newer module updated soon with an actual ending.

@Proleric @Mmat Thank you both for the solutions, I just got the end portal built and it works perfect! The script I used looks like this-

void main()
{
EndGame("");
}

At first the script wasn’t firing but I saw it had an error compiling because I forgot the semicolon at the end of the third line… Thank you for the help, I believe it will make my modules alot better now to have a true ending.

1 Like