The Black Wyrm Lair Forums
The Black Wyrm's Lair Terms of Use Help Search Members Calendar

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Global Not Setting, And one other thing...
Sir_Carnifex
post Jun 22 2008, 04:05 AM
Post #1





Retired team member
Posts: 490
Joined: 8-April 08
From: U.S.A




I'm having a problem with a global variable not setting properly. This dialogue works fine, but I can't get the next in the series to occur unless I manually set it. Yet, you'd think that if it weren't being changed, that the initial dialogue would repeat over and over, but it doesn't.

Here's the code:

CODE
APPEND BKORGAN
IF ~InParty("CXHalbo")
See("CXHalbo")
!Dead("CXHalbo")
!StateCheck("CXHalbo",STATE_SLEEPING)
Global("KorganHalbo1","GLOBAL",0)~ THEN BEGIN KorganHalboTalkDwarf1
SAY ~Blah Blah.~
=
~Blah Blah.~
IF ~~ THEN DO ~SetGlobal("KorganHalbo1","GLOBAL",1)~ EXTERN BCXHALBO KorganHalboTalkDwarf1.1
END
END



The second question is:

How do I go about setting a character's state to intoxicated? I couldn't find any specific state for that. The only thing I could find was the wish spell.


--------------------
"Once the game is over, the king and the pawn go back into the same box." - Italian Proverb

"I like criticism, but it must be my way." - Mark Twain

"A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort." - Herm Albright
Go to the top of the page
 
Quote Post
Bookwyrme
post Jun 22 2008, 06:01 AM
Post #2





Forum Member
Posts: 49
Joined: 22-July 04




One way to check to see if it is or is not setting is to use CLUAConsole:GetGlobal("KorganHalbo1","GLOBAL")

That will tell you if it's set.

I suggest also checking the conditions for the next talk firing to make sure that you have typed the Global the exact same way--typos, I report from experience, are fairly easy. If that doesn't work, maybe you could also post the triggering conditions for the next talk for people to see.
Go to the top of the page
 
Quote Post
Sir_Carnifex
post Jun 22 2008, 06:06 AM
Post #3





Retired team member
Posts: 490
Joined: 8-April 08
From: U.S.A




Thanks, I'll check to see if it sets. I didn't know about that GetGlobal thing.

And believe me when I say I know ALL about typos! I am pretty sure this is NOT the problem as I checked for that at least five times. I will look over it again though. Sometimes I miss obvious things. banghead.gif


--------------------
"Once the game is over, the king and the pawn go back into the same box." - Italian Proverb

"I like criticism, but it must be my way." - Mark Twain

"A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort." - Herm Albright
Go to the top of the page
 
Quote Post
Sikret
post Jun 22 2008, 06:31 AM
Post #4


The Tactician
Group Icon

Distinguished Developer
Posts: 7781
Joined: 1-December 05




Variabes take a little bit time to be set. If you set a variable in a dialogue line which immediately transfers you to another dialogue block which checks that particular variable, the variable will not be set in such a short priod of time. There are several possible workaround for this problem depending on the situation.


--------------------
Improved Anvil




Cheating is not confined to using external software or the console commands. Abusing the flaws and limitations of the game engine to do something that a human Dungeon Master would not accept or allow is cheating.
Go to the top of the page
 
Quote Post
Moongaze
post Jun 22 2008, 09:11 AM
Post #5





Forum Member
Posts: 467
Joined: 23-February 05
From: My den




"The next in the series" being the next part of the same banter, or an entirely new banter block that needs to fire after the current one being finished? In the latter case, I tend not to use APPEND and EXTERN if it only involves my NPC and a Bioware NPC... and I'd set a timer if I don't want the internal banter engine to randomly choose when to fire the follow-up to the previous dialogue.


--------------------
-Transition into darkness-
Go to the top of the page
 
Quote Post
Tervadh
post Jun 22 2008, 02:41 PM
Post #6





Forum Member
Posts: 49
Joined: 20-October 06




QUOTE(Sir_Carnifex @ Jun 22 2008, 12:05 AM) *
The second question is:

How do I go about setting a character's state to intoxicated? I couldn't find any specific state for that. The only thing I could find was the wish spell.
It's a stat (stats.ids) not a state (state.ids). So you can do a StatCheck and then apply a Drunkenness modifier (opcode #94) via spell, etc.


--------------------
"Humor is an affirmation of dignity, a declaration of man's superiority to all that befalls him." -Romain Gary, Promise at Dawn
Go to the top of the page
 
