Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Problem while recruiting Yuthura

Page: 1 of 1
 DarkPredator
01-01-2007, 11:11 PM
#1
I'm working on a Yuthura recruit Mod and have the following Problem

I made her to join the Party after the recruit dialoge (on that Icefield after finding the StarMap and killing Uthar and of course siding with her)

Recruit Script:

void main()
{
RemoveAvailableNPC(7);
AddAvailableNPCByTemplate(7, "p_yuthura");
CreateObject(OBJECT_TYPE_CREATURE, "p_yuthura", GetLocation(GetFirstPC()));
AddPartyMember(NPC_T3_M4, GetObjectByTag("T3M4"));
object oGoodbye;
oGoodbye = GetObjectByTag("kor39_yuthura");
DestroyObject(oGoodbye);
}

I also let another script remove alle Partymembers bevor going to Naga Sadow's Tomb so i dont get conflicts after I return with her to the academy

This works all well, but now the Problem, when i return to the Ebon Hawk Yuthura is set hostile, she dont attack but counters if I attack her. When i leave the Ship and take her in the Party shes friendly, but evrytime I enter the Ebon Hawk shes hostile again °_°

I think this occures because i use the kor39_yth_redeem.ncs to open the doors in the Tomb and set the Guys in the Academy hostile. I dont know how much work it is to script that all by my own, but i think much more than getting rid of the negative side effects of the redeem.ncs.

Another Problem of the redeem.ncs is, that it let Yuthura appaer on Dantooine and I dont know how to avoid or undo that.

It also seems that she only turns hostile on the Ebon Hawk when i use the: CreateObject(OBJECT_TYPE_CREATURE, "p_yuthura", GetLocation(GetFirstPC())); comand, without it she stays friendly in the ebon hawk O_o"

Now there are a couple of things that you guys can do to help me:
- is there onther way to let her join the party without using that CreateObject comand?
- How can i avoide/undo that she appears on Dantooine?
- There must be a script that fires up when Yuthura and Uthar both get killed to open the Doors and set the Academy crew hostile, but i cant find it, has anayone an idea which script that is? This would also fix the Problem that she appears on Dantooine and maybe also that she is set hostile in the Eben Hawk
- And i realy dont understand why the redeem script sets her hostile, she has another Tag and Template ResRef than the normal Yuthura Models, so how can this script affect her?
 stoffe
01-03-2007, 2:16 PM
#2
Now there are a couple of things that you guys can do to help me:
- is there onther way to let her join the party without using that CreateObject comand?

Your join script looks a bit odd. When you use CreateObject() like that you spawn a new instance of a character from p_yuthura.utc and add it to the active party, not using the one you just created in the party table. Use SpawnAvailableNPC() instead to spawn the character from the party table into the game world. Try doing like this instead in your recruit script:

void main() {
// ST: Remove T3M4 from the party to free up its slot.
RemoveAvailableNPC(NPC_T3_M4);

// ST: Create Yuthura from p_yuthura.utc in T3M4's old slot.
AddAvailableNPCByTemplate(NPC_T3_M4, "p_yuthura");

// ST: Spawn party member Yuthura into area and add to active party.
object oNPC = SpawnAvailableNPC(NPC_T3_M4, GetLocation(GetFirstPC()));
AddPartyMember(NPC_T3_M4, oNPC);

// ST: Remove the old non-party NPC.
DestroyObject(GetObjectByTag("kor39_yuthura"));
}


Also, check what faction you have set in p_yuthura.utc. If she's set to a hostile faction there then she will be hostile when created with CreateObject(). Set her faction to 2 (Friendly1) if it isn't already.
 knightmare66
01-03-2007, 8:25 PM
#3
There was a similar recruitment mod released over a year ago. I tried modifying it for my personal use so that it would only be an option after Bastila has left the party (using her vacant slot in the party table). It worked until I traveled to the Unknown World, where the Malak torturing Bastila scene had him torturing Yuthura instead, after which Yuthura disappeared from my party.
 DarkPredator
01-03-2007, 11:47 PM
#4
@stoffe -mkb-
thx!!! with the new command it works perfect now and solved two other strange things. She now gets the party exp when appearing, before she only get it when i entered another area. And when leaving the accademy normaly you can change your partymember's and return to the ebon hawk on this small way between the Academy and the other building with the landing field, this functions also was switched off because of the CreateObject command °_°"

