Jump to content

Need help writing this script


jayboge

Recommended Posts

So I'm not exactly new to modding, I create all sorts of my own mods and tweak the came to my liking with the construction set. But when it comes to scripting... uuuuugh. I've been trying to figure out how to write a script that will activate a quest upon activating a map marker (if thats even possible?) and if not: upon getting within a close proximity to something such as a house or a door (I'm sure I've had quest log updates in such instances in vanilla oblivion). Any advice would be greatly appreciated, or if someone would be kind enough to write one for me heh. Thanks!!

 

JayBoge

Link to comment
Share on other sites

Just place a triggerbox where you want the quest to start an attach this script:

 

Scn QuestTriggerScript ;Don't forget to change the name though

Short DoOnce

Begin OnTrigger Player

If DoOnce == 0
  [YourQuestID].SetStage [stage] ;Put your quest's editor ID and the stage here
  Set DoOnce to 1
EndIf

End

Link to comment
Share on other sites

Another variation, since you won't have to drop triggers everywhere.

 


Short DoOnce

Begin GameMode

If DoOnce == 0 && Player.GetDistance ObjectReference <= 50 ;I don't know the range you want. Set it, try it, change it, try it again. I never understood CS "units"
    QuestID.SetStage Stage#
    Set DoOnce to 1
EndIf

End

 

Basically, checks to see if the player is 50 'units' away from the object reference then updates the quest. One common tactic is to use an Xmarker and make that the reference.

Link to comment
Share on other sites

Yes, that is an option but it is not preferable. GetDistance can be quite CPU heavy, so you should avoid calling it every frame at all times.

 

If you do decide to use that method, do this instead:

Short DoOnce

Begin GameMode

If DoOnce == 0
  Player.GetDistance ObjectReference <= 50 ;I don't know the range you want. Set it, try it, change it, try it again. I never understood CS "units"
    QuestID.SetStage Stage#
    Set DoOnce to 1
  EndIf
EndIf

End

This way you prevent the GetDistance from being called once the quest has been updated.

 

Also, 64 untis = 1 yard, 70 units = one meter. :)

Link to comment
Share on other sites

&& is a tricky on any. Even though one of the conditions maybe false, it'll still check the getdistance even after the doonce is set to 1.

 

50 is a bit low for the distance, especially with markers. 150 is the minimum to keep the player getting annoyed from it's precision and I'd go for 300/500 or more for remote things. Markers however, are triggered on quite a distance. About 1750 units. So I'd go for 1500 units to get a reliable response.

I'm not sure why doonce is used when a quest in involved, saves another variable :smile:

--And they usually advice to turn it around to check the distance from the object instead of the player, as it'll be more reliable.

Getdistance is an annoying one. If you have a previous part of the quest involved, I'd block it off with another GetStage down with another variable or just place it on an object near the marker..instead of getting cpu-intensive as argomirr pointed at.

 

Begin GameMode

If GetStage QuestID < Stage#
  ObjectReference.GetDistance Player <= 1500
    SetStage QuestID Stage#
  EndIf
EndIf

End

Link to comment
Share on other sites

Wow guys thanks a bunch for the quick and multiple replies!! I've tried each of these and I can't get by a message stating that my quests EditorID isn't found!! I've even copy pasted it directly from the EditorID column!! Any ways around this? Should I rename it to something specific? It's currently "JonshousemodQuest" I've also tried simpler names like "Ravenwatchscript". If I don't get this error, then I get one stating "Syntax Error. Functions may not be called on quests." or "Could not parse this line", "Mismatched begin/end blocks" etc. Please excuse my overwhelming abundance of noob heh. I'm realy having difficulty wrapping my head around how this works.
Link to comment
Share on other sites

Make sure it's in the right order. The order is QuestID.SetStage... If you try SetStage.QuestID you'll get an error. Syntax error means it's a bad line... can't help without seeing the script itself.

 

Mistmatched begin/end block means you forgot either the Begin GameMode at the start of the script (generally this is placed AFTER you assign variables, such as Short, Long, Float, etc.) or you forgot the End at the very bottom of the script.

 

Show us the script in the code box [ code] [ /code] (remove the spaces) and you can get a better reply of what you're doing wrong. Without seeing the script itself... that's all I can tell you.

Link to comment
Share on other sites

Make sure it's in the right order. The order is QuestID.SetStage... If you try SetStage.QuestID you'll get an error. Syntax error means it's a bad line... can't help without seeing the script itself.

 

Mistmatched begin/end block means you forgot either the Begin GameMode at the start of the script (generally this is placed AFTER you assign variables, such as Short, Long, Float, etc.) or you forgot the End at the very bottom of the script.

 

Show us the script in the code box [ code] [ /code] (remove the spaces) and you can get a better reply of what you're doing wrong. Without seeing the script itself... that's all I can tell you.

 

Here is the script I tried but aparently it's all wrong?? lol "Jonsmodravenwatch" is the quests EditorID, "Ravenwatch" is the object reference (its a house, and persistant reference). I recieve all of the errors stated above :(

 

scn Ravenwatchquestscript
Short DoOnce

Begin GameMode

If DoOnce == 0
Player.GetDistance Ravenwatch <= 700
Jonsmodravenwatch.SetStage 10
Set DoOnce to 1
EndIf
EndIf

End

Link to comment
Share on other sites

Oh, I think that's my bad. I accidentally did this:

Quest.SetStage 10

while the correct syntax is:

SetStage Quest 10

 

So this should fix it:

scn Ravenwatchquestscript
Short DoOnce

Begin GameMode

If DoOnce == 0
If Ravenwatch.GetDistance Player <= 700
SetStage Jonsmodravenwatch 10
Set DoOnce to 1
EndIf
EndIf

End

 

Also fixed some minor mistakes you made. :P

Link to comment
Share on other sites

  • Recently Browsing   0 members

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