lfnetwork.com mark read register faq members calendar

Thread: Spawn script [TSL]
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 06-27-2007, 05:52 AM   #1
Mindtwistah
Junior Member
 
Mindtwistah's Avatar
 
Join Date: Apr 2007
Location: Derka Derka
Posts: 470
Spawn script [TSL]

What script is there for TSL to make enemies keep respawning? Like on the mod planet Sirat where zombies kept respawning.


Mindtwistah is offline   you may: quote & reply,
Old 06-27-2007, 06:44 AM   #2
stoffe
Network Caretaker
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,833
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by Mindtwistah
What script is there for TSL to make enemies keep respawning? Like on the mod planet Sirat where zombies kept respawning.
If you want the same enemies to come over and over you can either make a script that resurrects and heals the existing enemies shortly after they die, or you can make a script that spawns a new enemy when an one dies. Both of these can be accomplished by giving the endless NPCs a custom OnDeath event script.

A simple such script could look like this for KOTOR 2:

Code:
void main() {
    if (!GetLocalBoolean(OBJECT_SELF, 87)) {
        vector vCoordinates;
        vCoordinates.x = 0.0; // X coordinate in world to spawn new NPC
        vCoordinates.y = 0.0; // Y coordinate in world to spawn new NPC
        
        
        object oNew = CreateObject(OBJECT_TYPE_CREATURE, "NameOfUTCfile", Location(vCoordinates, 0.0));
        ExecuteScript("k_ai_master", oNew, 1003);
        
        SpeakString("GEN_I_AM_DEAD", TALKVOLUME_SILENT_TALK);
        SpeakString("GEN_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);            
    }
}
Set 0.0 to the X coordinate and 0.0 to the Y coordinate within the area where you want the respawning NPC to appear, and NameOfUTCfile to the name of the UTC template to create the new NPC from. Then compile the script and put its name in the "OnDeath" field on the Scripts tab in the UTC editor.

This way the player would be confronted by a never-ending wave of NPCs, but there would only be the same number of them as was originally placed there at any given time. To give a bit more variety you'll probably want to make a unique UTC template for each of the initial batch and give them their own copy of the script with different coordinates and respawn UTC template set.

Last edited by stoffe; 06-27-2007 at 07:44 AM.
stoffe 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 > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > Spawn script [TSL]

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 On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:42 PM.

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