PDA

View Full Version : OnEnter doesn't work


Demongo
08-26-2009, 06:38 AM
I can't really get this to work. This is for K1. I have a script like this:
void main(){
ActionStartConversation(GetFirstPC(),"kex4");
}

That should start a conversation right?
When I put this in the OnEnter field of my module, it simply does not work. I have some ideas why it doesn't work though:
I don't "Enter" the module actually. Just because a conversation, I start this new module. Here's the script that fires before I warp to this module:

void main(){

ActionPauseConversation();
ActionWait(3.0);

vector tPosition=Vector(50.06,75.77,3.00);
location lBla=Location(tPosition,90.0);

SpawnAvailableNPC(NPC_CANDEROUS, lBla);

AddAvailableNPCByTemplate(1, "kelborn");

SwitchPlayerCharacter(NPC_CANDEROUS);

StartNewModule("m60aa");

ActionResumeConversation();

ActionStartConversation(GetFirstPC(),"kex4");
}

I'm not really sure in this script, but the rest of it works properly.( I control the kelborn.utc NPC and the rest of the party isn't there.

So......any help would be appreciated:D

stoffe
08-26-2009, 08:53 AM
I can't really get this to work. This is for K1. I have a script like this:
void main(){
ActionStartConversation(GetFirstPC(),"kex4");
}

If this is run as an area's OnEnter event script it would try to make the area start a conversation with the player. Since areas can't talk it would fail. You have to assign the action to an object that is capable of being in conversations (creatures or placeables). It's also safest to delay the command slightly (about 0.5 seconds or so) since I've noticed actions involving the player can be somewhat unreliable in how they trigger otherwise while the game is loading the area.

Also do keep in mind that the area OnEnter event triggers whenever any creature enters the area. This includes the player being warped there, but also loading a savegame in the area, party members being spawned in, or any other NPC being created in the area. So if you only want it to happen once you need to check if it is the player character that enters the area, and then set and check a variable to block it from happening every time the player enters.


I don't "Enter" the module actually. Just because a conversation, I start this new module. Here's the script that fires before I warp to this module:

void main(){

ActionPauseConversation();
ActionWait(3.0);

vector tPosition=Vector(50.06,75.77,3.00);
location lBla=Location(tPosition,90.0);

SpawnAvailableNPC(NPC_CANDEROUS, lBla);

AddAvailableNPCByTemplate(1, "kelborn");

SwitchPlayerCharacter(NPC_CANDEROUS);

StartNewModule("m60aa");

ActionResumeConversation();

ActionStartConversation(GetFirstPC(),"kex4");
}


This script would essentially stop executing at the StartNewModule("m60aa"); line. You can only issue actions to objects that exist within the module that is currently loaded, so the script and action queues would be cleared when the new module is loaded. Thus the ActionStartConversation() call would never take effect.

Demongo
08-26-2009, 10:04 AM
Seems I have MUCH to learn. This module is only used once and the player can't return here, so I guess the OnEnter will do it. Thanks for your help:)

R2-X2
08-26-2009, 11:10 AM
Just another thing to mention:
I'd recommend you to make the NPCs' tag moe unique, perhaps with adding a "dd_" (without the quotes) prefix to all your files. Less unique files can overwrite things you don't want to be overwritten, as in your Warpband mod. It changes the neutral rodian from the Dreshdae cantina to one who attacks you.

Demongo
08-26-2009, 11:26 AM
Well I guess I have something to fix then:p Thanks for the tip, but I'M completely sure that kelborn isn't in K1. He was seen in TSL first.

R2-X2
08-26-2009, 11:38 AM
Well, that's right, you won't get problems with that.