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.

permenantly stun an NPC on spawn?

Page: 1 of 1
 Vox Kalam
02-10-2007, 5:00 PM
#1
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, 7:16 PM
#2
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, 7:56 PM
#3
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, 8:34 PM
#4
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
#5
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, 1:06 PM
#6
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, 6:33 PM
#7
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, 3:31 PM
#8
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, 4:56 PM
#9
Page: 1 of 1