Sign in to follow this  
Reztea

(Recruit Atris Mod)I feel I've hit rock bottom....(SPOILERS)

Recommended Posts

Guys, have I officially hit rock bottom with this project? So AFTER the PC goes to the entrance of the Trayus' Academy and being welcomed by the Sith Assassins I was able to switch my player character to Atris before we transit to attempt to face Traya *SPOILER*, after the battle, a dialog sequence will commence, but my script to revert BACK to my PC ultimately crashes the game... Can I please get some help?? After this, I think my mod will be ready to be released.

post-15466-0-67673300-1490062090_thumb.png

Edited by Reztea

Share this post


Link to post
Share on other sites

You might want to attach the source script so that people can help. I'm too much of a noob at scripting to help, but I know it would aid anyone trying to help you.

Share this post


Link to post
Share on other sites

You might want to attach the source script so that people can help. I'm too much of a noob at scripting to help, but I know it would aid anyone trying to help you.

You're correct, my apologies, however I've tested my script on other modules and it seems to work perfectly, I think it's something with the module in particular.

 
void main() {
 
SwitchPlayerCharacter(-1);
 
}

Share this post


Link to post
Share on other sites

That function has a mind of its own, it can work perfectly, or it can cause way more trouble than it's worth.

 

I had a problem with it a few months ago and unfortunately, I couldn't get it to work, so I went for a bit of a workaround.

 

But there has to be some reason, so you'll just have to try a bunch of things. First we'll need more info, who started the conversation with who, when in the conversation it fires, etc... if it's at the end, you could try delaying it a bit, so it's out of the conversation. You would then have to make a wrapper function, because SwitchPlayerCharacter() does not return void. Like this:

 

void SwitchCharacter(int nNPC = NPC_PLAYER){
    SwitchPlayerCharacter(nNPC);
}

void main(){
    DelayCommand(2.0, SwitchCharacter());
}

I think JCarter has said that he knew some of the reasons why it can crash, maybe he remembers something?

 

Good luck and don't let it get on your nerves too much :P

Edited by bead-v

Share this post


Link to post
Share on other sites

That function has a mind of its own, it can work perfectly, or it can cause way more trouble than it's worth.

 

I had a problem with it a few months ago and unfortunately, I couldn't get it to work, so I went for a bit of a workaround.

 

But there has to be some reason, so you'll just have to try a bunch of things. First we'll need more info, who started the conversation with who, when in the conversation it fires, etc... if it's at the end, you could try delaying it a bit, so it's out of the conversation. You would then have to make a wrapper function, because SwitchPlayerCharacter() does not return void. Like this:

 

 

void SwitchCharacter(int nNPC = NPC_PLAYER){
    SwitchPlayerCharacter(nNPC);
}

void main(){
    DelayCommand(2.0, SwitchCharacter());
}

I think JCarter has said that he knew some of the reasons why it can crash, maybe he remembers something?

 

Good luck and don't let it get on your nerves too much :P

Kreia will start the conversation, and the script fires at the end. What I was going to try to do is make ANOTHER copy of the 201Tel module, because it has a starting conversation, and I'll fade the convo to black, and fire the scripts there, since it works perfectly there... Let me try your script first, then I'll let you know.

Share this post


Link to post
Share on other sites

Kreia will start the conversation, and the script fires at the end. What I was going to try to do is make ANOTHER copy of the 201Tel module, because it has a starting conversation, and I'll fade the convo to black, and fire the scripts there, since it works perfectly there... Let me try your script first, then I'll let you know.

Yeah, no dice. Looks like I'm making yet another module, at least it won't be much of a struggle.

Share this post


Link to post
Share on other sites

I think JCarter has said that he knew some of the reasons why it can crash, maybe he remembers something?

 

My party script is six hundred lines long and I spent about a week debugging it almost five years ago. But let's see if I can recall some things.

 

One thing I do remember, because this was the last thing I had to fix and it took a while to figure out what was wrong. I had to run NoClicksFor() for the duration of the switch, because any sort of player interaction with anything seemed to crash the game. After I had finished all the other debugging, I still got crashes that were seemingly random, and went away once that function was added in.

 

The character you're switching to must also be physically present and available as a party member, or else the game will crash. But that shouldn't cause an issue if you're trying to switch back to the PC. For switching back to the PC, however, it looks like in my script I make sure the temporary PC is set as the party leader before the switch occurs.

 

Additionally, I have two separate cases for the switch. Case 4 sets up the switch, and then case 8 executes the script. I can't remember why I did this... I think it might've been so I could retain the temporary PC as a party member after the switch occurs, so you might not need that. I'm going to assume we can scrap all that, and I'm also ignoring a ton of safeties I built into my script. But with that in mind, I'd say it would look something like this:

void SwitchPC(int iNPC) {
AssignCommand(GetFirstPC(), ClearAllActions());

ActionWait(0.5);

SwitchPlayerCharacter(iNPC);

SetPartyLeader(iNPC);
}
 
void main() {
 
int iNPC0 = 0; // Put in Atris' NPC integer here
 
SetPartyLeader(iNPC0);

NoClicksFor(1.5);

SetGlobalFadeIn(2.0, 1.0, 0.0, 0.0, 0.0);
DelayCommand(0.2, SwitchPC(-1));
 
}
  • Like 1

Share this post


Link to post
Share on other sites
The character you're switching to must also be physically present and available as a party member, or else the game will crash.

Well this part isn't entirely true, there are a lot of examples in vanilla and also in scripts I made where it works even if the NPC is not present. Though it probably helps if they're already there, so do this as well, Reztea!

 

Kreia will start the conversation, and the script fires at the end. What I was going to try to do is make ANOTHER copy of the 201Tel module, because it has a starting conversation, and I'll fade the convo to black, and fire the scripts there, since it works perfectly there... Let me try your script first, then I'll let you know.

I'm pretty sure you don't need to do that! Especially if you already have a copy of the module, just reuse that one!

 

What I would try next is to create an invisible placeable, and have the placeable start the conversation with itself. Also make sure you do everything JCarter said (you're awesome, thanks!).

 

Also, you could try switching before the conversation, spawning in Atris again, then running the conversation between them.

Share this post


Link to post
Share on other sites

Well this part isn't entirely true, there are a lot of examples in vanilla and also in scripts I made where it works even if the NPC is not present.

 

Hmm, I must be misremembering then. It was probably just a precaution on my part, or perhaps necessary for some other part of the script. But it shouldn't affect switching back to the PC anyway.

 

 

What I would try next is to create an invisible placeable, and have the placeable start the conversation with itself.

 

I second that. If the character being switched is the owner or initiator of the conversation, that could cause problems that have nothing to do with the switch itself. I only ever scripted it outside of dialogue, so I'm not aware of the complications there.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this