Now the only Problem remaining is that she appears on Dantooine and i dont know how to remove NPCs in other Areas. Talking to her on Dantooine and tell her to dissapear isn't a real nice solution xD

@knightmare66
You probably mean alvin777's Mod, my work is also based on this, but in the meantime the only similarity left is that you recruit Yuthura and even those are totaly different because i changed nearly evrything on her ^^

I also traveld with Yuthura to the unknown World and nothing bad happend, she only killed a lot of Rakata *.*"
 Kitty Kitty
01-04-2007, 1:48 AM
#5
Gonna be watching for a beta (or finished) release on this. I was about ready to dig into how to do it myself actually. Always thought she'd be fun to run around chopping things up with, and the story really seemed to hint there aught to be a way to recruit her.

Anyway, in regards to getting rid of her...

You should be able to use a GetObjectByTag to find out if she's on Dantooine -
// 200: Get the nNth object with the specified tag.
// - sTag
// - nNth: the nth object with this tag may be requested
// * Returns OBJECT_INVALID if the object cannot be found.
object GetObjectByTag(string sTag, int nNth=0);

Then I suppose you'd want to test if Yuthura was a valid party member (has been recruited)
// 696. IsAvailableNPC
// This returns whether a NPC is in the list of available party members
int IsAvailableCreature( int nNPC );

Then if both are true, you should be able to use DestroyObject to delete the Dantooine version of her.
// 241: Destroy oObject (irrevocably).
// This will not work on modules and areas.
// The bNoFade and fDelayUntilFade are for creatures and placeables only
void DestroyObject(object oDestroy, float fDelay=0.0f, int bNoFade = FALSE, float fDelayUntilFade = 0.0f);


Should be able to make a new version of the on_enter script for the courtyard with this stuff in there that then chains to the OLD on_enter with ExecuteScript easy enough.

That'd prevent you even needing to set/check any globals too, which is nice when you can avoid using them IMO.

I'm sure stoffe -mkb- will be by here sooner or later to stomp my inept scripting advice to bits (since by comparison I doubt I'd even rank as a youngling -let alone a padawan), but that's probably along the lines of how I'd try to go about it.

Hope it's at least a tiny bit helpful. ;)

-Kitt
 stoffe
01-04-2007, 10:06 AM
#6
Now the only Problem remaining is that she appears on Dantooine and i dont know how to remove NPCs in other Areas. Talking to her on Dantooine and tell her to dissapear isn't a real nice solution xD

As far as I can see at a quick glance it appears that Yuthura is spawned on Dantooine if the global variable KOR_FINAL_TEST is set to 7. It also seems like the Academy on Korriban is going hostile if this value is higher than 3. If this is indeed correct and you want the Academy to go hostile when Yuthura joins you than it should hopefully be enough to add something like this to the recruit script:
SetGlobalNumber("KOR_FINAL_TEST", 12);


If this works you shouldn't need to mess with the OnEnter script of the Enclave Courtyard area on Dantooine, thus avoiding possible incompatibilities with other mods doing so. You should always avoid messing with the standard game scripts whenever it's avoidable, in my opinion, since they are the hardest part of the game to make compatible between mods.


Then I suppose you'd want to test if Yuthura was a valid party member (has been recruited)
// int IsAvailableCreature( int nNPC );


The problem with using this function in this particular case is that the party slot is not unique for Yuthura, if you check IsAvailableNPC(NPC_T3_M4) it would return true if either T3M4 is in the group (which it would be if Yuthura wasn't recruited) or if Yuthura is in the group. As long as any character is in party table slot 7 and isn't set to be unavailable it would return true.

Unfortunately you can't check any specifics about a character stored in the party table without first spawning it into the game world, so the easiest way of doing this check would be to set a new Global variable when she is recruited, and then use that variable to check if she's tagged along.

(Or you could check if she's in the active party and if not spawn in the character in T3M4's party table slot and examine it, but that feels like a pretty bothersome way of doing it. :))

