How do I add an "if" statement to destinations?

Questions specific to OpenMW-CS can be asked, and content development related topics can be discussed here
User avatar
WMan64
Posts: 10
Joined: 30 Dec 2016, 13:28
Location: Northern Territory, Australia

How do I add an "if" statement to destinations?

Post by WMan64 »

I'm kinda new to OpenMW-CS and was wondering if there was a way to add an "if" statement to a destination on one of the "travel" (silt striders, boats) npcs. Basically I want to be able to make a destination only available after you do a thing.
Any ideas?

Off topic:
Spoiler: Show
User avatar
DestinedToDie
Posts: 1181
Joined: 29 Jun 2015, 09:08

Re: How do I add an "if" statement to destinations?

Post by DestinedToDie »

I'm not sure that's possible. However. I do believe you can have travel/barter/spellmaking refusal (usually used in factions).
User avatar
Jyby
Posts: 408
Joined: 10 Dec 2013, 04:16

Re: How do I add an "if" statement to destinations?

Post by Jyby »

Hey WMan64! Welcome to the forums.

This topic seems more of a Content Development Section kinda question, moved.
User avatar
WMan64
Posts: 10
Joined: 30 Dec 2016, 13:28
Location: Northern Territory, Australia

Re: How do I add an "if" statement to destinations?

Post by WMan64 »

DestinedToDie wrote:I'm not sure that's possible. However. I do believe you can have travel/barter/spellmaking refusal (usually used in factions).
I'm not sure I understand the refusal thing.
The reason I wanted to know was I wanted to create a mod that made it so you could only use travel services to places you had already been.
EDIT: I'm pretty sure it's used when you aren't part of that faction. Am I right? If so how would I access this?
User avatar
Atahualpa
Posts: 1176
Joined: 09 Feb 2016, 20:03

Re: How do I add an "if" statement to destinations?

Post by Atahualpa »

Well, you can use the special dialogue topic "Service Refusal" to make specific NPCs refuse their services under certain circumstances. But this is only a binary decision: either they refuse all services or they grant access to them. In order to customise the list of destinations, you'd have to somehow add single destinations -- which is, as far as I know, not possible (yet).

The only solution I can think of, is to create a new topic (e.g., "Travel Destinations") which lets your character choose between the destinations (a simple choice dialogue). You could either make the choice dialogue only contain destinations which have already been discovered (by setting appropriate dialogue conditions and cloning the same dialogue for every configuration) or script the choice options to lead to a refusal dialogue when a destination is unknown to your character. Sounds a bit hack-ish to me but should be possible. Somehow. Maybe. :?
User avatar
sjek
Posts: 442
Joined: 22 Nov 2014, 10:51

Re: How do I add an "if" statement to destinations?

Post by sjek »

vanilla mournhold example:
http://cs.uesp.net/index.php?game=mw&ed ... ctype=DIAL

otherwise journal entries as above guest or global variable (in a script checking getPCcell ) read from dialogue script script in the cell comes to mind (openmw applied)

G7 have thought of xgetref saved globals in mwse, injected directly to vanilla functions in morrowind but those are early WIP thinking. used in wabbajack mod
Last edited by sjek on 31 Dec 2016, 15:04, edited 4 times in total.
User avatar
Atahualpa
Posts: 1176
Joined: 09 Feb 2016, 20:03

Re: How do I add an "if" statement to destinations?

Post by Atahualpa »

You refer to "MHTransportScript", right? That should work indeed -- but the more severe problem is to determine whether a travel destination has already been visited by the player.
User avatar
sjek
Posts: 442
Joined: 22 Nov 2014, 10:51

Re: How do I add an "if" statement to destinations?

Post by sjek »

much edit :D
------
yep
same script http://cs.uesp.net/index.php?game=mw&ed ... portScript
if with variables: vanilla xposition, openmw position
otherwise: there's bugs / features position not working with NPC to interiors... follower teleportation mod could be good to check.. tired...
if directly just player then positioncell with set x to player->getpos x way saving the position for globals or using redefined coordinates.
without event handling system inside scripts (besides if) the getpos goes kinda complicated or not so performance friendly but fares good in this one
----

in global something like

Code: Select all

if getPCcell "dagon well, end of the world"
    set traveldagon to 2
elseif... (repeat for others)
endif 
in dialoguescript doesn't necessarily work (depending on script running) in NPC to get script running in NPC's cell

Code: Select all

if (global..).traveldagon==2
   addtopic mournhold
endif
but more clean way would be to use unloaded cell reference and write

Code: Select all

if getPCcell "dagon well, end of the world"
    fargoth->addtopic "travel to end of the world"
elseif... (repeat for others)
endif 
thought that requires the NPC being unique, or the first one starting from soltheim corner is picked up.
if there's multiple same ID's the NPC script would be better.
but using vanilla NPC's the addtopic in global to prevent combability problems.

can write the getpos part later. basically plan is to make condition change inside every getPCcell block and use that to trigger player position save in separate if block, in same time reverting the condition allowing new placement. with good naming it should keep those without overlapping other mods and then save them inside getPCcell block to wanted variables. badside is that the initial positions are saved once in new cell before the condition change is renewed
User avatar
Jyby
Posts: 408
Joined: 10 Dec 2013, 04:16

Re: How do I add an "if" statement to destinations?

Post by Jyby »

Atahualpa wrote:You refer to "MHTransportScript", right? That should work indeed -- but the more severe problem is to determine whether a travel destination has already been visited by the player.
I read somewhere or heard that we are close to having custom global variables? That would solve the visited problem I think.
User avatar
MiroslavR
Posts: 156
Joined: 12 Feb 2014, 17:45

Re: How do I add an "if" statement to destinations?

Post by MiroslavR »

Jyby wrote: I read somewhere or heard that we are close to having custom global variables? That would solve the visited problem I think.
We do support custom global variables, as does vanilla MW. I think you're mistaking global variables with GMSTs.
Post Reply