Jump to content

Area Scripts


Salk

Recommended Posts

Hello!

 

I am having troubles understanding why a block I have added to an Area script seems to be bleeding into other areas as well, meaning it is active where it really shouldn't.

 

For testing reasons (@0 shows the text "Test"), I appended this simple block to AR7800.BCS that runs, of course, in a loop (BGT Area, which corresponds to BG1 AR0800.BCS):

IF
    Global("WarningGiven","GLOBAL",0)
THEN
    RESPONSE #100
        DisplayStringHead(Player1,@0)
END

I CLUAConsole myself to AR7800 and enter different buildings in that area and the script keeps running in each of these buildings, even if the area has changed. I suspect that the main area script extends for some obscure reason to all the sub areas?

 

Is that how it is or am I not seeing something?

 

Thanks!

Link to comment

Hello!

 

I am having troubles understanding why a block I have added to an Area script seems to be bleeding into other areas as well, meaning it is active where it really shouldn't.

 

For testing reasons (@0 shows the text "Test"), I appended this simple block to AR7800.BCS that runs, of course, in a loop (BGT Area, which corresponds to BG1 AR0800.BCS):

IF
    Global("WarningGiven","GLOBAL",0)
THEN
    RESPONSE #100
        DisplayStringHead(Player1,@0)
END

I CLUAConsole myself to AR7800 and enter different buildings in that area and the script keeps running in each of these buildings, even if the area has changed. I suspect that the main area script extends for some obscure reason to all the sub areas?

 

Is that how it is or am I not seeing something?

 

Thanks!

Is this EE or old game?

Are all party members in the same area?

And yes, this happens under some conditions. It does not happen the other way around (from a dedicated subarea script to the main).

Link to comment

 

Hello!

 

I am having troubles understanding why a block I have added to an Area script seems to be bleeding into other areas as well, meaning it is active where it really shouldn't.

 

For testing reasons (@0 shows the text "Test"), I appended this simple block to AR7800.BCS that runs, of course, in a loop (BGT Area, which corresponds to BG1 AR0800.BCS):

IF
    Global("WarningGiven","GLOBAL",0)
THEN
    RESPONSE #100
        DisplayStringHead(Player1,@0)
END

I CLUAConsole myself to AR7800 and enter different buildings in that area and the script keeps running in each of these buildings, even if the area has changed. I suspect that the main area script extends for some obscure reason to all the sub areas?

 

Is that how it is or am I not seeing something?

 

Thanks!

Is this EE or old game?

Are all party members in the same area?

And yes, this happens under some conditions. It does not happen the other way around (from a dedicated subarea script to the main).

 

 

It is an old game.

 

I am testing using only one party member and I am baffled by this seemingly senseless behavior.

 

I added to the script above the condition:

 

!See("thiefg")

 

when I enter one of the buildings where THIEFG is clearly before me in plain sight, the script still returns true, which is even more absurd.

 

I find myself in trouble because I need to reset a variable by exiting four "sub" areas that "belong" to AR7800 and the only way I can think of doing it is to extend AR7800.BCS.

Link to comment

 

 

Hello!

 

I am having troubles understanding why a block I have added to an Area script seems to be bleeding into other areas as well, meaning it is active where it really shouldn't.

 

For testing reasons (@0 shows the text "Test"), I appended this simple block to AR7800.BCS that runs, of course, in a loop (BGT Area, which corresponds to BG1 AR0800.BCS):

IF
    Global("WarningGiven","GLOBAL",0)
THEN
    RESPONSE #100
        DisplayStringHead(Player1,@0)
END

I CLUAConsole myself to AR7800 and enter different buildings in that area and the script keeps running in each of these buildings, even if the area has changed. I suspect that the main area script extends for some obscure reason to all the sub areas?

 

Is that how it is or am I not seeing something?

 

Thanks!

Is this EE or old game?

Are all party members in the same area?

And yes, this happens under some conditions. It does not happen the other way around (from a dedicated subarea script to the main).

 

 

It is an old game.

 

I am testing using only one party member and I am baffled by this seemingly senseless behavior.

 

I added to the script above the condition:

 

!See("thiefg")

 

when I enter one of the buildings where THIEFG is clearly before me in plain sight, the script still returns true, which is even more absurd.

 

I find myself in trouble because I need to reset a variable by exiting four "sub" areas that "belong" to AR7800 and the only way I can think of doing it is to extend AR7800.BCS.

 

1) You need to give thiefg the script name (they have none by default)

with tp2

COPY_EXISTING ~thiefg.cre~ ~override~

WRITE_ASCII 0x280 ~thiefg~

2) In who's script is the See() - who is to see the thief?

If this is in an area script, it makes no sense - You would need InMyArea() or InActiveArea()

Link to comment

Add AreaCheck() to the script block. Then it really should only trigger in the main area?

EDIT: and See() only makes sense in an area script if it's performed by ActionOverride, I think (just in case).

See() is a condition...

ActionOverride - well, the name says it...

Link to comment

We meant the same thing concerning See(). A cre has to perform it, so in an area script you would use ActionOverride(Player1,See("xxx"))EDIT or maybe that's nonsense - how do you use See() in an area script?

No, you cannot - because See() is not an action and you can only use ActionOverride to let a cre perform actions

And you cannot use ActionOverride to let someone check a condition

ActionOverride(Player1,See("xxx")) is neither a valid condition nor a valid action...in no type of script.

Link to comment

Roxanne,

 

I have already given a DV to thiefg:

COPY_EXISTING     ~thiefg.cre~     ~override~
    WRITE_ASCII SCRIPT_DEFAULT    ~THIEF5~    #8
    WRITE_ASCII DEATHVAR        ~THIEFG~    #8
BUT_ONLY

so that is not the issue.

 

I will call the !See("thiefg") trigger from the Area Script using TriggerOverride and it should work fine.

!TriggerOverride(Player1, See("thiefg"))

AreaCheck must also be called from a .cre file so it would be the same.

TriggerOverride(Player1,AreaCheck("AR7800"))

Still, I am just wondering why the engine should just work that way. Extending an area script to other areas seems a very bad move to me.

 

Thanks for your suggestions!

Link to comment

Roxanne: oft course. Totally mixed that up.

 

AreaCheck() has to be run by a cre script? I mean, I totally see why the trigger wouldn't make any sense in an area script, but does it really not work?

0x407E AreaCheck(S:ResRef*)

Returns true only if the active CRE is in the area specified.

 

But to be honest, I have never used this myself in an area script - in practice, from an area script I would rather check if a certain Creature is there or not.

Link to comment

I added to the script above the condition:

!See("thiefg")

when I enter one of the buildings where THIEFG is clearly before me in plain sight, the script still returns true, which is even more absurd.

 

If there are multiple active THIEFGs around, the game will only refer to the first (or last, depending on circumstances) such object, even if the second is right in from of you. You need either a custom unique DV, or assign creature a custom script, or use dynamic [] object type (which is not without limitations too).

As far as active area check goes, I used InMyArea(Player1) in SoD, when this issue would come up. Assuming BG city areas allow party splitting, you'll likely want OR(6) InMyArea(Player1) ... InMyArea(Player6).

Link to comment

AreaCheck must also be called from a .cre file so it would be the same.

TriggerOverride(Player1,AreaCheck("AR7800"))

Still, I am just wondering why the engine should just work that way. Extending an area script to other areas seems a very bad move to me.

 

Thanks for your suggestions!

 

use this instead:

AreaCheckObject("AR7800",Player1)
Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...