Jump to content

[LE] Creating an Oblivion Invasion


nikolaf

Recommended Posts

Hey guys!

 

I'm trying to make an oblivion gate spawn enemies when you get close to it, to simulate an invasion, however, it seems that I'm missing something. I've created the gate, and added a trigger around it with the script, so when the player gets close, the weather changes, the gate activates, and leveled daedra start spawning every 15 seconds. If you leave the trigger it all stops.

 

 

The problem is, the weather changes correctly, but the gate animation and spawning doesn't work for some reason. I've set the properties correctly. I'm using the creation club "The Cause" gate model (the built-in script is set to false), if that helps. Here's the script:

Scriptname obliviongatespawnscript extends ObjectReference  

ActorBase Property Daedra Auto
ActorBase Property Dremora Auto
ObjectReference Property OblivionGate Auto
ObjectReference Property SpawnPoint Auto
Int DoLoop = 0
GlobalVariable Property Counter Auto
Weather Property newWeather Auto

Event onTriggerEnter(ObjectReference TriggerRef)

    If TriggerRef == game.GetPlayer()
        OblivionGate.GotoState("Open")
        DoLoop == 1
        While (DoLoop == 1)
            SpawnPoint.PlaceActorAtMe(Daedra, 0)
            SpawnPoint.PlaceActorAtMe(Daedra, 0)
            SpawnPoint.PlaceActorAtMe(Daedra, 1)
            SpawnPoint.PlaceActorAtMe(Dremora, 1)
            SpawnPoint.PlaceActorAtMe(Dremora, 2)
            Utility.Wait(15.0)
        EndWhile
    EndIf

    If (TriggerRef == Game.GetPlayer())
        newWeather.SetActive(True,True)
    Else
        Weather.ReleaseOverride()
    EndIf

EndEvent

Event onTriggerLeave(ObjectReference TriggerRef)

    If TriggerRef == game.GetPlayer()
        OblivionGate.GotoState("closed")
        OblivionGate.PlayAnimation("ForceClosed")
        DoLoop == 0
    EndIf

    If (triggerRef == Game.GetPlayer())
        Weather.ReleaseOverride()
    Endif

EndEvent

Anyone have any idea what is missing? Thanks in advance!

Link to comment
Share on other sites

I see a def problem. It wasnt spawning because Loop never equaled one

 

Loop == 1 aka with two equal signs is basically you confirming a bool. Change that to Loop = 1 to actually modify the value of the int. Keep using two equal signs when verifying current value

 

Above said, consider instead registering for updates while nearby and unregister when you leave the area. Tends to be better than while loops

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...