Jump to content

Teleport Companion to Player Using Item.


KiboCae

Recommended Posts

I'm trying to make a beacon that can be given to the player in a conversation and then carried around with the player so when they use it it, it teleports the companion to the player. Similar to how the Casdin transponder works. I've been trying to use that as a reference but after about 2 hours of searching through all the files, I can't seem to figure it out.

 

I just want a normal item, using the distress beacon model, that when activated it teleports the companion to you and stays in the inventory to be used again later, I have the item all set up, have it so that the player gets it during the conversation, just need to figure out how to actually make it work now. I'm pretty sure it involves scripting but I'm a complete novice when it comes to that.

 

Anyone have any idea how I can make that possible?

Link to comment
Share on other sites

You need to attach a script to the quest alias that holds your item, of if you aren't using a quest, attach as script directly to your base item so it is inherited by spawned references. The script event to use depends on the type of item you are using and what events it generates: OnActivate(), OnEquipped() ...

 

If you don't know the above, then a good catchall is to use OnItemRemoved() from the player inventory which fires when an item is dropped. Add PlayerRef as an alias to your quest and add this script to the quest alias (example pulled from my library, may not fully work as is):

Form Property pMyBeacon Auto Const Mandatory ; points to your master form like BoSM01_DistressPulser

Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)

If  (akBaseItem == pMyBeacon) && !akDestContainer ; empty means it was dropped into the world to activate
	Actor[] playerFollowers = Game.GetPlayerFollowers()
	int iIndex = 0
	While (iIndex < playerFollowers.Length)
		playerFollowers[iIndex].MoveTo(pPlayeRef)
		iIndex += 1
	EndWhile
Endif
	
EndEvent

or you could use the akItemReference if you have the specific reference or alias of the beacon instance, but its probably more complex to explain/setup.

Edited by SKK50
Link to comment
Share on other sites

Okay, the script is going to be directly attached to a potion effect, which the effect will be attached to a "potion" item, and hopefully be OnActivate().

 

This is a good start and I greatly appreciate it. Gonna mess around with this and try the OnItemRemoved() and see what happens so I can learn a bit about it. Baby steps. :smile:

 

Thanks :smile:

 

Edit: Woo! I figured it out! Works flawless... welll not flawlessly but good enough! Only thing wrong with it is that it has the lightening bolt effect from the Institute teleport.

Scriptname CaedusTeleportScript extends activemagiceffect
;Teleports Caedus to Player 
Event OnEffectStart(Actor akTarget, Actor akCaster)
		;teleport caedus
		if PlayerActor.IsInInterior()
			CompanionCaedus.MoveTo(PlayerRef, 0.0, 15.0, 0.0)
		else		
			CompanionCaedus.MoveTo(PlayerRef, 0.0, 100.0, 0.0)
	EndIf
	EndEvent

;Properties
Actor Property CompanionCaedus Auto Const
Actor Property PlayerActor Auto Const
ObjectReference Property PlayerRef Auto Const
Potion Property CaedusTeleBeacon Auto Const
Edited by CosmicFlower20
Link to comment
Share on other sites

  • Recently Browsing   0 members

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