Quote Post
Sir_Carnifex
post Jun 22 2008, 10:43 PM
Post #7





Retired team member
Posts: 490
Joined: 8-April 08
From: U.S.A




QUOTE(Tervadh @ Jun 22 2008, 09:41 AM) *
QUOTE(Sir_Carnifex @ Jun 22 2008, 12:05 AM) *
The second question is:

How do I go about setting a character's state to intoxicated? I couldn't find any specific state for that. The only thing I could find was the wish spell.
It's a stat (stats.ids) not a state (state.ids). So you can do a StatCheck and then apply a Drunkenness modifier (opcode #94) via spell, etc.
I'll take a look and see what I can do. Thanks

About that variable not triggering, I solved it. Even though Weidu accepted my method of using the chain style in the APPEND to have Korgan have two lines before setting the variable, the game didn't like that. I had to put the variable after the first line, then GOTO another APPEND of Korgan's banter file. It works fine now.

Just for a visual, the edited version:

CODE
APPEND BKORGAN
IF ~InParty("CXHalbo")
See("CXHalbo")
!Dead("CXHalbo")
!StateCheck("CXHalbo",STATE_SLEEPING)
Global("KorganHalbo1","GLOBAL",0)~ THEN BEGIN KorganHalboTalkDwarf1
SAY ~Blah Blah.~
IF ~~ THEN DO ~SetGlobal("KorganHalbo1","GLOBAL",1)~ GOTO KorganHalboTalkDwarf1.01
END
END

APPEND BKORGAN
IF ~~ THEN BEGIN KorganHalboTalkDwarf1.01
SAY ~Blah Blah.~
IF ~~ THEN EXTERN BCXHALBO KorganHalboTalkDwarf1.1
END
END



Off the subject here but... While working with Korgan, I noticed that he's always repeating his first second* PC dialogue like the variable isn't setting there. Is this a bug that came with the game, or did I somehow mess something up?

*EDIT

Another Edit. I forgot to answer Moongaze. Sorry 'bout that!

QUOTE(Moongaze)
"The next in the series" being the next part of the same banter, or an entirely new banter block that needs to fire after the current one being finished? In the latter case, I tend not to use APPEND and EXTERN if it only involves my NPC and a Bioware NPC... and I'd set a timer if I don't want the internal banter engine to randomly choose when to fire the follow-up to the previous dialogue.

It's a new banter block. I do use APPEND and EXTERN because of the complicated nature of what I'm doing. Well, it's complicated for me anyway! Maybe once I get more experience, I'll learn simpler ways to do these things. For now, go with what works. smile.gif

Oh, and the second dialogue uses the J.DLG, so the banter timer doesn't come into play.

This post has been edited by Sir_Carnifex: Jun 22 2008, 11:22 PM


--------------------
"Once the game is over, the king and the pawn go back into the same box." - Italian Proverb

"I like criticism, but it must be my way." - Mark Twain

"A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort." - Herm Albright
Go to the top of the page
 
Quote Post
Bookwyrme
post Jun 22 2008, 11:54 PM
Post #8





Forum Member
Posts: 49
Joined: 22-July 04




CHAIN rules.
Go to the top of the page
 
Quote Post
Moongaze
post Jun 23 2008, 06:06 AM
Post #9





Forum Member
Posts: 467
Joined: 23-February 05
From: My den




QUOTE(Sir_Carnifex @ Jun 23 2008, 12:43 AM) *
Another Edit. I forgot to answer Moongaze. Sorry 'bout that!

QUOTE(Moongaze)
"The next in the series" being the next part of the same banter, or an entirely new banter block that needs to fire after the current one being finished? In the latter case, I tend not to use APPEND and EXTERN if it only involves my NPC and a Bioware NPC... and I'd set a timer if I don't want the internal banter engine to randomly choose when to fire the follow-up to the previous dialogue.

It's a new banter block. I do use APPEND and EXTERN because of the complicated nature of what I'm doing. Well, it's complicated for me anyway! Maybe once I get more experience, I'll learn simpler ways to do these things. For now, go with what works. smile.gif

Oh, and the second dialogue uses the J.DLG, so the banter timer doesn't come into play.


Egh, you're already better at this than I am, I see.
Sorry I could not be of any help.

This post has been edited by Moongaze: Jun 23 2008, 06:06 AM


--------------------
-Transition into darkness-
Go to the top of the page
 
