Jump to content

scripting help


Dlesang

Recommended Posts

I'm working on a summon custom creature script. Right now I have a working script that moves an actor from two set points in the world, and it works even if the actor dies first (say during combat or something).

 

But how do I inform the script to place the actor near the player's location to allow the spell to work like the hard-coded Summon Creature spells?

 

I'm having trouble tracking down any means of finding a "get player location" function.

Link to comment
Share on other sites

The result is inconsistent. It seems to work about 90% of the time when in an external cell. However, it works only about 10% of the time when summoning the actor from another cell into the internal cell you're in. I run around an internal spell, casting the spell over and over again, trying to get my actor to appear inside. I've managed to make it happen only once.

 

If they're in the same cell you are, it seems to work well. Otherwise, they seem stuck outside, unable to reach you until you go outside and cast the summon again.

 

In the end, I'd program the actor with AI that'd allow them to simply follow you through doors. But first, I want to create a spell that reliably pulls the Actor into your cell on command.

 

At the end of this spell, they're wisked away to a special "holding" cell until they're called again. This is the closest work-around to the hard-coded Summon Creature spells I can think of.

 

MAN, why didn't Bethesda just include a "summon custom creature" slot in their spell effects selection menu? It would have made this SO easy.

Edited by Dlesang
Link to comment
Share on other sites

It may be that MoveTo is moving the actor to a point in the void outside the interior walls.

 

The following function moves something to a place in front of an actor (requires OBSE)

 

"YourActorReferenceID.call zuRefPositionInFront PlayerRef 100"

 

Will move the actor to a point 100 units in front of the player, no matter where the player is facing (make sure the player has some clear space in front)

 

scn zuRefPositionInFront
;--------------------------------------------------------
;
; zuRefPositionInFront
; '08/set/2012 15:32
;--------------------------------------------------------
;
; Positions a ref x units in front of an actor
;
;--------------------------------------------------------
float ang
float angZ
float dis
float posX
float posY
ref refMark

begin Function {refMark dis}

  Let angZ := refMark.GetAngle Z

  if  angZ <= 90
    Let ang := 90.0 - angZ
  else
    Let ang := 450.0 - angZ
  endif

  Let posX := refMark.GetPos X + dis * Cos ang
  Let posY := refMark.GetPos Y + dis * Sin ang

  MoveTo refMark

  SetPos X posX
  SetPos Y posY
  SetAngle Z angZ

end
Link to comment
Share on other sites

  • Recently Browsing   0 members

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