Jump to content

Teleport to target


Recommended Posts

I'm trying to make a simple script that will allow the player to teleport to the target, not to the crosshairs, but the target that is active(shown in the bar in the top of the screen).

so I made this script

 

 

Scriptname GhostTeleport extends ActiveMagicEffect
Spell property teleport auto
ObjectReference Property akTarget Auto
Event OnEffectStart(Actor akTarget, Actor akCaster)
Caster.moveTo(akTarget)
endEvent

the compiler output I get is

variable Caster is undefined
psc(7,7): none is not a known user-defined type
However I believe that the issue I'm having is related to the objectreference, but honestly not sure =S

EDIT: THink I found the issue had written caster instead of akCaster, the script just compiled, about to test it.
EDIT: script isn't working, not teleporting to target, simply staying still?
Edited by xdenkiteki
Link to comment
Share on other sites

The akTarget parameter of the OnEffectStart event gets equated to the object that the effect is cast onto, when the event is triggered. It's for reading, not for setting. If the player casts the spell on himself, then akTarget is set equal to the player. So, at best, your script is telling the player to teleport to himself.

 

What you are calling the "target" - a town or tomb or whatever, that you see in the bar at the top of the screen to help you navigate - is something entirely different and it is part of the GUI, which is not scripted in papyrus.

Link to comment
Share on other sites

Ah, makes sense then >< thanks a ton!!

well it was my first time playing around with a script so it was a bit if a challenge just understanding some of the lingo, which it would seem I have a long way to go yet. Would that mean that if I changed the the settings from self to aim the character would go where my target is?

 

Do you think it would be possible to have the teleport to for example akAggressor? basically what I'd like is a teleport where I won't need to aim, but simply tab the button. However if there is no way to have a "target" set, then I guess it might not be possible to teleport to nearest enemy, not in a simple beginner script at least?

Edited by xdenkiteki
Link to comment
Share on other sites

If you aim a spell, it strikes whatever your crosshairs are over. So you could make a spell that teleports you to that, or preferably a bit short of that because you don't want to crash into it.

 

There's no papyrus function to find the nearest enemy, so you would have to scan the area for actors and see if they were enemies and if so how far away they were and which one was closest.

 

When you read about scripting, remember that examples of how to do something are not usually complete scripts. So, for example, if you see akAgressor used, the part of the script that works out what that actually represents may not be quoted - you are expected to do that yourself. The game doesn't magically fill it in for you.

Link to comment
Share on other sites

Alright, really appreciate the advice, definitely saved me some time from googling and youtube watching. As it is the script doesn't work regardless how I put the delivery. Which tells me that there is something off with the script in general, I'll have to learn more about scripting when I have more time, once more, thank you very much.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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