Jump to content

Summon Activator problem


Recommended Posts

I'm working on a mod that includes a zone that needs to be fairly easy to access. So that the player can set up the 'door' to the zone in whatever house they live in (or wherever), I set up activators that work like doors (player clicks one, it teleports him to the other and vice-versa). That part works like a charm.

Then I set up one of the activators to teleport to the player when he casts a spell. It worked when I set it up, with no problems at all. Saved the game, went on to other parts of the mod, ect...

Then during actual play testing the summon spell wouldn't work. I tweaked the code, fiddled with the spell settings, and it worked again. Tested it under several circumstances in several locations- everything was good.

Then it stopped working. I got it working again. It stopped working. I fixed it. Stopped working... You get the idea.

This is driving me crazy. It's like it only works when I change it, but then latter on it wont work at all. Anyone have any ideas what's causing this? How do I get a spell to reliably summon an activator? The code I'm currently using (I've changed it several times now, but I get the same problem) is modified from one off the Creation Kit wiki:

 

ObjectReference Property YourSummonREF Auto ; An ObjectReference will also work with the summon function

Event OnEffectStart(Actor akTarget, Actor akCaster)
Summon(akCaster, YourSummonREF)
EndEvent

; GetFormFromFile below to enable 'Global' flag
Function Summon(ObjectReference akSummoner = None, ObjectReference akSummon = None, Float afDistance = 150.0, Float afZOffset = 0.0, ObjectReference arPortal = None, Int aiStage = 0) Global
While aiStage < 6
aiStage += 1
If aiStage == 1 ; Shroud summon with portal
arPortal = akSummon.PlaceAtMe(Game.GetFormFromFile(0x0007CD55, "Skyrim.ESM")) ; SummonTargetFXActivator disables and deletes itself shortly after stage 5
ElseIf aiStage == 2 ; Disable Summon
akSummon.Disable()
ElseIf aiStage == 3 ; Move portal in front of summoner
arPortal.MoveTo(akSummoner, Math.Sin(akSummoner.GetAngleZ()) * afDistance, Math.Cos(akSummoner.GetAngleZ()) * afDistance, afZOffset)
ElseIf aiStage == 4 ; Move summon to portal
akSummon.MoveTo(arPortal)
ElseIf aiStage == 5 ; Enable summon as the portal dissipates
akSummon.Enable()
EndIf
Utility.Wait(0.6)
EndWhile
EndFunction

 

Edited by khulse
Link to comment
Share on other sites

A few guesses ...

 

#1. Did you make a Global variable (Miscellaneous -> Global) ... aiStage

 

#2. I'm not seeing anyplace in your code that sets aiStage back to 0.

 

EndWhile

aiStage = 0

EndFunction

 

I'm not sure about this ... but I would assume once you call a set Global any other set Global calls to the same variable is skipped.

By the logic of what you have stated here the Global is only being set to 0 the one time. Thus my assumption.

Edited by NexusComa
Link to comment
Share on other sites

#1 No, I didn't. So I need to create a global to go along with the script?

 

#2 That's a good point.

 

I'm a bit of an amateur when it comes to scripting. I'll try making a global and adding something to reset it to 0 at the end like you suggest and see what happens.

 

Thanks for the tip!

 

Edit:

 

Okay. I tried adding a global and tacking on the aiStage == 0. That didn't do anything. Then I went in and added a duration to the spell, and it started working...

 

Now that I think about it, I'm not sure if it's changing the script that fixes it or changing the settings on the magic effect or the spell that does the trick. If that's the case, I can't even begin to imagine what I need to do to get this to work consistently.

Everything else, if it works a few times when I first set it up it'll keep working, but with this I can't even say for sure that any fix I make will solve the issue since the issue always shoes up much latter on.

 

I know this can be done, I've seen it done in other mods!

Edited by khulse
Link to comment
Share on other sites

Hmm ... I do know to use a Global you have to create one in the kit ... (Miscellaneous -> Global)

 

( I just edited my last post it should have been aiStage = 0 not aiStage == 0 )

 

From what you said it is working fine ... it just isn't resetting.

Edited by NexusComa
Link to comment
Share on other sites

Nope. It was working fine the other day. Same drill. Tested it in several zones, quit game, tested again, saved, quit game, tested again, even rebooted my computer and went through the whole thing again. Worked fine.

 

Today I decided to test it again before replying to your post, and it doesn't work. :confused:

 

I'm not sure it's the script, actualy. The spell is set up as a self target script spell that lasts six seconds. When I was casting it and it worked I could see the spell effect listed on active effects, but now I don't see it. The spell doesn't seem to be 'hitting' for some reason, which would explain why it isn't triggering the script. Why the spell itself would just stop working like that I can't imagine.

 

Edit: I just went and tweaked the settings of the spell (didn't touch the script) and now it works again. weird.

Edited by khulse
Link to comment
Share on other sites

Ok I found where you got that script ... The below will summon YourSummonREF from wherever they are to the player.

So it looks like you are trying to modify a script meant to do something else.

 

I suggest you just follow one of these tutorials.

 

 

The 1st one you can't hear him but it looks to be the essayist to follow.

Link to comment
Share on other sites

The idea is to have a 'door' that can be moved around- my basic intent is for this to be an 'entrance' to a space that the player can stick in their house even if they're using a custom one. The activator summoned by the spell does the teleportation when activated, and can be used without the spell. That part works perfectly. The problem is with the spell to move the activator to the player's location.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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