Quote Post
Sir_Carnifex
post Jun 24 2008, 02:07 AM
Post #10





Retired team member
Posts: 490
Joined: 8-April 08
From: U.S.A




QUOTE(Tervadh @ Jun 22 2008, 09:41 AM) *
QUOTE(Sir_Carnifex @ Jun 22 2008, 12:05 AM) *
The second question is:

How do I go about setting a character's state to intoxicated? I couldn't find any specific state for that. The only thing I could find was the wish spell.
It's a stat (stats.ids) not a state (state.ids). So you can do a StatCheck and then apply a Drunkenness modifier (opcode #94) via spell, etc.

Alright, back to the intoxication thing. I have to admit that when I look at this explanation, then the stats, then the set spell, then the opcodes, I'm sure if anyone were looking at me, he'd see question marks floating above my head. So would it be too much to ask for a demonstration of HOW to use these to set a character to be drunk after a dialogue? Thanks!


--------------------
"Once the game is over, the king and the pawn go back into the same box." - Italian Proverb

"I like criticism, but it must be my way." - Mark Twain

"A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort." - Herm Albright
Go to the top of the page
 
Quote Post
Bookwyrme
post Jun 24 2008, 02:50 AM
Post #11





Forum Member
Posts: 49
Joined: 22-July 04




I wouldn't mind seeing a demonstration myself smile.gif
Go to the top of the page
 
Quote Post
kulyok
post Jun 24 2008, 10:59 AM
Post #12





Forum Member
Posts: 112
Joined: 8-September 05
From: Moscow, Russia




Look at Xan's code: there's an intoxication stat in his script; it's easy enough. Search O#XanS.baf in Xan/Scripts.


--------------------
Go to the top of the page
 
Quote Post
Sir_Carnifex
post Jun 24 2008, 09:58 PM
Post #13





Retired team member
Posts: 490
Joined: 8-April 08
From: U.S.A




Alright, I may be wrong, but it looks like that script only checks to see if the player is intoxicated. If it checks out, then it initiates the dialogue. I'm trying to do something a little different. Namely, have a character who is NOT drunk get set to intoxicated AFTER a dialogue. I don't see any SetStat action, so I assume that I have to do something with all that gibberish Tervadh mentioned.

Me after looking at it ---> wacko.gif


--------------------
"Once the game is over, the king and the pawn go back into the same box." - Italian Proverb

"I like criticism, but it must be my way." - Mark Twain

"A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort." - Herm Albright
Go to the top of the page
 
Quote Post
Daulmakan
post Jun 25 2008, 01:17 AM
Post #14





Forum Member
Posts: 71
Joined: 13-July 07
From: The Houses of the Holy




Can't you do a SetStat for it after the dialog? Or enforcing a spell with the drunkness effect/opcode?

QUOTE
#94 (0x05E) Stat: Drunkenness Modifier [94]Parameter #1: Statistic Modifier
Parameter #2: Type
Description:
Applies the modifier value specified by the 'Statistic Modifier' field in the style specified by the 'Type' field.

Known values for 'Type' are:
0 Cumulative Modifier -> Skill = Skill + 'Statistic Modifier' value
1 Flat Value Modifier -> Skill = 'Statistic Modifier' value
2 Percentage Modifier -> Skill = (Skill * 'Statistic Modifier' value) / 100


--------------------
I ain't evil, I'm just good looking.

Go to the top of the page
 
Quote Post
Sir_Carnifex
post Jun 25 2008, 02:23 AM
Post #15





Retired team member
Posts: 490
Joined: 8-April 08
From: U.S.A




I could if I knew how. First, I don't remember anything about SetStat action, nor could I find one in IESDP. I did find a ChangeStat action in IWD2 IESDP though. Is it perhaps another custom thing like CD_STATE_NOTVALID?

My main problem is that so far I've learned pretty much everything I know from actually seeing examples. Once I can see something, I can pick up how to do it (and usually remember) but explanations are a different story. You can try explaining this to me, but if I don't see it, odds are I'm going to still be confused -- which I am right now.


--------------------
"Once the game is over, the king and the pawn go back into the same box." - Italian Proverb

"I like criticism, but it must be my way." - Mark Twain

"A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort." - Herm Albright
Go to the top of the page
 
Quote Post
Sikret
post Jun 25 2008, 06:12 AM
Post #16


The Tactician
Group Icon

Distinguished Developer
Posts: 7781
Joined: 1-December 05




