Jump to content

Help with script


razorkid

Recommended Posts

Could I get help with this script?

 

Quote

 

Scriptname reddawnassault extends ObjectReference

import game
import debug

Quest Property arnimareddawnquestbug Auto
Int Property StageToSet Auto
int property prereqStageOPT = -1 auto
Sound Property arnimacityalarm Auto
ActorBase property myNPC auto
ObjectReference property SpawnPlace auto
ActorBase property myNPC2 auto
bool property disableWhenDone = true auto
bool property doOnce = True auto


auto STATE waitingForPlayer
Event OnTriggerEnter(ObjectReference akActionRef)
if akactionref == getPlayer() as actor
; check to see if a pre-req stage was specificed and if it's been met
if prereqStageOPT == -1 || arnimareddawnquestbug.getStageDone(prereqStageOPT) == 1
; Start the quest just in case it isn't already running.
if arnimareddawnquestbug.isRunning() == FALSE
bool check = arnimareddawnquestbug.start()
; do a quick check in case the quest could not be started
if !check
; debug.trace("ERROR: "+arnimareddawnquestbug+" not started by "+self)
endif
endif



arnimareddawnquestbug.SetObjectiveDisplayed(30)
arnimareddawnquestbug.SetStage(30)
SpawnPlace.PlaceActorAtMe(myNPC, 2).StartCombat(Game.GetPlayer())
SpawnPlace.PlaceActorAtMe(myNPC, 2).StartCombat(Game.GetPlayer())
SpawnPlace.PlaceActorAtMe(myNPC, 2).StartCombat(Game.GetPlayer())
SpawnPlace.PlaceActorAtMe(myNPC, 2).StartCombat(Game.GetPlayer())
SpawnPlace.PlaceActorAtMe(myNPC2, 2).StartCombat(Game.GetPlayer())
SpawnPlace.PlaceActorAtMe(myNPC2, 2).StartCombat(Game.GetPlayer())
SpawnPlace.PlaceActorAtMe(myNPC2, 2).StartCombat(Game.GetPlayer())

Endif

EndEvent

endSTATE

STATE hasBeenTriggered
; this is an empty state.
endSTATE

I want to make it so when I enter the trigger, npcs spawn and then they STOP spawning without leaving the trigger, also to pass onto the next stage of the quest. The current issue is that waves of enemies keep spawning. Also the script activates when I enter the trigger without having started the quest.

Link to comment
Share on other sites

This is how I would do it.

I set up all variables as properties so that you can simply fill them in with the values you want.

Compilation has not been tested.

Scriptname YourScriptNameHere extends ObjectReference

Actor Property PlayerRef Auto
;auto-fills with player

Quest Property TheQuest Auto
;Quest you are working with

Int Property MinStageToBeDone Auto
;the minimum stage the MUST be completed

Int Property StageToSet Auto
;the stage you wish to set during first event

Int Property ObjectiveToDisplay Auto
;the objective you want displayed during first event

ActorBase[] Property NPCToSpawn auto
;an array that you will fill with the actors you want spawned.  One entry per instance

Int Property DiffLevel Auto
;difficulty level that the NPCs should spawn at -- 0 easy - 1 medium - 2 hard - 3 boss - 4 none

ObjectReference property SpawnPlace auto
;where you want the NPCs to be spawned

bool DoOnce = false
;true/false variable used to prevent additional spawning

Int Index = 0
;normally placed just outside the while loop BUT if placed here will act as a secondary measure to prevent future spawns.
;so even if the event were to trigger again should all the NPCs have been spawned no more will be spawned since the value of Index
;increases with each spawned NPC.

Event OnTriggerEnter(ObjectReference akActionRef)
  If akActionRef == PlayerRef
    If (MinStageToBeDone >= TheQuest.GetStage()) && (DoOnce == false)
      TheQuest.SetObjectiveDisplayed(ObjectiveToDisplay)
      TheQuest.SetStage(StageToSet)
      Int ArrayLength = NPCToSpawn.GetLength
      While Index < ArrayLength
        SpawnPlace.PlaceActorAtMe(NPCToSpawn[Index], DiffLevel).StartCombat(PlayerRef)
        Debug.Trace("Player enemy #"+Index+" has been spawned")
        Index += 1
      EndWhile
      DoOnce = true
    EndIf
  EndIf
EndEvent

Link to comment
Share on other sites

 

This is how I would do it.

I set up all variables as properties so that you can simply fill them in with the values you want.

Compilation has not been tested.

Scriptname YourScriptNameHere extends ObjectReference

Actor Property PlayerRef Auto
;auto-fills with player

Quest Property TheQuest Auto
;Quest you are working with

Int Property MinStageToBeDone Auto
;the minimum stage the MUST be completed

Int Property StageToSet Auto
;the stage you wish to set during first event

Int Property ObjectiveToDisplay Auto
;the objective you want displayed during first event

ActorBase[] Property NPCToSpawn auto
;an array that you will fill with the actors you want spawned.  One entry per instance

Int Property DiffLevel Auto
;difficulty level that the NPCs should spawn at -- 0 easy - 1 medium - 2 hard - 3 boss - 4 none

ObjectReference property SpawnPlace auto
;where you want the NPCs to be spawned

bool DoOnce = false
;true/false variable used to prevent additional spawning

Int Index = 0
;normally placed just outside the while loop BUT if placed here will act as a secondary measure to prevent future spawns.
;so even if the event were to trigger again should all the NPCs have been spawned no more will be spawned since the value of Index
;increases with each spawned NPC.

Event OnTriggerEnter(ObjectReference akActionRef)
  If akActionRef == PlayerRef
    If (MinStageToBeDone >= TheQuest.GetStage()) && (DoOnce == false)
      TheQuest.SetObjectiveDisplayed(ObjectiveToDisplay)
      TheQuest.SetStage(StageToSet)
      Int ArrayLength = NPCToSpawn.GetLength
      While Index < ArrayLength
        SpawnPlace.PlaceActorAtMe(NPCToSpawn[Index], DiffLevel).StartCombat(PlayerRef)
        Debug.Trace("Player enemy #"+Index+" has been spawned")
        Index += 1
      EndWhile
      DoOnce = true
    EndIf
  EndIf
EndEvent

 

The compilation brought an error with the get length

 

 

Starting 1 compile threads for 1 files...

Compiling "newreddawnscript"...

D:\Program Files (x86)\steamapps\common\skyrim\Data\Scripts\Source\temp\newreddawnscript.psc(40,47): no viable alternative at input '20'

No output generated for newreddawnscript, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on newreddawnscript

 

Link to comment
Share on other sites

Oops... add puddles after GetLength so that it is GetLength()

 

It happens from time to time that something minor like that is forgotten...

 

If you can still help, the minquest parameter doesn't seem to be working, as the quest still starts when you enter the trigger. Does the prereq object have any effect on when a trigger can activate?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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