Other than that you could rig the OnEnter script like you describe, but it would require either modifying or replacing the script, which hopefully shouldn't be necessary in this case. And if you go by the delete route Yuthura would be spawned and then instantly deleted any time you entered the courtyard, since the area OnEnter script checks if the KOR_FINAL_TEST global number is 7 and if Yuthura doesn't already exist in the area, and if so spawns her, any time the area is entered.



That'd prevent you even needing to set/check any globals too, which is nice when you can avoid using them IMO.

Hmm, why should you avoid using globals? The only thing I can think of would be the headache of finding every place they are checked and make sure changes to them doesn't mess up some other sequence of the game if a script gets a global value it wasn't expecting. (FindRefs is really helpful for checking where variables are used, so at least you don't have to do it manually.) Anything I'm overlooking?


I'm sure stoffe -mkb- will be by here sooner or later to stomp my inept scripting advice to bits

I hope nobody feels stomped upon, that's not my intent by replying. I'm just sharing what I know if someone asks about something I happen to have any knowledge about. :)
 DarkPredator
01-04-2007, 1:02 PM
#7
Always thought she'd be fun to run around chopping things up with, and the story really seemed to hint there aught to be a way to recruit her.

Yeah.. i realy like it to fight my way back trough the academy with Yuthura ^^ For me it also seemed that she can be recruited somehow, maybe she was once planed as DS Jedi to join, but then rejected :(

I already tried it with GetObjectByTag command and then destroyobject, but i think its nessecary to be in the same Area as the Object you want to get and destory, or i made a mistake, i dunno


Then I suppose you'd want to test if Yuthura was a valid party member (has been recruited)

I dont realy understand why you want to do that, but stoffe said enough about that ^^

But anyway, thx that you tried to help ^.^


As far as I can see at a quick glance it appears that Yuthura is spawned on Dantooine if the global variable KOR_FINAL_TEST is set to 7. It also seems like the Academy on Korriban is going hostile if this value is higher than 3. If this is indeed correct and you want the Academy to go hostile when Yuthura joins you than it should hopefully be enough to add something like this to the recruit script:
SetGlobalNumber("KOR_FINAL_TEST", 12);


Great, thats the "Script" i was searching for xD But setting the value to 12 doesn't let the 3 Sith appear, who are waiting for you in front of the Academy when you return from the tomb, and i found out that they fire up the script that set all Sith on Korriban hostile. But thats no Problem, because i just looked which value the "KOR_FINAL_TEST" gets when i killed Uthar und Yuthura, its 4 :)

So i integrated that command with the value 4 in my recruit script and it seems all is working fine now, thx again stoffe :)

But i noticed another suptid thing, the Way of the Sith Quest dont terminates after running the redeem script, normaly it said that Uthar is dead and you spared Yuthura and she returend to her Master blabla. But now nothing happens and i have again no clue why, i also tried to set off my recruit script and tested it without it, but even so nothing happend, i just get LS points from the redeem script °_°" (I will have to give some DS points to equalize that, but thats no problem). So i watched trough the unchanged kor39_yuthura.dlg but there are no other Scripts running in the paths who lead to the redeem script.. i think it just wants to bother me :/
 stoffe
01-04-2007, 1:30 PM
#8
I already tried it with GetObjectByTag command and then destroyobject, but i think its nessecary to be in the same Area as the Object you want to get and destory, or i made a mistake, i dunno

A script can only manipulate objects within the module (area) that is currently loaded, since the game only has one area loaded at a time. So if you want to delete the character you'd need to do it when the Dantooine Courtyard Area is being entered, and you'd need to do it every time since she'd be respawned if she wasn't present while she should be there (according to the global variable mentioned).




I dont realy understand why you want to do that

It's an alternate way of getting rid of Dantooine-Yuthura without modifying the global variable and without having to modify the original OnEnter script. Though it's probably more efficient to modify the original script that might make compatibility with other mods a little bit harder.



But i noticed another suptid thing, the Way of the Sith Quest dont terminates after running the redeem script, normaly it said that Uthar is dead and you spared Yuthura and she returend to her Master blabla.

I'd suggest you add another quest stage to the "The Way of the Sith" Journal Entry that marks the quest as finished and the text mentions that Uthar lies dead and you've swayed Yuthura to accompany you.

