Skip to content

Difference between InMyArea() and Exists()?

chimericchimeric Member Posts: 1,163
Is there?

Comments

  • jasteyjastey Member Posts: 2,780
    Both give true if the creature exists in the same/current area.
    But: You can't use "InMyArea()" in an area script.
  • chimericchimeric Member Posts: 1,163
    That makes sense. Thanks, jastey.
  • jasteyjastey Member Posts: 2,780
    I just learned that InMyArea() works in area scripts, too (have a look at AR0700.bcs), so I don't know what the difference is.
  • BalquoBalquo Member, Developer Posts: 2,746
    Be careful when using Exists() with PCs. They exist whether or not they are in the same area.
  • jasteyjastey Member Posts: 2,780
    Are you sure? In IESDP, it says for Exists():
    Returns true only if the specified object exists in the current area (note that dead creatures can still be counted as existing).
  • BalquoBalquo Member, Developer Posts: 2,746
    For any regular NPC yes. But for the PC ones such as Minsc, Imoen, etc
  • jasteyjastey Member Posts: 2,780
    You mean non-joinable (non-global) characters will only be counted in the current area, but for global NPCs Exists() gives true if the NPC exists in another area?
  • BalquoBalquo Member, Developer Posts: 2,746
    Yes
  • jasteyjastey Member Posts: 2,780
    That's very interesting, thank you!
  • BalquoBalquo Member, Developer Posts: 2,746
    Throw this into the bottom of ar2600.bcs (candlekeep) and you'll see.
    IF
    	Exists("minsc")
    THEN
    	RESPONSE #100
    		DisplayStringHead(Player1,100)
    END
  • chimericchimeric Member Posts: 1,163
    edited February 2017
    Yes, he's right. I just checked it. It's also potentially a problem, because that creature is going to show up as existing even if you kill it. And it's not necessarily one of the joinable NPC that are easy to keep track of. If you just want to teleport a basic NPC to another area, you have to make him global, and then if he dies in the plot, well...
Sign In or Register to comment.