Jump to content

How to set a local variable on a creature from an area script?


Guest Furlong

Recommended Posts

Guest Furlong

Hi,

Is there any way to set a local variable on a creature from an area script? Neither of these two approaches work:

ActionOverride("Imoen",SetGlobal("Rested","LOCALS",2))
CutSceneId("Imoen")     // I guess only works in a creature script
SetGlobal("Rested","LOCALS",2) 

 

Link to comment
Guest Furlong

I'm skipping the new game Irenicus cutscene stuff in original edition, BG2ToB 2.5.26498, and while I'm at it also skipping Imoen's post-rest dialogue. ActionOverride works fine to make her unlock and open the cell and then join the party, but the local var ain't getting set (CLUAConsole:GetGlobal("Imoen","LOCALS") with the mouse cursor over her says var doesn't exist and dialogue still occurs after resting. )

[Hopefully this isn't a double post, I had a connection weirdness]

Link to comment
Guest Furlong

Drat, it works in EE.

@lynx: Hi! Since you're possibly one of the few used to both editions due to your work on the IESDP, would you happen to know of a way to set a creature local variable from an area script in BG2ToB 2.5.26498?

If not I guess I'll have to do it in IMOEN.BCS... x_x

Link to comment

ActionOverride will work fine if you use the correct script name. For BG2(:EE), it's actually Imoen (inside the ID).

What you quoted above to check for it is not correct syntax, it would be:

CLUAConsole:GetGlobal("Rested","LOCALS")

while the mouse curser needs to hover above Imoen.

But putting it into Imoen's script at the top should definitely prevent it, yes.

Link to comment
Guest Furlong

Thanks for the quick responses! unfortunately ActionOverride only appears to let SetGlobal reach the creature's local scope in EE. (Also only CLUAConsole exists in original edition, not the C shorthand, but that's normal)

I'll try IncrementGlobal just in case but let's assume it won't work either in that edition ^^

Anyone sees an alternate way to set that var from area script by any chance?

Link to comment
Guest Furlong

Haha yes, that would require an SPL or tweaking her belt, so I might as well accept my fate and edit IMOEN.BCS... ^^'

(For the record, IncrementGlobal didn't work either.)

Link to comment
52 minutes ago, Guest Furlong said:

unfortunately ActionOverride only appears to let SetGlobal reach the creature's local scope in EE.

It works fine in oBG2. For example, putting the following at the top of AR0602.BCS:

IF
    Global("B3SetLocal","GLOBAL",1)
THEN
    RESPONSE #100
        SetGlobal("B3SetLocal","GLOBAL",0)
        ActionOverride("Imoen",SetGlobal("B3Test","LOCALS",1))
        Continue()
END

And executing the following in the console:

CLUAConsole:SetGlobal("B3SetLocal","GLOBAL",1)
-- Wait for Imoen to execute the action
CLUAConsole:GetGlobal("B3Test","LOCALS") -- While hovering cursor over Imoen

Are you sure that the block with the ActionOverride() is actually being executed, that Imoen is available to execute the action, and that her action queue isn't being cleared by something else, (player commands, ClearActions())?

Link to comment
Guest Furlong

Hah! Yay. It was apparently being ruined by the command right above, ActionOverride("Imoen",JoinParty()). Moving the variable setter right above that made it work. I initially did intend to look into this because JoinParty changes a bunch of things, but I let it slip when I saw it work in EE. But in EE, I probably didn't bother putting the JoinParty in, so it was not a 1:1 comparison. After checking (quickly) it seems that SetGlobal doesn't work right after JoinParty in EE either.

I'll be curious to know what exactly JoinParty is doing that causes the issue though. Makes Imoen unavailable to execute actions until the next script round?

Either way, the skip code is entirely contained in AR0602 now. Thank you three!

Link to comment
Guest Furlong

  Just for the record, moving other Imoen ActionOverrides in the following script block seems to get them executed properly.

IF
	Global("Step","GLOBAL",0)
THEN
	RESPONSE #100
		SetGlobal("Step","GLOBAL",1)
		ActionOverride("Imoen",SetGlobal("BeforeJoin","LOCALS",1)) // Works
		ActionOverride("Imoen",JoinParty())
		ActionOverride("Imoen",SetGlobal("AfterJoin","LOCALS",1)) // Fails
		Continue()
END

IF
	Global("Step","GLOBAL",1)
THEN
	RESPONSE #100
		SetGlobal("Step","GLOBAL",2)
		ActionOverride("Imoen",SetGlobal("NextBlock","LOCALS",1)) // Works
END


@jastey: Hey, I didn't need "convincing" from someone else as if not believing you. You just didn't provide the answer, and another good sir did. There's exactly zero issue in that, I've been thanking you several times for your feedback and reactivity. You thought (and now edited out) that CLUAConsole was a mistake and C had to be used, meaning you're extremely rusty with OE at best. There's, again, no negative thing to think of it. I expect most of the English BG community to not have the original edition installed at all nowadays. But given that, there was a risk for the thread to fade away unsolved unless it reached one of the few eyes able and willing to address an (incorrectly but not unreasonably alleged) OE-only issue. Hence my "Drat, it works in EE" and lighting the Lynx signal.

Learning extended script context would allow the helper to show the helped that JoinParty is the issue indeed, but not if that were part of the large gap between EE and OE! On the other hand, fresh OE knowledge or an OE install would be enough without extended context, whether the issue is part of the mountain of differences between EE and OE or not. :)

Anyway thanks again, glad to see a BG forum so reactive in the 2020s!

Link to comment

I told you it works. I know it works for old engine just as well, so I didn't need to think about it. I edited in the missing LUAConsole for my cheat code because I missed that you were asking for classic engine. My mods are all compatible with old BGII engine, to say my knowledge about modding script actions for it is rusty is another sign how you are jumping to conclusions, just like you did with stating it doesn't work.for old engine although your script was at fault.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...