Jump to content

Tricky Scripting Questions


Recommended Posts

Hello, people!

I have really tricky (at least for me) questions. Wil be happy for any clue in these ones.

 

Q.1. How to teleport actor right behind the player by script?

Context: After the dialogue player receives two followers who have to be teleported by varibale (in dialogue result script). But they can appear right behind my eyes which is distorbing for game experience. 

So I've found a script by Wrye from his Summon Bed mod (link from here). I've shaped it as a function but still can't figure out how to change it porperly according to my idea. That's it:

  

  Reveal hidden contents


Q.2. How to create a reference via script from base object in the cell?

Context: I've tried to create a varla's holder activator so you can put a varla stone here ('ve already created special static nif for it) but I don't want to just enable\disable it and tried to make something more dynamical. And I've found out that you cannot actually create a ref by script! Or I just don't understand how to do it? Here is my attempt:

  Reveal hidden contents


Q.3. The most tricky one. How to make  a scripted movement for an actor to a dynamic point?
Context:  It'll be easier if I put it more clear. I created an activator which should make a player "jump" to the point above the activator wherever he is. 

This activator is a hook which is used to "jump" the player to the roof of the building. A way around for players who haven't a high acrobatics skill. But it seems to be a really tough scripting.

It should analyze an actual player's position, then a position of hook ref, then create a step by which it would move the player to the hook position via the parabola (with "jumping" animation loop) and after player has grounded to the roof the script should be stopped. Maybe somebody has seen something similar in mods? I have some code but it doesn't have any considerable shape now.

Thank to all who'd try to help!
 

Edited by ArtemSHikoff
Link to comment
Share on other sites

Here's a code snippet from one of our follower scripts. This script would be placed on the NPC. This allows a follower to catch up if they lag behind. They will wind up just behind the player.

ModControlQuest is a quest that you would create to hold global variables, like follower and OrderStay. Both are shorts (short integers). Also note that this script uses OBSE syntax since my mods usually require OBSE. You'll have to change all the let... to set if you aren't using OBSE.

short doOnce
float distancePlayer
short lagging
float angle
Begin gameMode
	let distancePlayer := GetDistance Player
	
	if (ModControlQuest.follower == 1) && (ModControlQuest.OrderStay == 0) && (Player.IsInInterior == 0)
		if lagging == 0
			if distancePlayer > 2000
				let lagging := 1
			endif
		else
			let lagging := 0
			Disable
			let angle := player.GetAngle Z
			if angle < 45 || angle > 315
				MoveTo Player 0 -50 0	; south
			elseif angle < 135
				MoveTo Player -50 0 0	; west
			elseif angle < 225
				MoveTo Player 0 50 0	; north
			else
				MoveTo Player 50 0 0	; east
			endif
			Enable
		endif
	endif
End

PlaceAtMe should be avoided as it causes saved game bloat. I have to use it in Imperial Furniture Renovated, but I destroy the reference once I'm done with it to avoid bloat. You might want to check it out as you might find the placement scripts useful for what you're trying to do.

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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