Jump to content

Script help: Summon with trigger box


Recommended Posts

Hi All

 

I'm hoping someone here can help me because I'm slowly losing the will ...

 

My Predicament

 

I've been trying to force a trigger box to cast a summon spell at an Xmarker that I've placed in my custom cell. I've tested the box with a debug message, which works, but I can't get it to fire the spell.

 

The summon involves an NPC that I've placed in another cell, so in my spell script I'm using the "MoveTo" rather than "PlaceAtMe". The script for this spell works fine as a normal spell (I've used it elsewhere) so I know it's not that.

 

I think that it must be something to do with the way I've set up the trigger and it's script. Here's what I did:

 

1. Added a trigger box

2. Added an Xmarker (spawnlocation)

3. Generated a new script in trigger and created and pointed properties to spell and the xmarker.

4. Added this script

 

Scriptname SKMFSummonEvilMharphinTriggerSpell extends ObjectReference  

SPELL Property SummonEvilMharph  Auto  

ObjectReference Property SpawnLocation  Auto  

Event OntriggerEnter(ObjectReference akActionRef)
              If akActionRef == Game.GetPlayer()
                SummonEvilMharph.Cast(SpawnLocation, SpawnLocation)
              EndIf
EndEvent

 

 

 

I am not sure why this isn't working. any ideas?

 

Note: yes I've continually tested with a clean save and just for good measure regenerated a new SEQ :ohmy:

 

Link to comment
Share on other sites

Looking at this line:

SummonEvilMharph.Cast(SpawnLocation, SpawnLocation)

You have both the target and source as the SpawnLocation. Looking at cast: Cast(ObjectReference akSource, ObjectReference akTarget = None) , I would change your function to this:

SummonEvilMharph.Cast(SpawnLocation, akActionRef)

Let us know if it works.

Link to comment
Share on other sites

Looking at this line:

SummonEvilMharph.Cast(SpawnLocation, SpawnLocation)

You have both the target and source as the SpawnLocation. Looking at cast: Cast(ObjectReference akSource, ObjectReference akTarget = None) , I would change your function to this:

SummonEvilMharph.Cast(SpawnLocation, akActionRef)

Let us know if it works.

 

Thanks guys. This tiny adjustment worked... well partially anyway. :blush:

 

The trigger now summons the npc, but unfortunately it places him right next to the player and not at the xmarker (I want him to appear at some distance from player for dramatic effect).

 

However, I think this is the fault of the spell being fired rather than the trigger script. The spell I'm using is a duplicate of one I used to summon a follower, so I think that I now need to use a different spell script altogether.

 

I will experiment and post my findings here

 

EDIT

 

No joy so far. I tried experimenting with generic summon spells, but they wouldn't fire. I even tried altering the moveto distance of my own spell.

 

I think I need to think outside the box (or trigger in my case). Perhaps I can approach this in the same way as a Talking Activator?

 

Hmm, if I were to make an activator cast a spell instead of the trigger box, perhaps that will work.

Edited by skinnytecboy
Link to comment
Share on other sites

Well if the actor exists int he world there is no need for a summon 'spell' so to speak, you can just create it yourself.

 

Find the audio for the spell effect, add it to the trigger box as a property. Filter IMAG in statics and find the right magic effect, scale it to size around the xmarker you want the character to moveto, add the xmarker and actor as propertys in the trigger box

 

 

 

 

 

Scriptname SKMFSummonEvilMharphinTriggerSpell extends ObjectReference

int property trigcount auto

objectreference property marker1 auto

objectreference property actor1 auto

objectreference property specialfx1 auto

sound property sound1 auto

ObjectReference Property SpawnLocation Auto

Event OntriggerEnter(ObjectReference akActionRef)
If akActionRef == Game.GetPlayer()

if trigcount == 0

trigcount+=1

sound1.play(marker1)

specialfx.enable()

actor1.setalpha(0.0)

actor1.moveto(marker1)

utility.wait(0.2)

actor1.moveto(marker1) ; I always redundancy a moveto on a actor, also make sure there is navmesh under him

utility.wait(0.5)

actor1.setalpha(1.0, true) ; Will fade in the actor

utility.wait(2.0)

specialfx.disable()

endif

EndIf
EndEvent

 

Link to comment
Share on other sites

Well if the actor exists int he world there is no need for a summon 'spell' so to speak, you can just create it yourself.

 

Find the audio for the spell effect, add it to the trigger box as a property. Filter IMAG in statics and find the right magic effect, scale it to size around the xmarker you want the character to moveto, add the xmarker and actor as propertys in the trigger box

 

 

 

 

Scriptname SKMFSummonEvilMharphinTriggerSpell extends ObjectReference

 

int property trigcount auto

objectreference property marker1 auto

objectreference property actor1 auto

objectreference property specialfx1 auto

sound property sound1 auto

 

ObjectReference Property SpawnLocation Auto

 

Event OntriggerEnter(ObjectReference akActionRef)

If akActionRef == Game.GetPlayer()

if trigcount == 0

trigcount+=1

sound1.play(marker1)

specialfx.enable()

actor1.setalpha(0.0)

actor1.moveto(marker1)

utility.wait(0.2)

actor1.moveto(marker1) ; I always redundancy a moveto on a actor, also make sure there is navmesh under him

utility.wait(0.5)

actor1.setalpha(1.0, true) ; Will fade in the actor

utility.wait(2.0)

specialfx.disable()

endif

EndIf

EndEvent

 

Hidden deep within my original question was a giant Batman signal with the words "Help me Darren" emblazoned in 20 ft high letters below.

 

Thanks buddy. I Will try this out ASAP.

Edited by skinnytecboy
Link to comment
Share on other sites

Just to update this post. Darren's script worked perfectly (although the actor needs to be an actor property rather than an object)

 

Thank you Darren83 and thank you everyone who replied to my post :blush:

 

Here's the beasty in action

 

https://www.youtube.com/watch?v=xbGE3gQbH1w

Edited by skinnytecboy
Link to comment
Share on other sites

  • Recently Browsing   0 members

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