Jump to content


Photo

Area Scripts


30 replies to this topic

#16 K4thos

K4thos
  • Modders
  • 1057 posts
  • Gender:Male

Posted 28 February 2017 - 12:19 PM

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)


Edited by K4thos, 28 February 2017 - 12:22 PM.


#17 Salk

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

Posted 28 February 2017 - 11:33 PM

use this instead:

AreaCheckObject("AR7800",Player1)


Great!

Thanks! :)

#18 Salk

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

Posted 28 February 2017 - 11:41 PM

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?



#19 lynx

lynx
  • Modders
  • 2990 posts
  • Gender:Male
  • Location:Ljubljana, Slovenija

Posted 01 March 2017 - 06:08 AM

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


Edited by lynx, 01 March 2017 - 06:08 AM.

GemRB - IE anywhere.
Mages needed! Looking for Planescape: Torment testers
Market android version IS NOT SUPPORTED ANYMORE: reported bugs will be ignored! Still looking for builders ...

#20 Salk

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

Posted 01 March 2017 - 06:56 AM

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?


Edited by Salk, 01 March 2017 - 06:57 AM.


#21 jastey

jastey
  • Gibberlings
  • 6895 posts
  • Gender:Female

Posted 01 March 2017 - 07:02 AM

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



#22 Ardanis

Ardanis

    A very GAR character

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

Posted 01 March 2017 - 10:03 AM

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

"Uguu~ Boku Ayu."

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

#23 Salk

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

Posted 01 March 2017 - 08:11 PM

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.


Edited by Salk, 01 March 2017 - 08:58 PM.


#24 Ardanis

Ardanis

    A very GAR character

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

Posted 01 March 2017 - 09:25 PM

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


"Uguu~ Boku Ayu."

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

#25 Salk

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

Posted 01 March 2017 - 10:29 PM

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

Edited by Salk, 01 March 2017 - 10:33 PM.


#26 Ardanis

Ardanis

    A very GAR character

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

Posted 01 March 2017 - 10:54 PM

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.


"Uguu~ Boku Ayu."

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

#27 Salk

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

Posted 01 March 2017 - 10:56 PM

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?

#28 Salk

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

Posted 02 March 2017 - 01:08 AM

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

Edited by Salk, 02 March 2017 - 02:04 AM.


#29 Salk

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

Posted 02 March 2017 - 10:23 PM

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?


Edited by Salk, 02 March 2017 - 10:23 PM.


#30 Roxanne

Roxanne
  • Modders
  • 1576 posts
  • Gender:Not Telling

Posted 03 March 2017 - 12:06 AM

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


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