Jump to content

Home

Scripting a Party Member to die?


Aaron00018

Recommended Posts

Hi everyone,

 

I have created a party member which replaces hk47. I'm now at the part where near the end of the game, if the Player chose the dark side , and they return to the beach with Bastila,

 

Well, in the dialogue I have the party member "Master Aaron" (who replaced hk47), tell the Player , that they are making a mistake, and the reply from the Player is to force choke him to death.

 

I have got this in the script :

 

void main()

{

RemoveAvailableNPC(3);

}

 

- and that takes the member out of the party selection screen, but what I don't know is what to add to this script so that, Master Aaron falls dead and stays laying on the ground.

 

As of this moment, he remains alive, though he is removed from the party, once they enter the ship from that scene.

 

any help would be greatly appreciated, thank you, and God Bless.

 

Aaron

Link to comment
Share on other sites

Hi everyone,

 

I have created a party member which replaces hk47. I'm now at the part where near the end of the game, if the Player chose the dark side , and they return to the beach with Bastila,

 

Well, in the dialogue I have the party member "Master Aaron" (who replaced hk47), tell the Player , that they are making a mistake, and the reply from the Player is to force choke him to death.

 

I have got this in the script :

 

void main()

{

RemoveAvailableNPC(3);

}

 

- and that takes the member out of the party selection screen, but what I don't know is what to add to this script so that, Master Aaron falls dead and stays laying on the ground.

 

As of this moment, he remains alive, though he is removed from the party, once they enter the ship from that scene.

 

any help would be greatly appreciated, thank you, and God Bless.

 

Aaron

 

You would need to bring his health to zero, then he should automatically play the death anims and your work is solved.

 

So, I would experiment with this:

Show spoiler
(hidden content - requires Javascript to show)
void mani() 
{
       object oTarget = GetObjectByTag("<YOUR TAG HERE>");
       int iHealth = GetCurrentHitPoints(oTarget);
       effect eDamage = EffectDamage(iHealth);

       AssignCommand(oTarget, ActionPlayAnimation(116);
       ApplyEffectToObject(DAMAGE_TYPE_INSTANEOUS, eDamage, oTarget);
}

Link to comment
Share on other sites

So, I would experiment with this:

void mani() 
{
       object oTarget = GetObjectByTag("<YOUR TAG HERE>");
       int iHealth = GetCurrentHitPoints(oTarget);
       effect eDamage = EffectDamage(iHealth);

       AssignCommand(oTarget, ActionPlayAnimation(116);
       ApplyEffectToObject(DAMAGE_TYPE_INSTANEOUS, eDamage, oTarget);
}

 

Actually, instead of checking the character's hitpoints and then slapping damage on him equal to his hit points, you could just call the death effect.

 

void main()
{
  object oTarget = GetObjectByTag("<YOUR TAG HERE>");
  effect eDeath = EffectDeath();

     RemoveAvailableNPC(3);
     ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oTarget);
}

 

This way you're lessing likely to run into problems with KotOR messing up and failing to grab the target's health (not a likely error to occur granted, but KotOR is not known for being the most cooperative game to mod).

 

Actually, if you want to make the guy look like he's being choked for a few seconds before dying you could do a script like this:

 

void main()
{

ActionPauseConversation();

  object oTarget = GetObjectByTag("<YOUR TAG HERE>");
  object oPC = GetFirstPC();
  effect eChoke = EffectChoke();
  effect eDeath = EffectDeath();

     RemoveAvailableNPC(3);

        AssignCommand(oPC, ActionDoCommand(ActionCastFakeSpellAtObject(9, oTarget, PROJECTILE_PATH_TYPE_DEFAULT))); //This makes the player look as if he/she is casting a force choke

           DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_CHOKE), oTarget)); //Makes the texture flash that's signature to the choke appear around the target's neck
           DelayCommand(0.8, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eChoke, oTarget, 3.5)); //Actually applies the choking effect
           DelayCommand(4.32, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oTarget));


DelayCommand(6.0, ActionResumeConversation());

}

 

This way, the conversation will pause on the node, remove Aaron from the party, have the PC cast a choke, have Aaron choke, then have Aaron die. Then, once he falls to the ground, resume the conversation. You might want to have a static camera set for this scene, so you can see both the player and Aaron.

