Jump to content

[LE] (TIMED) Magical Ambush Script. A Script I wanted to Share (and possibly some input on improving it!))


Medabev

Recommended Posts

You can't enable/disable the entirety of an array like that (MyObjects.Enable()). In the function you need to use the same method as you used in the OnInit event, as to do something to every element in the array. Using the while loop method I showed you, is the only way to do this.

 

Also, I don't see what you're doing in the the OnInit block. Your calling "MyObjects[iCount]" in a line on its own, which does... nothing... and the next two lines you're just disabling and enabling for no reason, since you're toggling the enable state to whatever it needs to be with the function call just afterwards.

Link to comment
Share on other sites

I think you want to do something like this:

    int index = MyObjects.Length
    
    while index
        index -= 1
        MyObjects[index].Enable()
    endwhile
    
 

But yeah, like worm said, it's not clear what you're doing. If you designed them to be disabled initially, then you just need to enable them in OnInit().

Edited by Rasikko
Link to comment
Share on other sites

Heya guys.

Well thanks for your guys help. While I did learn some things about arrays and such I'll most likely tackle that when I have more time to study up on it. I'm at least happy the Magical Script is working, however My other script I'm surprised is not working.

 

Something was bothering me and I had to do some experiments, seems like that the disable/enable script doesn't want to work regardless if its one object or not. More specifically at certain times it just won't work, (ex: 7pm - 5am) but it will work at 6am-12pm for some reason. My main goal was to just have a shrine will only give blessings at night (preferably at different set gametimes So I can reuse the script) I tried using the script here https://www.creationkit.com/index.php?title=Talk:Complete_Example_Scripts at "Enable/Disable Object on schedule" . Doesn't seem to want to work for me now. So I'll have to figure out another way of doing this, and I'll most likely make another topic on arrays when I have better Grasp on arrays to polish up my timed Ambush script.

 

 

in the meantime, I've redone the script into something more simpler in terms (hopefully)

 

 

 

 

Scriptname NocturnalShrine_Script extends ObjectReference  
;====================================================


GlobalVariable Property GameHour  auto  ;  Needed to change time

Message Property BlessingMessage  Auto  
Message Property AltarRemoveMsg  Auto  

Spell Property TempleBlessing  Auto  


;=============================

Event OnActivate(ObjectReference akActionRef)

	TempleBlessing.Cast(akActionRef, akActionRef)
	if akActionRef == Game.GetPlayer()
		AltarRemoveMsg.Show()
		BlessingMessage.Show()
	endif

EndEvent

;=============================

 

 

 

 

I'll start experimenting with the vanilla script (slightly modified) and try to figure out how to go about this. and hope that it actually does what its suppose to this time haha.

Edited by Juebev
Link to comment
Share on other sites

I've never done that before, so I imagine three things might happen.

 

1. Only the first message will show, and when closed, the other will then show.

2. Only the first message will show, and the other will not even after the first is closed.

3. Nothing will happen.

 

If they are notifications, then they will appear after one another.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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