Jump to content

Script questions for you guys


Recommended Posts

Alright, so I have two questions for you guys and would love your expertise on how to make this happen with scripting. (Example code encouraged)

 

Scenario one:

I want you to be able to tell a follower to eat a object. So talk to the follower, and then point at/interact with the object to be eaten.

 

Scenario two:

I want it so a follower will automatically teleport to the player once they have fallen to far away.

 

I have an idea of how to do it, but I have 0 experience with scripting.

Thanks in advance :)

Link to comment
Share on other sites

Event OnLoad()
	if TestQuest.GetStage() == 10
		if actor1.GetDistance player > 100
			actor1.moveto player
		endif
	endif
EndEvent

It wont compile and it says " no viable alternative at input 'moveto'" and "no viable alternative at input 'GetDistance'"

Link to comment
Share on other sites

Event OnLoad()
    Actor player = Game.GetPlayer()
    if TestQuest.GetStage() == 10
        if actor1.GetDistance(player) > 100
            actor1.moveto(player)
        endif
    endif
EndEvent

Since you're new to scripting, a little tip about OnLoad: It will not fire if you attempt to test this while you are already in the cell at the time the game loads. You need to be somewhere else and then move to the cell the object is in.

Edited by TheDungeonDweller
Link to comment
Share on other sites

Event OnLoad()
    Actor player = Game.GetPlayer()
    if TestQuest.GetStage() == 10
        if actor1.GetDistance(player) > 100
            actor1.moveto(player)
        endif
    endif
EndEvent

Since you're new to scripting, a little tip about OnLoad: It will not fire if you attempt to test this while you are already in the cell at the time the game loads. You need to be somewhere else and then move to the cell the object is in.

 

But it wont even compile?

Link to comment
Share on other sites

I'm pretty sure that's due to the script not even knowing what type actor1 is.

 

If this script is on an actor, then:

Event OnLoad()
    Actor player = Game.GetPlayer()
    if TestQuest.GetStage() == 10
        if (self as actor).GetDistance(player) > 100
            (self as actor).moveto(player)
        endif
    endif
EndEvent

If it's on an object

Event OnLoad()
    Actor player = Game.GetPlayer()
    if TestQuest.GetStage() == 10
        if self.GetDistance(player) > 100
            self.moveto(player)
        endif
    endif
EndEvent

If it's on an object but the script is checking for an actor..

Actor property actor1 auto
 
Event OnLoad()
    Actor player = Game.GetPlayer()
    if TestQuest.GetStage() == 10
        if actor1.GetDistance(player) > 100
            actor1.moveto(player)
        endif
    endif
EndEvent

If it still doesn't compile, post the error it's giving.

Edited by TheDungeonDweller
Link to comment
Share on other sites

  • Recently Browsing   0 members

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