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
Atahualpa
Posts: 1176
Joined: 09 Feb 2016, 20:03

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

Post by Atahualpa »

As far as I know, you can already create new global variables in OpenMW-CS. However, is there a way to easily check if a cell has been loaded?

Edit: Damn, MiroslavR ninja'd me!
User avatar
MiroslavR
Posts: 156
Joined: 12 Feb 2014, 17:45

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

Post by MiroslavR »

Atahualpa wrote:As far as I know, you can already create new global variables in OpenMW-CS. However, is there a way to easily check if a cell has been loaded?
What sjek posted should work. I don't think there is an easier solution than that.
User avatar
sjek
Posts: 442
Joined: 22 Nov 2014, 10:51

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

Post by sjek »

yep
that's probaply easiest way currently or near it

getting it even simpler would need some way to get visiting in the certain cell, to give the variable naturally to use for travel service. that would need extending fileformat or use set of redefined globals, but naming for every cell in game could be a possible mess and other option is extend the saveformat with script access. bloating values.

other example with those would be some kind of telvanni security camera. camera would be NPC or activator with local script and would pass value, from distance check to global, which would be used to calculate chameleon effect applied to player. interfering with normal npc's in area according to morrowind mechanics.
if there's some way to disable "guards" detecting, then set of specialID npc's could be used to trigger detection by local script values in or to the same global.

the multiple if block structure is hard to pass on this simple. in-build jumptables might still seem similar on the outside if there's not some way to bypass the naming problem. architecture thought. (mark and recall type values..)

if it's needed the startscripts are globals, which are ran on a start of a new game and can be started and shutdown with startscript and stopscript commands xP

if related to mwse getref usage it was about saving the player reference or target or whatnot as "rebaked" global value which could be used with set ref to (playerref) or so making it super fast compared to individual ref calls but not gonna open up wabbajack for that now. fireworks
User avatar
silentthief
Posts: 456
Joined: 18 Apr 2013, 01:20
Location: Currently traversing the Ascadian Isles

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

Post by silentthief »

sjek wrote:yep
other example with those would be some kind of telvanni security camera. camera would be NPC or activator with local script and would pass value, from distance check to global, which would be used to calculate chameleon effect applied to player. interfering with normal npc's in area according to morrowind mechanics.
if there's some way to disable "guards" detecting, then set of specialID npc's could be used to trigger detection by local script values in or to the same global.
Idea similar/kind of like this. Set up global scripts that deny access to the locations, something like

"denyBalmora"
"denyMaarGan"
"DenyVivec"

and these scripts do nothing except run, no data/script entry is needed except perhaps to set to only run every so often (*you don't want to have too many global scripts running as this can deteriorate FPS -- so set up a check to run every so often such as every 5-10 seconds or so). But include the "NPC or activator with local script" --like sjek mentioned, that stops these scripts when you get close enough. Could put an activator that stops these scripts inside the stairs leading to the NPC that gives the siltstrider travel options (for example) -- or perhaps add it as dialog from the silt strider merchant.

What to do then is to check for "scriptrunning" http://www.uesp.net/morrow/editor/mw_cs ... iptrunning
to determine if the deny script is running -- if so, then you set up the denial of service.

Granted -- I do not know if scriptrunning works as dialog filter, so this is untested.

ST the suggestive
PS -- any questions/clarifications, please ask
User avatar
sjek
Posts: 442
Joined: 22 Nov 2014, 10:51

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

Post by sjek »

there is multiple ways we can do this and the choise is yours ^^
User avatar
Jyby
Posts: 408
Joined: 10 Dec 2013, 04:16

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

Post by Jyby »

sjek wrote:there is multiple ways we can do this and the choise is yours ^^
wow wouldn't it be cool if we had a script builder/editor like that!!!
User avatar
Atahualpa
Posts: 1176
Joined: 09 Feb 2016, 20:03

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

Post by Atahualpa »

Trust me, the coolness factor drastically decreases after hearing the same line 100 times. -- Which makes me think, why not use Fargoth as a scripting interface? 8-)
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 »

I've kinda done it so that each individual place is it's own topic and when you talk to a Silt Strider NPC (in this case Balmora's), a script runs which is just;
Addtopic "Travel to Balmora"

I made all of the Silt Strider NPCs a clone of the Caravan class but called "Silt_Strider". Anyone with that class will get that topic except for any Silt_Strider NPC in (for example) Balmora's Cell/s.
When you click on that topic it runs a script that is similar to the travel to Mournhold script.
I've actually pretty much finished the mod. All I need to do is the boats and some sound effects and stuff. This brings me to another question, how do I add a sound in dialogue?
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 »

If playing a sound in dialogue isn't possible then could I loop-

if ( menumode == 0 )
playsound, "LevelUP"

-until the sound is played once?
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 »

I think I worked it out except now it just plays it on repeat until I pause the game. But once I unpause the game it continues. I even tried StopSound "levelUP"
Post Reply