Jump to content

Starfield Creation Kit/Fallout etc., no way to use scripts.


Recommended Posts

I've been working on a simple script of moving the Player Character after dialogue for 2 weeks, but there seems to be no way to do this. 

 

METHOD 1:

- For example: I created a script that goes as follows: 

Quote

 

Scriptname AH_MoveToScript extends Quest

ActorBase Property Player1 Auto Const

ObjectReference Property XMarker Auto Const

Event OnInit()
    ; Get the player reference
    Actor PlayerRef = Game.GetPlayer()
    
    ; Move the player to the target reference
    PlayerRef.MoveTo(XMarker)
EndEvent

 

- Additionally, went to properties, selected "ActorBase" and selected "Player"

Second property: went to "Object Reference" and selected "XMarker"

- Went Back to "Scenes" found the NPC response, clicked "Run Fragment" dropped down to use "AH_MoveToScript" and saved

- Loaded game, spoke to NPC

RESULT: NOTHING HAPPENS

METHOD 2:

- Used the same script above

- Went to "Scripts"

- Opened "Phase 3" 

- Tabbed "Run Fragment" and dropped down to "AH_MoveToScript"

RESULT: NOTHING HAPPENS

METHOD 3: 

- Opened NPC's response text

- Clicked "Run Fragment" (on End)

- Typed: Player.MoveTo(XMarker)

- Click "Properties"

- Add "ActorBased" and typed/scrolled to "Player"

- Add another Property as "ObjectReference" > "Selected Reference in window"

- Go to save/compile, and receive the following error:

Quote

 

variable Player is undefined

variable Player is undefined

variable XMarker is undefined

variable XMarker is undefined

none is not a known user-defined script type

none is not a known user-defined script type

 

RESULT: DOES NOT WORK

*Conclusion: What is the point of giving these options, selecting properties and etc if none of them work or do anything in the game? What is going wrong? Is there a step-by-step tutorial on how to fix this? Does anyone in the modding community know about how to do this and would be willing to share (dummy proof, step by step, literally). I just don't get it and get a headache everytime I mess with it. It just doesn't make sense to me why it will not work. 

Link to comment
Share on other sites

After some review on this topic, it seems like fragments can not do actions such as "MoveTo". From my understanding, the only thing fragments CAN do is set different quest stages. This leads me to another question: How can a dialogue be achieved, move you to another stage where that stage runs a script from the "script" tab? If fragments do nothing else, how do scripts know when to activate? Would there be something like an "at.stage.2. run init?" or something to that degree?

Link to comment
Share on other sites

I can't answer the dialogue question because I don't have experience with quest dialogue.

Your script needs to be attached to the quest form(the quest itself). You can remove OnInit and replace it with this:

Function MovePlayer()
	Game.GetPlayer().MoveTo(XMarker)
EndFunction

Dont attach the script to the scene or to any of the phase frags. We're gonna skip that step because I feel this is easier for you.

In the phase frag, type this:

(GetOwningQuest() as AH_MoveToScript).MovePlayer()

This is just a faster(less steps) way of adding the quest to the scene and you'd still need to cast to the script anyway to call the function.

Because the function was defined in the quest script along with all your other properties, you don't need to define them elsewhere in the script and you should get no errors.
 

  • Thanks 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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