one_must_fall Posted August 6, 2006 Share Posted August 6, 2006 Hi i need help with a spawn npc script. I have the script already, but how do i make it so the npc spawns when i kill a certain person? the tutorial covers spawning an npc when you enter an area but it doesn't cover spawning when a certain person dies. Link to comment Share on other sites More sharing options...
stoffe Posted August 6, 2006 Share Posted August 6, 2006 Hi i need help with a spawn npc script. I have the script already, but how do i make it so the npc spawns when i kill a certain person? the tutorial covers spawning an npc when you enter an area but it doesn't cover spawning when a certain person dies. You could make the OnDeath event AI script of the killed NPC spawn the other NPC. As an example, this modified OnDeath AI script would spawn a new NPC (at coordinates 1.0, 1.0, 1.0) that attacks the killer whenever the NPC it is assigned to is killed: void main() { vector loc; loc.x = [color=Yellow]1.0[/color]; // x coordinate in world loc.y = [color=Yellow]1.0[/color]; // y coordinate in world loc.z = [color=Yellow]1.0[/color]; // z coordinate (elevation) in world object oSpawned = CreateObject(OBJECT_TYPE_CREATURE, "[color=Yellow]NPCResRef[/color]", Location(loc, 0.0)); AssignCommand(oSpawned, ActionAttack(GetLastKiller())); ExecuteScript("k_ai_master", OBJECT_SELF, 1007); } Link to comment Share on other sites More sharing options...
one_must_fall Posted August 6, 2006 Author Share Posted August 6, 2006 wait, that script would make the person i spawn attack me if i kill someone? well, i'm doing a recrutment mod, and i need to make it so if i kill the new member instead of letting him join me, atton spawns outside of the room, runs in and starts a conversation with me. I don't want atton to be a hostile, still a friendly. Link to comment Share on other sites More sharing options...
stoffe Posted August 6, 2006 Share Posted August 6, 2006 wait, that script would make the person i spawn attack me if i kill someone? well, i'm doing a recrutment mod, and i need to make it so if i kill the new member instead of letting him join me, atton spawns outside of the room, runs in and starts a conversation with me. I don't want atton to be a hostile, still a friendly. It was merely an example of how it could be used, since I didn't know anything about your particular case. You can replace everything in that script except the last line with what you have in your own script. As long as you keep the last line in the script (the ExecuteScript() line) it should work properly. Then you assign the script to the OnDeath script field in the UTC file for the NPC who should get killed. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.