Jump to content

Home

permenantly stun an NPC on spawn?


Vox Kalam

Recommended Posts

Posted
Two years, and I still suck at modding...

How does one cause an NPC to appear stunned (and stay that way) as soon as they're spawned?

 

Do you spawn the NPC from a script? In that case you can apply a Stun effect to it right after you've spawned it, for example:

 

void main() {
[color=PaleGreen]// ST: coordinates to spawn the NPC at...[/color]
   location lLoc = Location(Vector(0.0, 0.0, 0.0), 0.0);

   [color=PaleGreen]// ST: Spawn an NPC from TemplateName.utc at above location.[/color]
   object oNPC = CreateObject(OBJECT_TYPE_CREATURE, "TemplateName", lLoc);

   [color=PaleGreen]// ST: Stun the just spawned  NPC.[/color]
   DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectCutSceneStunned(), oNPC));
}

Posted
What if I spawned it using the module editor? Can I add the third line to the .utc's OnSpawn script?

 

It should work if you add the last line from the above script to the OnSpawn, and substitute oNPC with OBJECT_SELF on that line. Just keep in mind that you should make a copy of the OnSpawn script and not edit the standard k_def_spawn01 script, or every NPC in the game will end up stunned. :)

Posted

Agh! I tried doing that, but I can't see if it worked. I saved the changes I made to the .MOD file last night, and opened it again today with the module editor, but when I try to build the mod file, it gives me an error message. Something about object reference not set to instance of object...or something like that...

What did I do? :(

Posted
Agh! I tried doing that, but I can't see if it worked. I saved the changes I made to the .MOD file last night, and opened it again today with the module editor, but when I try to build the mod file, it gives me an error message. Something about object reference not set to instance of object...or something like that...

What did I do? :(

 

I seem to remember that KotOR Tool's module editor will freak out on you if you have anything in it with a file name over 16 characters long (the game doesn't allow template resrefs of over 16 characters either). Check your module folder for files of over 16 characters.

Posted

Eek! Now I can't even load the saved project into the module editor at all to edit it!

"Unable to read beyond the end of the stream"

I think KOTOR tool secretly hates me... :(

 

Edit: Anyone?

  • 3 weeks later...
Posted
Eek! Now I can't even load the saved project into the module editor at all to edit it!

"Unable to read beyond the end of the stream"

I think KOTOR tool secretly hates me... :(

 

Edit: Anyone?

 

Can you open the module file with an ERF editor, and if so the files inside (GIT/ARE/IFO) with a GFF editor still? If not they have probably been corrupted and you have to fall back to an older backup copy. The KotorTool module editor is still a bit rough around the edges and problems can occur when using it.

Archived

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

×
×
  • Create New...