The method to do it is very easy. You make a custom spell which applies the intoxication effect and then forcecast it on the creature in the dialogue file or in a script (deending on the situation).

If you want, I can do it for you. Just send me your prefix (in order to name the new spell correctly to make sure that it won't cause conflicts with other mods) and the dialogue file in which you want to apply the effect (you can send them to me via PM if you want).


--------------------
Improved Anvil




Cheating is not confined to using external software or the console commands. Abusing the flaws and limitations of the game engine to do something that a human Dungeon Master would not accept or allow is cheating.
Go to the top of the page
 
Quote Post
Sir_Carnifex
post Jun 25 2008, 06:12 PM
Post #17





Retired team member
Posts: 490
Joined: 8-April 08
From: U.S.A




QUOTE(Sikret @ Jun 25 2008, 01:12 AM) *
The method to do it is very easy. You make a custom spell which applies the intoxication effect and then forcecast it on the creature in the dialogue file or in a script (deending on the situation).

If you want, I can do it for you. Just send me your prefix (in order to name the new spell correctly to make sure that it won't cause conflicts with other mods) and the dialogue file in which you want to apply the effect (you can send them to me via PM if you want).

Easy is a very relative word. smile.gif

I would be very appreciative if you would do that, Sikret. I'll PM the info over later.


--------------------
"Once the game is over, the king and the pawn go back into the same box." - Italian Proverb

"I like criticism, but it must be my way." - Mark Twain

"A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort." - Herm Albright
Go to the top of the page
 
Quote Post
Tervadh
post Jul 20 2008, 08:13 PM
Post #18





Forum Member
Posts: 49
Joined: 20-October 06




QUOTE(Sir_Carnifex @ Jun 24 2008, 05:58 PM) *
Alright, I may be wrong, but it looks like that script only checks to see if the player is intoxicated. If it checks out, then it initiates the dialogue. I'm trying to do something a little different. Namely, have a character who is NOT drunk get set to intoxicated AFTER a dialogue. I don't see any SetStat action, so I assume that I have to do something with all that gibberish Tervadh mentioned.
Eh, sorry for the late response... e-mail notifications only work half the time it seems.

What Sikret said is accurate. There is in fact already a spell to apply drunkenness in the game (spwish33) though as a wish spell I think this makes everyone drunk, so you may want your own version smile.gif. The script could be as simple as:
CODE
IF
  Global("mydrunk","GLOBAL",0)
  CheckStatLT(LastTalkedToBy(),50,INTOXICATION)
THEN
  RESPONSE #100
    SetGlobal("mydrunk","GLOBAL",1)
    ApplySpellRES("SPWISH33",LastTalkedToBy())
END
I'm sure someone's come up with something more sophisticated by now.

You can use the same opcode on an item, to make (for example) a bottle of wine that increases drunkenness when consumed.

This post has been edited by Tervadh: Jul 20 2008, 08:15 PM


--------------------
"Humor is an affirmation of dignity, a declaration of man's superiority to all that befalls him." -Romain Gary, Promise at Dawn
Go to the top of the page
 
Quote Post
Sir_Carnifex
post Jul 23 2008, 03:31 AM
Post #19





Retired team member
Posts: 490
Joined: 8-April 08
From: U.S.A




QUOTE(Tervadh @ Jul 20 2008, 03:13 PM) *
Eh, sorry for the late response... e-mail notifications only work half the time it seems.

What Sikret said is accurate. There is in fact already a spell to apply drunkenness in the game (spwish33) though as a wish spell I think this makes everyone drunk, so you may want your own version smile.gif. The script could be as simple as:
CODE
IF
  Global("mydrunk","GLOBAL",0)
  CheckStatLT(LastTalkedToBy(),50,INTOXICATION)
THEN
  RESPONSE #100
    SetGlobal("mydrunk","GLOBAL",1)
    ApplySpellRES("SPWISH33",LastTalkedToBy())
END
I'm sure someone's come up with something more sophisticated by now.

You can use the same opcode on an item, to make (for example) a bottle of wine that increases drunkenness when consumed.


Thanks for the answer. Sikret made the specialized spell for me already, however, and saved me the headache. smile.gif


--------------------
"Once the game is over, the king and the pawn go back into the same box." - Italian Proverb

"I like criticism, but it must be my way." - Mark Twain

"A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort." - Herm Albright
Go to the top of the page
 
Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:



- Lo-Fi Version Time is now: 16th November 2024 - 09:22 AM