-
Posts
104 -
Joined
-
Last visited
Content Type
Forums
Events
Downloads
Gallery
Mods
News
Store
Posts posted by Roberciiik
-
-
Hi again,
I work on my first small mod for BG1 part of BGT and I'm still learning modder world. I encountered a game grash when I wrote a moving NPC to another area baf script.
From the beginning: I need to remove joinable NPC from the world (from any place) after entering to my area. There are 3 posibilities on how I should handle such NPC:
1. I've never enter area where NPC spawns. This is easy - to disable NPC I've just set "BGTNPCxxxx" variable to 1
2. I've met NPC but disallowed to join the party. As I understand, NPC is not included in GAM file yet so I've tried to do this by MakeGlobal() function. Then I can call MoveGlobal on my area.
3. NPC joined my party so script from 2 bullet is applied and it looks like game adds NPC to GAM file twice.As an example let's consider Alora NPC. I extended top AR7230.bsc (Hall of Wonder) script with this snippet:
IF Global("MyMod_AloraIsGlobal", "GLOBAL", 0) Exists("Alora") THEN RESPONSE #100 ActionOverride("Alora", MakeGlobal()) SetGlobal("MyMod_AloraIsGlobal", "GLOBAL", 1) Continue() END
As Alora is now Global I should be able to move her with MoveGlobal. My area's script contains:
IF !InPartyAllowDead("Alora") Global("MyMod_AloraDestroyed", "GLOBAL", 0) THEN RESPONSE #100 MoveGlobal("MyAR", "Alora", [0.0]) ActionOverride("Alora", DestroySelf()) SetGlobal("MyMod_AloraDestroyed", "GLOBAL", 1) Continue() END
As of now everything works. However when I allowed Alora to join, kicked her from party later, and I moved to my area (to remove her from world) and came back to AR7230 - game crashes.
Is it related to doubled NPC entry in GAM file?
I can't find what exacly causes the crash, last TobEx entry is "[Sun 28 Jun 2020 18:46:43] AREA-TRANSITION: CInfGame::SetVisibleArea"
How can I fix this? Is there any good solution to track position of NPC (NPC could be in party or not).
Thanks!
-
Thank you all!
I will try those options and give a feedback if it works
-
Hi,
I would like to create my first small mod for BGT so I'm sorry for being such newbe. I want to add missing search map for traveling to the south from Nashkel Mines. Natively BGT AR4400 does not have south travel exit (cursor is blocked rather than travel wheel). Can I patch the original location programatically to add such travel point or need I to edit original location's files?
I have already added worldmap links so I can travel between these two areas if they are visited before.
I found that there is WeiDU fj_are_structure macro to add travel region, however it looks like enabling direct travel to new location instead of opening the worldmap to choose the area. I don't know if this macro handles opening the worldmap at all.
Let me know if there are mods which extend Nashkel Mines with south area exit, I could check them before install and not adding the same exit twice.
Thanks for help,
Robert
Scripting - Moving NPC crashes game (MakeGlobal/MoveGlobal/DestroySelf)
in Modding Q&A
Posted
I don't know what tools can be used to debug it further. Without my logic game runs correctly. My setup contains only TobEx + BG2fixpack + BGT + my mod.
I'm not sure if the root cause is MakeGlobal(). Maybe "ActionOverride("Alora", DestroySelf())" causes that BGT AR7230 script crashes because it checks for Alora existence...
It is my deduction that MakeGlobal and then NPC joining will add entry twice in GAM because in EE there is MakeGlobalOverride() which prevents this, right?
I will check later if moving NPC (without destroy) causes this crash.