Link to comment
Share on other sites

Hey thank you all very much!

 

I just woke got to the computer, here its 8:28 a.m. , and have yet to try out all that everyone has suggested here. Yet I'm definitely going to try out each one, then I will report back my results at this post.

 

Fallen Guardian, Fair Strides 2 and supreme kotor, I thank you all very much, and God bless ya all for replying.

 

I'll post my results here.

 

Oh one question more (and take in mind please, I am still extremely new at all this):

 

when you have "(your tag here)" am I suppose to put something either than that? the character party member i replaced with 'Master Aaron' was hk47.

 

and also, here:

 

(DURATION_TYPE_INSTANT, eDeath, oTarget)

 

would I put that whole thing? or just 'edeath' ? and would I keep the brackets?

 

Oh, and Fallen Guardian, when you said " have a static camera set for this scene, so you can see both the player and Aaron." I'm not too sure how to do that, and I really like that idea!

 

once again, thank you for your replies.

Link to comment
Share on other sites

I'm guessing at here:

 

 

object oTarget = GetObjectByTag("<YOUR TAG HERE>");

 

I would place my character's utc file there? so my file is p_Aaron2.utc

 

And so I imagine I would do this?

 

 

object oTarget = GetObjectByTag("p_Aaron2");

 

?

Link to comment
Share on other sites

I been working on this, and so far the results are the following, (I still appreciate all the replies though and appreciate any more):

 

Fair Strides, when I try yours, and try to compile it, it says there's an error, I'm using the kotor tool text editor.

 

Fallen Guardian, I've tried your first one, and it compiles fine, yet "Master Aaron" still is alive after the dialogue is finished...

 

I'll keep working on this and check back here later.

 

once again I do thank you for your help anyone whom does.

Link to comment
Share on other sites

1) You noticed he typo'ed "main" as "mani", right? And fixed that? Still gives an error then?

2) Then you probably typed the wrong tag. It's what's under 'tag' in the .utc

 

Thank you Hassat Hunter, I actually did NOT notice that!!!

 

I'm going to try it out right now and get back to this post later.

 

Thank you I had not realized that!

Link to comment
Share on other sites

This is what I have:

 

void main()

{

object oTarget = GetObjectByTag("p_Aaron2");

int iHealth = GetCurrentHitPoints(oTarget);

effect eDamage = EffectDamage(iHealth);

 

AssignCommand(oTarget, ActionPlayAnimation(116);

ApplyEffectToObject(DAMAGE_TYPE_INSTANEOUS, eDamage, oTarget);

 

RemoveAvailableNPC(3);

 

}

 

 

 

When I compile that, it says :

 

"Remove_Aaron.nss(7) : Error: Syntax error at ";"

Compilation aborted with errors"

Link to comment
Share on other sites

2) Then you probably typed the wrong tag. It's what's under 'tag' in the .utc

 

hold on a tick, ... I think because my character replaces HK47, then , the tag would be "HK47" ...

 

I'll try that out. instead of the name of my utc file which is p_Aaron2.utc

 

(Well its a few moments , and now I'm editing this post to say the following)

 

I changed it from "p_Aaron2" to "HK47", which is the tag, yet it still has the same message...

 

I'm quite stuck...

 

Hmmm.. I think , I'll try some more things, with that which was given by Fallen Guardian and Fair Strides...

 

once again any more help by anyone is appreciated.

Link to comment
Share on other sites

MISSION ACCOMPLISHED!!!

 

IT WORKED!!! I'm soo happy! It worked! The one that worked for me is this:

 

void main()

{

object oTarget = GetObjectByTag("HK47");

effect eDeath = EffectDeath();

 

RemoveAvailableNPC(3);

ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oTarget);

}

 

I used Fallen Guardian's first code, and I took the advice you told me , Hassat Hunter,

and checked my tag again for my utc file.

 

It was 'HK47', I then placed that in the area where it's suppose to, and voila!

 

Now, my character falls down dead! Thank you everybody!!!

 

Your ALL awsome!

 

God bless ya all! Thank you thank you thank you!

Link to comment
Share on other sites

Show spoiler
(hidden content - requires Javascript to show)

Oh one question more (and take in mind please, I am still extremely new at all this):

when you have "(your tag here)" am I suppose to put something either than that? the character party member i replaced with 'Master Aaron' was hk47.

