Jump to content


Photo

Area Scripts


30 replies to this topic

#1 Salk

Salk
  • Modders
  • 2854 posts
  • Gender:Male
  • Location:Sweden

Posted 28 February 2017 - 02:36 AM

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!


Edited by Salk, 28 February 2017 - 02:37 AM.


#2 Roxanne

Roxanne
  • Modders
  • 1098 posts
  • Gender:Not Telling

Posted 28 February 2017 - 02:47 AM

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).


Edited by Roxanne, 28 February 2017 - 02:49 AM.

The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*


#3 Salk

Salk
  • Modders
  • 2854 posts
  • Gender:Male
  • Location:Sweden

Posted 28 February 2017 - 03:07 AM

 

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.



#4 jastey

jastey
  • Gibberlings
  • 6461 posts
  • Gender:Female

Posted 28 February 2017 - 03:20 AM

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).

Edited by jastey, 28 February 2017 - 03:21 AM.


#5 Roxanne

Roxanne
  • Modders
  • 1098 posts
  • Gender:Not Telling

Posted 28 February 2017 - 03:24 AM

 

 

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()


Edited by Roxanne, 28 February 2017 - 03:30 AM.

The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*


#6 Roxanne

Roxanne
  • Modders
  • 1098 posts
  • Gender:Not Telling

Posted 28 February 2017 - 03:28 AM

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...


The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*


#7 jastey

jastey
  • Gibberlings
  • 6461 posts
  • Gender:Female

Posted 28 February 2017 - 03:35 AM

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?

Edited by jastey, 28 February 2017 - 03:36 AM.


#8 Roxanne

Roxanne
  • Modders
  • 1098 posts
  • Gender:Not Telling

Posted 28 February 2017 - 03:41 AM

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.


The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*


#9 Salk

Salk
  • Modders
  • 2854 posts
  • Gender:Male
  • Location:Sweden

Posted 28 February 2017 - 03:47 AM

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!


Edited by Salk, 28 February 2017 - 03:53 AM.


#10 jastey

jastey
  • Gibberlings
  • 6461 posts
  • Gender:Female

Posted 28 February 2017 - 04:01 AM

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?

#11 Roxanne

Roxanne
  • Modders
  • 1098 posts
  • Gender:Not Telling

Posted 28 February 2017 - 04:11 AM

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.


Edited by Roxanne, 28 February 2017 - 04:14 AM.

The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*


#12 jastey

jastey
  • Gibberlings
  • 6461 posts
  • Gender:Female

Posted 28 February 2017 - 04:34 AM

Thank you! (I should stop posting if not at my PC, all I write is either wrong or stupid.)

#13 Ardanis

Ardanis

    A very GAR character

  • Modders
  • 2496 posts
  • Gender:Male
  • Location:Saint-Petersburg, Russia

Posted 28 February 2017 - 07:44 AM

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).


Edited by Ardanis, 28 February 2017 - 07:45 AM.

"Uguu~ Boku Ayu."

Before you start breaking wall tiles with your bare fists, ask yourself first - do you truly need it?

#14 K4thos

K4thos
  • Modders
  • 872 posts
  • Gender:Male

Posted 28 February 2017 - 10:40 AM


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)


#15 Roxanne

Roxanne
  • Modders
  • 1098 posts
  • Gender:Not Telling

Posted 28 February 2017 - 10:51 AM

use this instead:

AreaCheckObject("AR7800",Player1)

@K4thos

 

Problem is that he tries to mod old BG1 - it does not have this feature.


The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*




Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users