Jump to content

WHY WON"T THIS SCRIPT WORK!


Iconic985

Recommended Posts

Hey people.

 

I'm working on an arena style mod and I created this script to spawn an actor at an Xmarker when a button is pressed. Here is the script.

 

 

 

Scriptname AARestetButtonScript extends ObjectReference

ActorBase property ImperialSoldierDefender auto

ObjectReference property ImpDef01 auto

Event OnActivate(ObjectReference akActionRef)
ImpDef01.PlaceActorAtMe(ImperialSoldierDefender, 4)

EndEvent

(Note: ImpDef01 is the Xmarker and ImperialSoldierDefender is the actor)

 

 

It compiled and auto-filled properties correctly but guess what? when the button gets pressed, nothing happens! Someone please help!

Edited by Iconic985
Link to comment
Share on other sites

I admit that the only actor script I have have messed with thus far is the mannequin script but.....

 

Since you are spawning 4 soldiers, are you using four markers? If that does not work, I would try to add more actors to your script and instead tell it to spawn spawn each actor individually. (I hope that makes sense.)

 

Secondly, a dead actor is still theoretically a spawned actor. You will need to find a way to remove dead actors from your arena before it will spawn another. This can be tested by killing said actor, leaving, waiting for the cell to respawn (usually a month game time) and going back in and hitting the button again to see if it spawns a new actor.

 

EDIT: OR you can call a check to see if the actor is dead inside your event.

 

Again I only have one scripted mod so if others with more experience tell you otherwise you might want to listen to them instead.

Edited by SpectralDragon
Link to comment
Share on other sites

I'm fairly new to all this myself but I can take a crack at it. First off I'm not sure if you want the button to repeatedly spawn up to four actors with consecutive activations or if you want all four to spawn at once. If you want the latter then take a look at the Skeleton Horde script in the creation kit already. It's geared toward summoning multiple skeletons at once but you may be able to adapt it to your needs.

 

If you're looking for the former and want 1 at a time spawning you could do like SpectralDragon suggested and make multiple actors and have the script keep track of which ones to send out by using an Int count that increases by 1 with every activation of the button.

 

 

 

 

Actorbase Property ImperialSoldierDefender1 auto
Actorbase Property ImperialSoldierDefender2 auto
Actorbase Property ImperialSoldierDefender3 auto
Actorbase Property ImperialSoldierDefender4 auto

Int SoldierCount; [this keeps track of how many times the button has been activated]

EventOnActivate(ObjectReference akActionRef)
     SoldierCount == SoldierCount + 1; [this increases the activation count by 1 every time the button is activated]
          If SoldierCount == 1
               ImpDef01.PlaceActorAtMe(ImperialSoldierDefender1)
          elseIf SoldierCount == 2
               ImpDef01.PlaceActorAtMe(ImperialSoldierDefender2)
          elseIf SoldierCount == 3
               ImpDef01.PlaceActorAtMe(ImperialSoldierDefender3)
          elseIf SoldierCount == 4
               ImpDef01.PlaceActorAtMe(ImperialSoldierDefender4)
          else
               Debug.MessageBox("The button is no longer functioning"); [this can be whatever as long as it tells the game what to do after 4 activations]
          endIf
EndEvent

 

 

 

That's just a rough guestimate but hopefully it's heading in the direction you were looking for.

Edited by dkraz3175
Link to comment
Share on other sites

Thanks for the replies everyone!



I defiantly have not been clear enough about what I want to happen, or what is going on in the mod. Basically its a giant area. On each side of the arena there are two bases, a stormcloak one and Imperial one. The player has the ability to join sides and the battle rages back and forth through a large landscape until the opposing sides leader has been killed. What I need this script for is the ability to start the game, and reset it mid game. Thus from what you guys have told me, I must find a way to remove the actors from the cell as well. Also, how does one change the resepawn time on an actor? When one soldier dies I want him to respawn in around 30 seconds, not one month!



As always, all help is welcome and anyone wishing to help full-time with this project just say-so.



Thanks, :biggrin:


Link to comment
Share on other sites

UMF

 

Since I don't want to clutter up the Forum with a new thread I'll throw in another non-functioning Script as well;

 

Scriptname LFGNOTESCRIPT extends ObjectReference

Quest property LFGQ1  Auto  

bool found = false

Event OnRead()
 if (!found)
  Debug.Trace("LFGQ1: Found clue! ")
   if (LFGQ1.GetStage() != 10)
    LFGQ1.Start()
    LFGQ1.SetStage(10)
    LFGQ1.SetObjectiveDisplayed(10,1)
    found = true
  endif
endif

EndEvent

Here is what it's supposed to do: There is an advert placed at every hold in Skyrim for the player to read. If the player reads the advert to join a band of adventurers, it starts the Quest and points him or her in the right direction with a waypoint.

 

That's it. It's Not a super spell, not a hard logic puzzle, no scripted Air Zeppelin Battle - No, no all those scripts work perfectly in my quest.

 

Ironically It's this tiny little script I can't make work, and it's driving me up the wall because it's step uno, without it I can't properly test everything. It worked a month ago when I wrote it, what happened?

Link to comment
Share on other sites

@HipsterTerminator



For future reference its better to create your own thread than to hijack someone else's.



However just this once, I will try and help.



Try this script:



 


Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)


if (newContainer == Game.GetPlayer())


LFGQ1.SetObjectivedisplayed(Stage)


LFGQ1.SetStage(stage)


endif


EndEvent


 



This will make it so that they have to PICK UP the item (add it to their inventory).



Again, please go start your own thread if this is not what you are after.



(Source: http://www.creationkit.com/Bethesda_Tutorial_Basic_Quest_Scripting)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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