I'm guessing at here:


object oTarget = GetObjectByTag("<YOUR TAG HERE>");

I would place my character's utc file there? so my file is p_Aaron2.utc

And so I imagine I would do this?


object oTarget = GetObjectByTag("p_Aaron2");

?


You don't want to put the UTC filename in that spot, you want to put the UTC's tag. If you open up the UTC in KotOR Tool, on the first editing slot it opens up to, you should see a box labeled "tag." Whatever is in there would be what you put between the quotes in GetObjectByTag("");. Whenever I make UTC files I find it much easier to keep the tag, template resref and filename all the same so I'm never confused as to which name I should use for a script.

and also, here:

(DURATION_TYPE_INSTANT, eDeath, oTarget)

would I put that whole thing? or just 'edeath' ? and would I keep the brackets?


Basically, you can just copy that whole script I posted, put Aaron's tag in the right place, compile it and you'll be golden. Everything will work in-game.


Oh, and Fallen Guardian, when you said " have a static camera set for this scene, so you can see both the player and Aaron." I'm not too sure how to do that, and I really like that idea!

once again, thank you for your replies.


I'll quote the part of this tutorial, by Tupac Amaru, on static cameras.

A placeable camera shows a static view. Such cameras can be added with KT's module editor. Just right-click on the map to place a camera at that spot. If the map is not available for KT you have to edit the module .git file with K-Gff yourself. Don't use Bioware's GFFEditor for this as it can't handle the camera fields. Copy&paste an existing camera structure and change its CameraId to something unique.

Then you have to edit the postion, pitch and orientation for the camera.

The position consists of three values: x, y and z. You can get those with the whereami armband.

Pitch allows to tilt the camera up and down and is measured in degrees. 0 will make it look down on the floor, 90 is a horizontal view.

Panning the camera to the left or right (rotating around the z-axis) is done in the orientation field. The game doesn't use an angle, but quaternions for this. With KT all you have to do is specify the yaw angle and it will do the conversion to quaternions. Otherwise you have to calculate the four orientation values yourself:

Field 1 = cos(angle / 2)
Field 2 and 3: always leave at 0
Field 4 = sin(angle / 2)


angle = 0 points the camera in the direction of the y-axis. The angle is measured counter-clockwise in degrees from that point. At least it's been that way in the modules I have modded. The formula does not work if you want to rotate the camera around more than one axis.

Other fields for a camera:

Height: is added to the z-value.
FieldOfView: works like a zoom. Standard values seem to be 50-60.
MicRange: no idea. Best left at 0 I guess.


Since the .git file is modified it needs to be repackaged together with the .ifo and .are into a .rim file and the .rim placed into the Modules folder. The camera won't work if you have already entered that module before either.


So, a couple things about that tutorial. First off, the part I highlighted in red - you more than likely won't find a KotOR tool map for the Unknown World Beach, or most of the maps, for that matter, so just ignore that bit there.

Second, you will need the K-GFF editor as the tutorial said, so to get that go here (remember, that's the K-GFF editor by tk102, not the BioWare-made GFF editor. BioWare's will break static cameras).

Third, the tutorial mentions the whereami armband which, if I'm not mistaken, is a KotOR 2 utility. Anyway, I prefer this tool which is initially for KotOR 1 anyway. I prefer this tool because it provides orientation information and what objects are closest to the player, in addition to just the position. Alternatively, if you don't want to bother with any armbands or anything, you can just use the whereami cheat. When in-game, press the ~ key and then type in "whereami" without the quotes, and the game will give you the location of whatever character your currently playing as.

Fourth, the tutorial tells you to repack everything into a .RIM file and place it in the modules folder when you're done. DON'T do that. That will replace the game's original file - and that's something you never want to do. Instead, extract every resource from the module, replace the old GIT file with your new one, then repack it all into a .MOD and place that in the modules folder.


Show spoiler
(hidden content - requires Javascript to show)
Fallen Guardian, I've tried your first one, and it compiles fine, yet "Master Aaron" still is alive after the dialogue is finished...


Again, probably due to the tag issue I mentioned at the top of my post.

This is what I have:

void main()
{
object oTarget = GetObjectByTag("p_Aaron2");
int iHealth = GetCurrentHitPoints(oTarget);
effect eDamage = EffectDamage(iHealth);

AssignCommand(oTarget, ActionPlayAnimation(116);
ApplyEffectToObject(DAMAGE_TYPE_INSTANEOUS, eDamage, oTarget);

RemoveAvailableNPC(3);

}



When I compile that, it says :

"Remove_Aaron.nss(7) : Error: Syntax error at ";"
Compilation aborted with errors"


hold on a tick, ... I think because my character replaces HK47, then , the tag would be "HK47" ...

I'll try that out. instead of the name of my utc file which is p_Aaron2.utc

(Well its a few moments , and now I'm editing this post to say the following)

I changed it from "p_Aaron2" to "HK47", which is the tag, yet it still has the same message...

I'm quite stuck...

Hmmm.. I think , I'll try some more things, with that which was given by Fallen Guardian and Fair Strides...

once again any more help by anyone is appreciated.


For the script you're having trouble compiling, simply insert an extra parentheses at the end of AssignCommand(oTarget, ActionPlayAnimation(116);, such as it is below:

void main() 
{
       object oTarget = GetObjectByTag("p_Aaron2");
       int iHealth = GetCurrentHitPoints(oTarget);
       effect eDamage = EffectDamage(iHealth);

       AssignCommand(oTarget, ActionPlayAnimation(116));
       ApplyEffectToObject(DAMAGE_TYPE_INSTANEOUS, eDamage, oTarget);

       RemoveAvailableNPC(3);

}



As for the HK-47 theory, open up Aaron's UTC file and look for a box like the one in the picture I've highlighted below. Use whatever is there for the tag parts of the scripts.

b6ak5j.jpg



EDIT: Well, it looks like I was a bit too late to sort out the scripting stuff, but I guess my static camera advice might still help out. I'll hide the scripting stuff so it isn't so obtrusive. By the way, you'll need to use the second script I posted if you want Aaron to choke for a bit before dying, otherwise there isn't really a point for the static camera.
Link to comment
Share on other sites

Fallen Guardian, thank You extremely much too!!!

 

It helps alot what you just told me! I just read through it all, and it's Totally helpful !

 

Your reply to me and along with other posts, I know for a Fact I'm going to be coming back to alot. :)

 

It's very interesting that you mentioned the K-GFF editor, because that's what I actually use, along with the kotor tool. I found using the K-GFF editor I can figure out how to add the journal entries, and other things, then I use the kotor tool to help me add things to that character such as robes, lightsabers etc, and to change the HP and force points and stuff.

 

Very usefull. I'm still very new at all of this. So everything is quite overwhelming, yet I'm gonna keep with it to learn to create more with it.

 

I will definitely take a look into the camera stuff you spoke about. I got a long ways to go . LOL.

 

I'm jumping with joy right now though because your code did just what I wanted it to do!

 

I mean this totally, you (and everyone here who helps people like me), are just AWSOME!

GREAT! FANTASTIC!!!

 

Fallen Guardian, thank you kindly! And thank you everyone else as well!!

 

God bless You!

Link to comment
Share on other sites

Fallen Guardian, I just used your other code, where it shows "Master Aaron" choking, and that's PRECISELY what I wanted!!!

 

Man, I am "over the moon" about this! God am I ever happy!

 

Thank You! I truly Thank You!

 

I'm barely "holdin it togetha" LOL! Jumping outa my seat here!

 

I haven't worked with changing the camera yet, but I definitely will do eventually.

 

Once again! YOUR THE BEST!!! THANK YOUUUS!!!

 

(Bows down)

 

Talk about da Jedi Master of scriptin or what!

 

anyhow I'm offline for the moment , laters and thank you!!! God Bless you!

Link to comment
Share on other sites

This is what I have:

 

void main()

{

object oTarget = GetObjectByTag("p_Aaron2");

int iHealth = GetCurrentHitPoints(oTarget);

effect eDamage = EffectDamage(iHealth);

 

AssignCommand(oTarget, ActionPlayAnimation(116);

ApplyEffectToObject(DAMAGE_TYPE_INSTANEOUS, eDamage, oTarget);

 

RemoveAvailableNPC(3);

 

}

 

 

 

When I compile that, it says :

 

"Remove_Aaron.nss(7) : Error: Syntax error at ";"

Compilation aborted with errors"

That's because you only have one closing bracket, but 2 opening brackets in;

AssignCommand(oTarget, ActionPlayAnimation(116);

Should be

AssignCommand(oTarget, ActionPlayAnimation(116));

 

Late, but helpful for later.

Link to comment
Share on other sites

MISSION ACCOMPLISHED!!!

 

IT WORKED!!! I'm soo happy! It worked! The one that worked for me is this:

 

void main()

{

object oTarget = GetObjectByTag("HK47");

effect eDeath = EffectDeath();

 

RemoveAvailableNPC(3);

ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oTarget);

}

 

I used Fallen Guardian's first code, and I took the advice you told me , Hassat Hunter,

and checked my tag again for my utc file.

 

It was 'HK47', I then placed that in the area where it's suppose to, and voila!

 

Now, my character falls down dead! Thank you everybody!!!

 

Your ALL awsome!

 

God bless ya all! Thank you thank you thank you!

 

Three small things:

 

1. Way to go for making it work!

 

2. Sorry, I hardly ever make typos on here...

 

3. A hint for the future: click the hash mark button (#) in the font editing panel and then your code to make it present nicely, and also enclose the entire coded section with HIDDEN and /HIDDEN both wrapped in [], with the second hidden marking the end of the hidden section. This makes the post easier to read, and if you want to check how it looks, I would suggest using the preview post button before actually posting.

 

Hope it helps! And I can't wait for the release.

Link to comment
Share on other sites

Thank you Hassat Hunter and Fair Strides, I totally and completely appreciate your replies!

 

I mean it, every single bit of advice , helps me Bigtime!

 

I will take all your advice, and most definitely be coming back to this webpage many times.

 

There are alot of, (probably simple) things which I should know about, that I don't. And I wish someone had a real step-by-step video on youtube, and I mean like little baby steps, explaining Everything.

 

For example, I suspect that there is a much easier way to put the files in a nice package, than the way I have mine presently. Yet the only thing I can do is put everything into the "override" folder (except for the sound files of course). And that to me, makes it extremely difficult to know what files are for what modification I'm working on...

 

I'm guessing that most people here know a much better way. I have tried using the other software tools around here, for creating projects, but even that I find difficult to understand.

 

Anyhow I won't go into long detail bout that, I think that might be for a future question perhaps.

 

What I truly want to say is , God Bless you all for your kindness to me for replying with helpful guidance. It may seem to others as a small act, yet to me, being able to do ANY of this modification to practically my most FAVORITE Game Ever (the second is my favorite too), feels so Great!!!

 

And to have you kind folks replying with helpful advice, shows me that there are still nice people on forums today. :)

 

So once again, thank you very much.

 

God Bless!

 

-Aaron

Link to comment
Share on other sites

For example, I suspect that there is a much easier way to put the files in a nice package, than the way I have mine presently. Yet the only thing I can do is put everything into the "override" folder (except for the sound files of course). And that to me, makes it extremely difficult to know what files are for what modification I'm working on...

 

I'm guessing that most people here know a much better way. I have tried using the other software tools around here, for creating projects, but even that I find difficult to understand.

 

Wait, you're putting everything for the module in the override? Including the GIT, IFO and ARE files? DON'T do that. Putting things in the override makes them overridden everywhere in the game. For example, if there's a Republic soldier UTC used in two different areas, and you put a modified version of that UTC in the override, then it's quite possible that Republic soldier will no longer function properly in one, or both, of the modules. When making modifications to a module you want to use this tool by stoffe. This lets you take everything in the module and pack it into one .MOD file, which can then be placed in the modules folder - not the override.

Link to comment
Share on other sites

Wait, you're putting everything for the module in the override? Including the GIT, IFO and ARE files? DON'T do that. Putting things in the override makes them overridden everywhere in the game. For example, if there's a Republic soldier UTC used in two different areas, and you put a modified version of that UTC in the override, then it's quite possible that Republic soldier will no longer function properly in one, or both, of the modules. When making modifications to a module you want to use this tool by stoffe. This lets you take everything in the module and pack it into one .MOD file, which can then be placed in the modules folder - not the override.

 

 

Thank you VERY much. I completely appreciate that advice, Fallen Guardian.

 

:)

 

I didn't know that before.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...