To do this you'll have to modify the global.jrl file. Entry number 96 in the Categories list appears to be the The Way of the Sith quest. So, add another Struct to its EntryList by copy/pasting one of the existing ones and make the following changes to it:
Set the Struct ID (called Type if you use the bioware GFF Editor) of the struct to 8 (the next number in sequence).
Set the End field to 1 (to make the quest completed when this stage is reached.
Set the ID field to 65.
Set the Text field to the text you want to show in the journal in-game. (Change the StrRef to -1 and then put your text as a localized substring with language id 0 (English).


Save the modified global.jrl file in your override folder.

Then add this to your recruit script as well, to update the journal with your new entry when Yuthura joins:
AddJournalQuestEntry("kor35_waysith", 65);


(Journal entries can be set directly from dialog nodes as well without using a script, which is probably how the other end stages of that quest are set. If you've added a new Recruit branch those nodes wouldn't be reached, and thus the journal stage unchanged.)
 Kitty Kitty
01-04-2007, 4:28 PM
#9
The problem with using this function in this particular case is that the party slot is not unique for Yuthura, if you check IsAvailableNPC(NPC_T3_M4) it would return true if either T3M4 is in the group (which it would be if Yuthura wasn't recruited) or if Yuthura is in the group. As long as any character is in party table slot 7 and isn't set to be unavailable it would return true.

Unfortunately you can't check any specifics about a character stored in the party table without first spawning it into the game world, so the easiest way of doing this check would be to set a new Global variable when she is recruited, and then use that variable to check if she's tagged along.

(Or you could check if she's in the active party and if not spawn in the character in T3M4's party table slot and examine it, but that feels like a pretty bothersome way of doing it. :))
Blah. I'd made an assumption while refreshing myself to some of the functions that not only could you use this to test if such a party member existed, but that you could get at least SOME basic information about them (such as perhaps their ID for example). Making assumptions is bad... making assumptions is bad.. Anyone got some more chalk? ;D

Other than that you could rig the OnEnter script like you describe, but it would require either modifying or replacing the script, which hopefully shouldn't be necessary in this case. And if you go by the delete route Yuthura would be spawned and then instantly deleted any time you entered the courtyard, since the area OnEnter script checks if the KOR_FINAL_TEST global number is 7 and if Yuthura doesn't already exist in the area, and if so spawns her, any time the area is entered.
Indeed. I would agree that a better method is to simply never have her spawn in the first place rather than always spawning her only to be immediately deleted. My somewhat cursory scan of things didn't turn up a simple way to handle that though, and the question posed was how to delete a character which, while perhaps not the ideal method, I could at least answer. ^_^

Though as far as script modification goes, compatability is exactly why I generally suggest doing it as I mentioned above. If you just rename whatever script is already being fired and then make a new one to do the things you need before firing the old (now renamed one) it's pretty simple to ensure compatability with just about anything. Or I suppose at least, I've never run into any significant problems yet when doing things that way. :)


Hmm, why should you avoid using globals? The only thing I can think of would be the headache of finding every place they are checked and make sure changes to them doesn't mess up some other sequence of the game if a script gets a global value it wasn't expecting. (FindRefs is really helpful for checking where variables are used, so at least you don't have to do it manually.) Anything I'm overlooking?
Nah, that's pretty much it, and really I should have said I prefer to avoid CHANGING globals (rather than using them), since obviously just checking them is one of the most simple ways of getting things done in many cases.

That reluctance is itself largely fueled by the fact that lots of the tools we have available now didn't exist the last time I actually did any real modding. I'm only recently returned from a rather long haitus, and re-learning as I go. Being able to quickly find everywhere a global is used would make a huge difference, as I still remember the days when changing a global pretty much meant a lot of pouring through files and then as much play-testing as possible waiting to see what else might be broken but not really knowing where to look. While that might be kinda 'fun' in a massochistic sense of the word, I think I'd much rather familiarize myself with FindRefs and retract my statement about avoiding globals. :D

I hope nobody feels stomped upon, that's not my intent by replying. I'm just sharing what I know if someone asks about something I happen to have any knowledge about. :)
Hehe! No, not at all. It was my attemp at a semi-humorous way of injecting some kudos and praise for you actually. I always enjoy reading the advice you post, since even on topics I have a pretty good handle on, I still usually manage to learn something.

Your recent explanation of bit fields for example was masterful. I've understood how they work for ages, but I don't think I've ever seen them so well explained in a way that people who aren't used to working with hex (let alone binary) could easily understand. Whole damn post should be stapled up on Wiki or someplace if you ask me. ;)


