Mathematics in the result box...

Post » Tue Sep 22, 2015 6:27 pm

So, I'm a beginner at scripting and not too familiar with the MW Construction Set. Some of you might have noticed http://www.gamesas.com/topic/1467206-wipz-interactive-ordinators/(sort of).

The companions are supposed to be romanceable and I want the player interaction with them to be as natural and RP-friendly as possible, so I decided to create an "Attraction" variable. The NPCs will say different things to you not only based on disposition, faction etc but also depending on whether or not they are attracted to you, and how much.

I figured out how to do that in the scripts attached to the NPCs, so race and some attributes now influence how attracted they are to you. But dialogue, that's a problem!

If I write something like

set Attraction to ( Attraction + 3 )

in the result box, I get an error and I understand why. An Ordinator whose attraction to you is infinitely increased by 3 because of a fairly unimportant dialogue choice might be a problem not only for the player character, but also for more technical reasons. So I tried to do what I do in the script window, use "if" and a "do once" type variable. But that causes the construction set to crash.

So any explanations, ideas and suggestions are welcome.

User avatar
Jack
 
Posts: 3483
Joined: Sat Oct 20, 2007 8:08 am

Post » Tue Sep 22, 2015 3:08 pm

Is Attraction a local variable declared in the script attached to your companion?

Unlike regular scripts, contents of the dialogue's action box is only running once, so there won't be *that* sort of problem.

User avatar
April D. F
 
Posts: 3346
Joined: Wed Mar 21, 2007 8:41 pm

Post » Tue Sep 22, 2015 1:23 pm

Declaring a variable is when you introduce it by name and type, right? If so, it is declared.

It works if I write

set Attraction to 3

but if I write

set Attraction to ( Attraction + 3 )

it doesn't work, so I assumed it needed a "do once" variable.

It says SYNTAX error, but I can't see how syntax is wrong. Similar lines work fine in the script window, but it doesn't work in the result box.

User avatar
Alyesha Neufeld
 
Posts: 3421
Joined: Fri Jan 19, 2007 10:45 am

Post » Tue Sep 22, 2015 7:34 pm

This is weird. I used such commands in dialogue and never had problems with them. Are you sure that the dialogue line with that command is filtered to exactly the same NPC that has Attraction declared in the script attached to him? Not in some other script?

Unless there's some Glitch From Outer SpaceTM... well, try to insert a new line (not copy) above the current one and replicate all the contents by hand. Also you may delete the parentheses. That's al I can offer without actually seeing your mod in CS.

User avatar
Charlotte Buckley
 
Posts: 3532
Joined: Fri Oct 27, 2006 11:29 am

Post » Tue Sep 22, 2015 9:06 pm

Yes, it's the same NPC. I've tried to use parantheses, not use parantheses, use spaces around the parantheses, not use spaces around the parantheses etc and nothing works.

Here are a couple of screenshots:

http://i.imgur.com/hHhDekH.jpg

http://i.imgur.com/JHNNzxv.jpg

User avatar
Bird
 
Posts: 3492
Joined: Fri Nov 30, 2007 12:45 am

Post » Tue Sep 22, 2015 1:10 pm

How about this?
set "Interactive Ordinator".Attraction to "Interactive Ordinator".Attraction + 3
Edit: As a matter of curiosity, does that IntOrd_script do anything more than set that attraction value?
User avatar
kyle pinchen
 
Posts: 3475
Joined: Thu May 17, 2007 9:01 pm

Post » Tue Sep 22, 2015 7:56 pm

I think Spirithawke is right--you can change the Attraction variable in the script attached to the npc simply by entering set Attraction to whatever, but that won't work in a dialog box unless it's a global variable.

edit: error messages seem more fun when you get to respond in swedish

User avatar
sam smith
 
Posts: 3386
Joined: Sun Aug 05, 2007 3:55 am

Post » Tue Sep 22, 2015 10:45 pm

Try to see how does it behave ingame. First, update the line with a debugging command Messagebox "Attraction=%.0f" Attraction prior to the "+3" command in the action box. Now start the game, come closer to the character, call for the console window ("~" key), click on the character (its ID should be in window's header now), and type "sv". It should display local variables' values, including current Attraction. Now close the console, and start the dialogue, aiming for a line that changes Attraction. See whether it does issue an error message (and whether it does log Attraction=xxx in the dialogue window itself), and if it doesn't, type "sv" in the console once again - normally, it should show that Attraction had changed. If there's no error ingame, you may dismiss the Error Check Results' message as a false alarm.

(Oh, and I hope you *are* aware that Error Check Results may change global variables' values without your knowledge, and you always save/reload when you invoke that function. Not that it is somehow related to your current error, though, just a useful caveat)

http://www.gamesas.com/user/351782-lackadaisical/, incorrect. I *did* modify local variables in dialogue in my mod, so I know it works.

User avatar
Jerry Cox
 
Posts: 3409
Joined: Wed Oct 10, 2007 1:21 pm

Post » Tue Sep 22, 2015 3:30 pm

My bad. One other possible culprit, and this may sound stupid, but is the script actually attached to the NPC to whom the dialog is assigned? I replicated what you were doing pretty much exactly in the CS and the only way to get an error was to try to modify the variable on an NPC who did not have the necessary script.

User avatar
Peetay
 
Posts: 3303
Joined: Sun Jul 22, 2007 10:33 am

Post » Tue Sep 22, 2015 6:09 pm

I didn't know that. Thank you!

User avatar
Code Affinity
 
Posts: 3325
Joined: Wed Jun 13, 2007 11:11 am

Post » Tue Sep 22, 2015 7:25 pm

That worked!

User avatar
sexy zara
 
Posts: 3268
Joined: Wed Nov 01, 2006 7:53 am


Return to III - Morrowind

cron