jastey Posted February 3, 2017 Share Posted February 3, 2017 I want my dog, which I currently added to the party as "familar", not to die permanently. I guess there are several possibilities e.g. dropping its body for resurrection in the next temple etc. - (which is too much work as I'd have to tweak all priest dialogues). I didn't want this, plus, I also don't want it to die all the time because I didn't notice its health status. But I also don't want it to become a never dying killing machine. So, what I implemented was the following: It has a 1 min HP item. If at 1 HP during a fight, its status will be changed from FAMILIAR to NEUTRAL so enemies will stop attacking it, while it fakes unconsciousness (PlayDead()). Once the fight is over, the familiar gets up and rejoins the group as familiar. This works, but would you see a more intelligent way of handling this? Is there a way to prevent death but make the creature unconscious / not participating if at low health without the 1 min HP cheat? Link to comment
argent77 Posted February 3, 2017 Share Posted February 3, 2017 How about allow it to die (or to fake death by removing the creature on low hp) and make the dropped body conversable, so you could add an option to resurrect it yourself via dialog after a certain span of time. Link to comment
jastey Posted February 3, 2017 Author Share Posted February 3, 2017 How would I make the dropped body conversable? Do you mean making a Misc() item that can be placed into the quick slot to set a variable and then do the rest via invisible cre etc.? Link to comment
argent77 Posted February 3, 2017 Share Posted February 3, 2017 Yes, something like this. Either place the body into the dog's inventory which is dropped when it dies, or drop it by script action DropItem("dogitem", [-1.-1]) from the dog's creature script before you remove the creature (when you simulate death). There are different ways how to resurrect the dog later. Not all of them require an invisible helper creature. You can probably do it via dialog script if you want to use a conversable item. Link to comment
jastey Posted February 3, 2017 Author Share Posted February 3, 2017 Ah, conversable item. Does this finction properly, also for BGII (BGT)? And, what would you suggest to use if death would be faked: 1. How to trigger it to be sure the dog does not die because it was hit one more time while processing the "fake death" script block. 2. Would I use DestroySelf() for death and MoveGlobal() for resurrection (I guess I could work this out myself if I start trying things out.)? Thank you for your ideas! Link to comment
argent77 Posted February 3, 2017 Share Posted February 3, 2017 Conversable items work fine even in original BG2 (just think of Lilarcor).Faking death can be tricky because scripts can be interrupted in rare cases (even with SetInterrupt(FALSE)). Letting the creature die and using the Die() script trigger is a bit safer because dead creatures can't be targeted anymore. However, in this case you have to check for certain states which trigger Die() even though they should not count as dying (such as imprisonment or petrification). I'm using a custom state in my Golem Construction mod for this which is evaluated by StateCheck(). Link to comment
jastey Posted February 3, 2017 Author Share Posted February 3, 2017 Thank you! Unfortunately, I do not understand the script you linked to. How do you treat these "other" cases (petrification, imprisonment etc.), is the golem freed of it by script, treating it like a "normal" death? Link to comment
Roxanne Posted February 3, 2017 Share Posted February 3, 2017 Ah, conversable item. Does this finction properly, also for BGII (BGT)? They do and they also work in BG2EE and EET without any change required. Link to comment
argent77 Posted February 3, 2017 Share Posted February 3, 2017 StateCheck in this example returns only true if a "true" death occurs (which includes STATE_EXPLODING_DEATH, STATE_FLAME_DEATH, STATE_ACID_DEATH and STATE_DEAD from STATE.IDS). But not STATE_FROZEN_DEATH or STATE_STONE_DEATH, and possibly other states. Otherwise the script may fire twice; first when the victim petrifies (or whatever) and a second time when the stoned creature shatters into tiny little bits. With the above-mentioned state check I can prevent one of the triggers from firing. Link to comment
jastey Posted February 3, 2017 Author Share Posted February 3, 2017 Ah, of course. Thank you! Link to comment
Ulb Posted July 30, 2017 Share Posted July 30, 2017 Letting the creature die and using the Die() script trigger is a bit safer because dead creatures can't be targeted anymore. However, in this case you have to check for certain states which trigger Die() even though they should not count as dying (such as imprisonment or petrification). I'm using a custom state in my Golem Construction mod for this which is evaluated by StateCheck(). Is there a reason you would need to do any of this via script though? The basic scenario would be like this: 1. Your familiar, without any immunities to stuff like fear, confusion, flesh to stone, has its corpse item in his inventory. 2. Familiar dies, items from inventory including corpse item are dropped. 3. Corpse item is used -> dialogue checks if conversing PC has appropriate rez spells -> offers fitting dialogue options, spawns helper creature (necessary for targeted rez spells *edit* probably not necessary since you can have PC target itself *edit*) -> creature forces lastsummonerof to cast rez spell, checks for success -> creature returns familiar and places corpse item back into its inventory. If there isn't any draw back to this it would probably be the easiest solution and far better than what I used for my animal companions since the familiar could remain vulnerable to AI spells and flesh to stone. Link to comment
jastey Posted July 30, 2017 Author Share Posted July 30, 2017 What if the familiar might have a full inventory, i.e. the corpse would really have to be spawned at death, OR the final death is supposed to be prevented, meaning we need some trigger that is reliably executed before the familiar dies? Link to comment
Ulb Posted July 30, 2017 Share Posted July 30, 2017 I'm not too familiar with how the game handles full inventories and "give item" actions. Assuming the corpse item ins't dropped by "overfilling" the inventory it should be fine. The familiar starts out with the item in its inventory and is given the item right away after resurrection (when its inventory is still empty since it dropped everything on death). If items can be randomly dropped when you try to force more items into the inventory you might be able to limit the amount of items you can give your familiar? (Giving them items is pretty impractical anyway in my opinion with not being able to access their inventory directly and all that) Also, how the heck if your dog carrying all those items anyway!? Link to comment
jastey Posted July 30, 2017 Author Share Posted July 30, 2017 The reason why the inventory might be full is that I am designing (or, trying to) the dog as a full party member who can also follow as a "7th" party member if the player so decides (or the limit of 6party members is reached). (This, of course, is highly secrit as my dog NPC is supposed to be the first NPC with this possibility). In this case, the inventory might be full and the player can see everything that's inside. Because of that, I would like to prevent a death as the party would have to carry the 7th member items plus corpse to the next temple. (This might turn out to be the easiest solution, though, with the corpse just dropped by script similar to the knights' bodies in the Windspear Hill fight). On the other hand the 7th party member has to stop being a target in a fight somehow if he doesn't die, or he could be used as a tank with unlimited HP (in case of a 1 HP item). (The 1 HP item is a drawback as well, as it has to be removed/replaced in case the NPC joins the group so it's not possible to give e.g. an extra spell slot effect for a mage but it blocks a slot even if the NPC is a full party member. For the dog, I chose the collar but it's not really a concept that's handy as a general approach.) What I did so far is: prevent death by 1 HP item, let NPC drop unconscious at 1 HP, and make him neutral during fights so enemies stop attacking him, then heal him completely after the fight by script (necessary or the NPC might die upon reentering the group) and change back to familiar status. It works, only for the green circle turning into a pulsing arrow after this until the next reload. It works but I am sure there exists a better solution. I hit a wall when I tried to apply this approach to my personal mage NPC and couldn't decide on a useful item effect nor backstory for the blocking HP item... Link to comment
Ulb Posted July 30, 2017 Share Posted July 30, 2017 Ah, my bad. I thought this was kind of an either-or feature ala “either he is permanently a party member or permanently a familiar”. If you want him to switch on the fly then the inventory of course becomes a problem. Sorry for dragging that secret feature out into the open.. That's also a point I missed so far. I thought getting as close as possible to a normal death (including dropped items) was the desirable solution One more idea: Have him apply a spell/effect (spell “A”) like this on himself whenever he is in familiar mode: set local variable “spell A is active” cast spell “B” on condition → targethp <2 minhp1 spell “B” remove effects by resource spell "A" heal him clear him of all AI altering effects & gives immunity for a short time spawns helper creature which then removes your character via destroyself() override and places corpse item on the ground set local variable “spell A is NOT active” You can just remove spell “A” effects via remove effects by resource whenever he goes back into party npc mode. This should prevent him from really dying/dropping items while in familiar mode while also allowing him to be not immune to AI effects and also not have his script actions disrupted by them. The only downside I can think of right now would be negative interaction with other HPLT triggers on him (like that shaman spell that heals when below a certain hp percentage. If both trigger at the same time he would still simulate his death even though he would also be fully healed by the shaman spell). Still, it is the cleanest solution I can think of right now. *edited that like 5 times, sorry if you were reading during that time, must have been confusing * Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.