Yeah.. i realy like it to fight my way back trough the academy with Yuthura ^^ For me it also seemed that she can be recruited somehow, maybe she was once planed as DS Jedi to join, but then rejected :(
Get used to it. There's a whole lot of stuff in these games that was planned and never quite put in place. Right off the top of my head, digging around in script source, it looks like the whole fast-transit system was originally intended to be actually riding around on your own swoop bike you'd presumably keep in the Hawk. There's a bunch of stuff in II which indicates there was going to be a whole lot more to the racing too, such as several upgrades -probably tied to half those folks who'll talk about swoop racing but don't *really* serve any real purpose. And there's tons and tons of those kind of "left-overs" all over the place. ;p

I already tried it with GetObjectByTag command and then destroyobject, but i think its nessecary to be in the same Area as the Object you want to get and destory, or i made a mistake, i dunno
No mistake. You do indeed have to be in the area you want to Get/Destroy an object in, as Stoffe already mentioned. ^_^

I dont realy understand why you want to do that, but stoffe said enough about that ^^
Aye. I was going on the assumption that you could actually tell WHO was in a given party slot, which was my bad, and since you can't (without going through a whole lot of extra redundant hoops), it obviously isn't of value here.

But anyway, thx that you tried to help ^.^
My pleasure. :)

It's in my nature to try to help, even though as we've seen, I sometimes don't quite know what the heck I'm talking about. :lol:

-Kitt
 DarkPredator
01-04-2007, 7:39 PM
#10
A script can only manipulate objects within the module (area) that is currently loaded, since the game only has one area loaded at a time. So if you want to delete the character you'd need to do it when the Dantooine Courtyard Area is being entered, and you'd need to do it every time since she'd be respawned if she wasn't present while she should be there (according to the global variable mentioned).

Good to know °_°"


I'd suggest you add another quest stage to the "The Way of the Sith" Journal Entry that marks the quest as finished and the text mentions that Uthar lies dead and you've swayed Yuthura to accompany you.

Perfect again^^ It works now, this Substrings act a bit weird somtimes but after deleting all Strings and create a new one it finaly works ^^

Here the final recruit Script now:

void main()
{
RemoveAvailableNPC(NPC_T3_M4);
AddAvailableNPCByTemplate(NPC_T3_M4, "p_yuthura");
object oNPC = SpawnAvailableNPC(NPC_T3_M4, GetLocation(GetFirstPC()));
AddPartyMember(NPC_T3_M4, oNPC);
DestroyObject(GetObjectByTag("kor39_yuthura"));
SetGlobalNumber("KOR_FINAL_TEST", 4);
AddJournalQuestEntry("kor35_waysith", 65);
AdjustAlignment(GetFirstPC(),ALIGNMENT_DARK_SIDE,8 );
}



Your recent explanation of bit fields for example was masterful. I've understood how they work for ages, but I don't think I've ever seen them so well explained in a way that people who aren't used to working with hex (let alone binary) could easily understand. Whole damn post should be stapled up on Wiki or someplace if you ask me. ;)

Hihi, i totaly agree with that, i'm a total noob in modding but i learend really much trough this thread :)



Get used to it. There's a whole lot of stuff in these games that was planned and never quite put in place. Right off the top of my head, digging around in script source, it looks like the whole fast-transit system was originally intended to be actually riding around on your own swoop bike you'd presumably keep in the Hawk. There's a bunch of stuff in II which indicates there was going to be a whole lot more to the racing too, such as several upgrades -probably tied to half those folks who'll talk about swoop racing but don't *really* serve any real purpose. And there's tons and tons of those kind of "left-overs" all over the place. ;p

Yeah its really sad, but fortunatly there are a lot of Modders who try to make the Games better xD



My pleasure. :)

It's in my nature to try to help, even though as we've seen, I sometimes don't quite know what the heck I'm talking about. :lol:

^^ not the badest attitude i think :)
Page: 1 of 1