Jump to content

Area Scripts


Salk

Recommended Posts

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

 

TriggerOverride/NextTriggerObject is ToBex/EE feature. BG1 engine doesn't support it. So instead of using something that needs external exe hacking AreaCheckObject seems more reasonable (it's supported by BG2:ToB engine according to IESDP, and Salk is modding BGT, not BG1)

Link to comment

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

Thanks for the suggestion.

 

It is either that or, like K4thos recommended, AreaCheckObject() which is another piece of IESDP good info I overlooked.

 

I take advantage of your presence here to ask you another thing.

 

In short, I am trying (unsuccessfully) to think of a set of triggers that would make a .cre turn hostile if any of the party members in sight would attempt to hide in shadow or become invisible.

OR(12)
TriggerOverride(Player1, ModalState(STEALTH))
TriggerOverride(Player2, ModalState(STEALTH))
TriggerOverride(Player3, ModalState(STEALTH))
TriggerOverride(Player4, ModalState(STEALTH))
TriggerOverride(Player5, ModalState(STEALTH))
TriggerOverride(Player6, ModalState(STEALTH))
StateCheck(Player1,STATE_INVISIBLE)
StateCheck(Player2,STATE_INVISIBLE)
StateCheck(Player3,STATE_INVISIBLE)
StateCheck(Player4,STATE_INVISIBLE)
StateCheck(Player5,STATE_INVISIBLE)
StateCheck(Player6,STATE_INVISIBLE)

This will unfortunately make it true even if the party member is not in sight. Any ideas?

Link to comment

Detect ignores invisibility, so you could pair it with that. It also ignores LOS, so also LOS().

 

Sorry, I am not sure I understand how I should make it work.

 

What I need is a way to make the block return true if any visible party member becomes invisible (the way I have it now, it becomes true even if the party member is out of sight).

 

Detect ignores invisibility, okay, but how does that help me?

Link to comment

