Hellscreamy Posted June 21, 2014 Share Posted June 21, 2014 (edited) Short question:How can I spawn npc's dynamically and make sure they and other actors of that actorbase count towards a kill count for a quest, but not before the quest has started? I prefer not to add the scripts directly to the actor as they may also count towards other quests which shouldn't progress unless started. Long version:I'm trying to create a simple 'Kill X amount of actors' quest. The idea is to spawn the actors so the player cannot accidentally kill them before the quest has started. The reason I don't want to disable them is because I want to have a large number of npc's in the area but I'm afraid placing them in the cell would still impact performance even though they're disabled. I was thinking of using an Alias with a base npc to spawn, then create them at the xmarkers when the quest has started. I'll also need to dynamically add the OnKill event script to them as they aren't quest specific npc's. The order in which they're killed doesn't matter, but all spawned npc's should apply for the quest. If possible I also would like to see the Objective arrows above their heads when they've spawned. Is there a way to do what I want, I've some experience with using Papyrus and quests. Telling me where I can find a similar quest to what I want would be enough too. EDIT: I'm currently trying to create a script that would let me spawn actors based on an Actorbase, but I'll probably need a way to attach another script to the actors. To me this doesn't seem like the correct way to handle this, but I'm out of ideas. I'm also having some issues getting everything working, GetRef() isn't recognized while extending Quest of ObjectReference Scriptname aaTQ02QuestScript extends Quest Int Property cowsKilled = 0 Auto Int Property cowsKilledTotal = 3 Auto ActorBase Property EnemyType Auto Alias Property Alias_CowActivator Auto Actor[] cows ;An array containing all the cows spawned by the script Function SpawnActors() cows = new Actor[3] ; can't use Property for some reason, this is cowsKilledTotal int i = 0 While i < cowsKilledTotal ; cows[i] = Alias_CowActivator.GetRef().PlaceAtMe(EnemyType) as Actor ; casts the created cow as an Actor into the array ; attach Actor script with OnDying Function to cows[i] i += 1; EndWhile EndFunction Edited June 22, 2014 by Hellscreamy Link to comment Share on other sites More sharing options...
Recommended Posts