I've got a script that works but i need a little help refining it to work more fluidly and possibly more efficiently.
Scriptname plagueTestScript extends QuestSpell property plagueSpell autoEvent OnInit()Debug.MessageBox("You've got the plague.")RegisterForSingleUpdateGameTime(0.03)endEventEvent OnUpdateGameTime()Actor randomActor = Game.FindRandomActorFromRef(Game.GetPlayer(), 500)while (randomActor.HasSpell(plagueSpell))randomActor = Game.FindRandomActorFromRef(Game.GetPlayer(), 500)endWhilerandomActor.AddSpell(plagueSpell , false)Debug.Notification("A new actor has the plague")RegisterForSingleUpdateGameTime(0.03)endEvent
Problems with this script so far:
- Walking into a group of people causes 1 person to get the plague and then there is a wait for the next UpdateGameTime before someone else can get it. (I have consider just putting in 10 FindRandomActorFromRef lines with 10 proceeding while loops, thoughts?)
- For system efficiency reasons, I want to avoid such a fast RegisterForSingleUpdateGameTime.
- Game.FindRandomActorFromRef(Game.GetPlayer(), 500) sometimes returns the player, an obviously inefficient roll of the dice.
