Jump to content


Photo

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


  • Please log in to reply
8 replies to this topic

#1 Reztea

Reztea

    Jedi Apprentice

  • Members
  • PipPip
  • 41 posts
  • LocationFlorida, USA

Posted 21 March 2017 - 02:10 AM

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.

Attached File  Screenshot_30.png   1.42MB   2 downloads


Edited by Reztea, 21 March 2017 - 02:15 AM.


#2 jc2

jc2

    Kyramud

  • Members
  • PipPipPipPip
  • 281 posts
  • LocationAlderaan 19 BBY

Posted 21 March 2017 - 02:14 AM

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.


KOTOR FOR LIFE

"To ponder and find relevance, one must seek out a quote," because his own words lack the credibility to endeavor to explain his rather odd disposition.

 

Grey Jedi "Shanilia" > http://deadlystream..../1044-shanilia/

 

Thank you FS for past and current modding help! 


#3 Reztea

Reztea

    Jedi Apprentice

  • Members
  • PipPip
  • 41 posts
  • LocationFlorida, USA

Posted 21 March 2017 - 02:19 AM

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);
 
}


#4 bead-v

bead-v

    Evil Malachor Overlord

  • Premium Member
  • 340 posts
  • LocationSlovenia

Posted 21 March 2017 - 03:09 AM

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, 21 March 2017 - 03:10 AM.


#5 Reztea

Reztea

    Jedi Apprentice

  • Members
  • PipPip
  • 41 posts
  • LocationFlorida, USA

Posted 21 March 2017 - 03:27 AM

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.



#6 Reztea

Reztea

    Jedi Apprentice

  • Members
  • PipPip
  • 41 posts
  • LocationFlorida, USA

Posted 21 March 2017 - 03:33 AM

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.



#7 JCarter426

JCarter426

    Jedi Knight

  • M478_Staff
  • 247 posts

Posted 21 March 2017 - 04:30 AM



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));
 
}


#8 bead-v

bead-v

    Evil Malachor Overlord

  • Premium Member
  • 340 posts
  • LocationSlovenia

Posted 21 March 2017 - 11:49 AM

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.



#9 JCarter426

JCarter426

    Jedi Knight

  • M478_Staff
  • 247 posts

Posted 21 March 2017 - 11:13 PM

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.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users