My approach would be to make different script blocks for the 6 party slots? Maybe combine it with Range() (since See() wouldn't give true...)

You could also first run a script block that checks whether your creature sees a party member. And then another to check whether that party member is turning invisible.

 

Something like

 

0. block //needed to check whether the cre is still in range

IF

Global("ISeePlayer1","LOCALS",1)

RangeGT(##) //some value below the line of sight

THEN

SETGlobal("ISeePlayer1","LOCALS",0)

 

1. block

See(Player1) -> SetGlobal("ISeePlayer1","LOCALS",1)

 

2. block

Global("ISeePlayer1","LOCALS",1)

Range(##) //some value below the line of sight

OR(2)

TriggerOverride(Player1, ModalState(STEALTH))
StateCheck(Player1,STATE_INVISIBLE)

THEN -> your reactions

Link to comment
Detect ignores invisibility, so you could pair it with that. It also ignores LOS, so also LOS().

 

Detect() does respect LoS, it's Heard() that doesn't.

 

In short, I am trying (unsuccessfully) to think of a set of triggers that would make a .cre turn hostile if any of the party members in sight would attempt to hide in shadow or become invisible.

...

This will unfortunately make it true even if the party member is not in sight. Any ideas?

Static objects (PlayerX, death vars, etc.) are returned regardless of them being detected by script owner.

 

You likely want this, repeated for 6 players:

IF
  Detect(Player1)
  !See(Player1)
THEN
  RESPONSE #100
END
Link to comment

Thanks, Ardanis!

That might make the trick. I will test it right away!

 

UPDATE: No, it actually does not work because the response triggers when any of my party members hides in shadow/becomes invisible even when the guard does not see them do it.

Link to comment

I may have misinterpreted the request then... Do you need the guard to only react when going invisible happens within his field of vision? If so, then what Jastey posted should do the trick (although, if the writing dept. would ask me to do it, I'd rather send the scene back to them for revisions, as not being very optimal from tech perspective).

Link to comment

Yes, I was exactly trying to accomplish that.

 

Out of curiosity, why would you think it is a bad case? To me, it would make much sense that a guard would raise an alarm when someone disappears before his eyes (or even appear, I will try to account for that too once I make the first part right).

 

Anyway, I have been thinking of something like this but it does seem convoluted and bloated (especially considering that I should do that 6 times!):

IF
    Global("InSight1","LOCALS",0)
    !See(Player1)
    TriggerOverride(Player1,See("thiefg"))
THEN
       RESPONSE #100
        SetGlobal("InSight1","LOCALS",1)
END

IF
    GlobalLT("InSight1","LOCALS",2)
    !See(Player1)
    !TriggerOverride(Player1,See("thiefg"))
THEN
       RESPONSE #100
        SetGlobal("InSight1","LOCALS",2)
END

IF
    GlobalGT("InSight1","LOCALS",0)
    See(Player1)
    TriggerOverride(Player1,See("thiefg"))
    !StateCheck(Player1,STATE_INVISIBLE)
THEN
       RESPONSE #100
        SetGlobal("InSight1","LOCALS",0)
END

IF
    Detect(Player1)
    Global("InSight1","LOCALS",1)
THEN
       RESPONSE #100
        /* ALARM */
END
Link to comment

Not bad, just not what the game was designed with in mind, imo.

One reason, as you noted yourself, is the bloat - the larger something is in size, the harder to maintain it gets. As well as increasingly prone to errors. This is only a general rule of thumb, though.
Then, whenever the engine processes script action, the owner's sprite assumes "ready" stance. Just cosmetic inconvenience.

Link to comment

Not bad, just not what the game was designed with in mind, imo.

 

One reason, as you noted yourself, is the bloat - the larger something is in size, the harder to maintain it gets. As well as increasingly prone to errors. This is only a general rule of thumb, though.

 

Then, whenever the engine processes script action, the owner's sprite assumes "ready" stance. Just cosmetic inconvenience.

Yes, I completely agree.

 

I would love to avoid that "ready" stance but I cannot see any way around it.

 

Do you think the script above might work though?

Link to comment

This actually seems to do all I want but it is going to make the bloat even worse, considering it must be x6 (Player1-6)...

IF
Global("InSight1","LOCALS",1)
See(Player1)
THEN
RESPONSE #100
SetGlobal("InSight1","LOCALS",0) // I am visible and in visual range, reset local variable
FaceObject(Player1)
END

IF
Global("InSight1","LOCALS",0)
!Global("WarningGiven","GLOBAL",99)
!See(Player1)
TriggerOverride(Player1,See("thiefg"))
THEN
RESPONSE #100
SetGlobal("WarningGiven","GLOBAL",99) // I see the guard, he does not see me, ALARM!
FaceObject(Player1)
END

IF
Global("InSight1","LOCALS",0)
!See(Player1)
!TriggerOverride(Player1,See("thiefg"))
THEN
RESPONSE #100
SetGlobal("InSight1","LOCALS",1) // We do not see each other
END

IF
Global("InSight1","LOCALS",1)
!See(Player1)
!TriggerOverride(Player1,See("thiefg"))
StateCheck(Player1,STATE_INVISIBLE)
THEN
RESPONSE #100
SetGlobal("InSight1","LOCALS",2) // We do not seeing each other and I am now invisible
END

IF
Global("InSight1","LOCALS",2)
!See(Player1)
TriggerOverride(Player1,See("thiefg"))
THEN
RESPONSE #100
SetGlobal("InSight1","LOCALS",3) // I am still invisible but in visual range
END

IF
GlobalGT("InSight1","LOCALS",1)
!See(Player1)
!TriggerOverride(Player1,See("thiefg"))
!StateCheck(Player1,STATE_INVISIBLE)
THEN
RESPONSE #100
SetGlobal("InSight1","LOCALS",1) // I was invisible and now I am visible but out of visual range OR I return visible out of visual range after having been invisible in visual range
END

IF
Global("InSight1","LOCALS",3)
See(Player1)
THEN
RESPONSE #100
SetGlobal("InSight1","LOCALS",0) // I return visible in visual range after having been invisible in visual range, ALARM!
FaceObject(Player1)
SetGlobal("WarningGiven","GLOBAL",99)
END
Link to comment

Is there a Trigger that checks that all the party members are actually in the same area?

 

Or perhaps a workaround to get the same result?

Is that not

IF

InActiveArea(Player1).....Player6

THEN

 

Workaround

would be to make entrance to the area PartyRequired transition

Link to comment

Archived

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

×
×
  • Create New...