Jump to content

Home

Crashing Script


CorSton

Recommended Posts

hi all :)

 

I'm trying to figure out how to make a script for a droid: I want it crashes to the ground after someone tries to talk with him. No luck so far. I haven't found a good complete tutorial on the script matter neither...

Any suggestion?

 

Another little question: I'm trying [kotor1] to make this droid "wounded" at the start of the module (like T3 at the beggining of TSL). I have set the max hit points value to 30 and the base/current ones to 5... nothing.

 

thanks

:)

Link to comment
Share on other sites

to make him fall, make a dialogue (if you don't attach any words to be spoken you won't notice that there is a dialogue) and attach this script:

void main() {
object oNPC=GetObjectByTag("my_npc_tag");
AssignCommand(oNPC,ActionPlayAnimation(26,1.0,-1.0));
}

 

and to make him look injured when you enter the module, attach this script to the OnSpawn field in your NPC's utc file:

void main() {
PlayAnimation(28,1.0,-1.0);
}

 

Note the animation codes (26 for the dead animation and 28 for the injured animation) were taken from nwscript.nss for Kotor 1.. I haven't checked if the numbers are the same in Kotor 2 as I don't have the game with me.

Link to comment
Share on other sites

many thanks, darth333! :)

now, with your example, the sources in the BIF, and the "nwscript", I'm trying to understand how the whole thing works...

 

anyway, the first script in your post works fine, but the second has no output: for some reason, the LISTEN_INJURED has no effect on droids...

btw, thanks again ;)

Link to comment
Share on other sites

I guess maybe droids don't have injured animations. If they are damaged, they just emit smoke and sparks..

Therefore, you can try the following script:

 

void main()
{

// smoke = 1007
       // sparks = 4003

int iNumFX = 0;	
effect eSparks = EffectVisualEffect(4003);
effect eSmoke = EffectVisualEffect(1007);

effect eVFX = GetFirstEffect(OBJECT_SELF);

while (GetIsEffectValid(eVFX))
{
	if (eVFX == eSparks || eVFX == eSmoke) { iNumFX++; }
	eVFX = GetNextEffect(OBJECT_SELF);
}
if (iNumFX == 0)
{
	ApplyEffectToObject(DURATION_TYPE_INSTANT, eSparks, OBJECT_SELF);
	ApplyEffectToObject(DURATION_TYPE_INSTANT, eSmoke, OBJECT_SELF);
}


ExecuteScript("k_ai_master", OBJECT_SELF, 1001);

}

 

This should be droid's OnHeartbeat script which you can set in its UTC file. If you are planning to let player repair the droid at some point, the script would need extra work because in it's current form, the droid will be damaged permanently (at least visually).

Link to comment
Share on other sites

mmm, thanks for your help Xcom :)

I've placed the complied script on OnHeartbeat but my droid don't emit smoke and sparks from the beginning of the module: I've tried to put it onSpawn also, to see if emit something just once, but nothing...

any hint?

Link to comment
Share on other sites

Originally posted by CorSton

mmm, thanks for your help Xcom :)

I've placed the complied script on OnHeartbeat but my droid don't emit smoke and sparks from the beginning of the module: I've tried to put it onSpawn also, to see if emit something just once, but nothing...

any hint?

 

You're probably loading the savegame. Try loading the savegame from before you ever entered the area with the droid.

Link to comment
Share on other sites

Hmm.. I'm not sure. Make sure you didn't specify this script to run anywhere, other than OnHeartbeat.

I tested this and it worked okay.

 

BTW, what droid template are you using? Make sure that UTC file of the droid is unique.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...