lfnetwork.com mark read register faq members calendar

Thread: spawning npc's from a script
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 08-29-2004, 03:01 AM   #1
Bell
 
Bell's Avatar
 
Join Date: Jun 2002
Posts: 461
spawning npc's from a script

Hiya,
anyone ever have trouble with spawning an npc with the use command?

I have..

use ( "cin1del1" );

affect ( "cin1del1", /*@AFFECT_TYPE*/ FLUSH )
etc. etc.

where cin1del1 is the targetname of the npc i want to spawn.

It spawns, but thats it, the script does not continue. If i remove the targetname from the npc and and remove the "use" lines of the script, it spawns when the map loads and the script continues.

any suggestions?


Bell is offline   you may: quote & reply,
Old 08-29-2004, 06:53 AM   #2
lassev
cryptoscripter
 
lassev's Avatar
 
Join Date: Jun 2002
Location: Finland
Posts: 1,087
That is indeed true. You cannot spawn an NPC in the script and then immediately affect him. It's proven failure. If you need the NPC for a cinematic, you can prespawn the NPC a little earlier (for example when the player triggers some trigger before the room), in a temporary location, and then set his origin to the intended place. That's how I did it. Obviously you can also use a spawnscript, for they should always work.

So, the use("targetname") works fine enough, but there needs to be a significant period of time between the use and the affect.

This may feel like a nasty thing, but that's just how it is.


Frozen by ICARUS
lassev is offline   you may: quote & reply,
Old 08-29-2004, 12:34 PM   #3
Bell
 
Bell's Avatar
 
Join Date: Jun 2002
Posts: 461
ah Mr. Lassev as always thanks
you're a great help


Bell is offline   you may: quote & reply,
Old 08-29-2004, 06:24 PM   #4
lassev
cryptoscripter
 
lassev's Avatar
 
Join Date: Jun 2002
Location: Finland
Posts: 1,087
If you prespawn the NPCs before the cinematic, you might want to turn the invisible. Otherwise the player will see them with force sense. Although not directly harmful, but it'd be nevertheless a technical glitch. But invisibility solves that quite easily. And like I said, the prespawning is OK to do just a little before the cinematic, so the NPCs won't really eat FPS for any significant period of time.

For example, if the player needs to walk to a room, and when he steps into the room through the door, a cinematic will launch. You can place a trigger little before the door. The trigger will target the NPCs that will spawn in a small, unreachable box belowe floors. They have a spawnscript setting them invisible (and any other things you might need). The player won't notice anything, but when he reaches the room, and the cinematic starts, you can just set_origin those NPCs to the room and turn them visible.

Smooth and clean. Or you can just run the cinematic from the NPCs spawnscript, or possibly target the NPC entity to a script_runner, which will run the cinematic (haven't tested this last one but should potentially work).


Frozen by ICARUS
lassev is offline   you may: quote & reply,
Old 08-30-2004, 03:49 AM   #5
Bell
 
Bell's Avatar
 
Join Date: Jun 2002
Posts: 461
most excellent. worked like a charm thanks


Bell is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > JediKnight Series > Editing Central > JA Mapping > spawning npc's from a script

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:14 PM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.