PDA

View Full Version : permenantly stun an NPC on spawn?


Vox Kalam
02-10-2007, 05:00 PM
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?

stoffe
02-10-2007, 07:16 PM
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() {
// ST: coordinates to spawn the NPC at...
location lLoc = Location(Vector(0.0, 0.0, 0.0), 0.0);

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

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

Vox Kalam
02-10-2007, 07:56 PM
What if I spawned it using the module editor? Can I add the third line to the .utc's OnSpawn script?

stoffe
02-10-2007, 08:34 PM
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. :)

Vox Kalam
02-11-2007, 12:57 PM
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? :(

Pavlos
02-11-2007, 01:06 PM
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.

Vox Kalam
02-11-2007, 06:33 PM
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?

stoffe
03-03-2007, 03:31 PM
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.

deathdisco
03-03-2007, 04:56 PM
Check out this (http://www.lucasforums.com/showpost.php?p=2021727&postcount=4) and this (http://www.lucasforums.com/showthread.php?t=175828) thread for issues with the Module editor.