Jump to content

Strange issues in my script


argent77

Recommended Posts

I have another scripting issue which involves the character already mentioned in this thread

 

To avoid chunking/freezing/etc. (and losing him permanently) I’m using a combination of a modified MinHP1 item and an invisible dummy creature which controls his death by a script.

 

This is the script block in question:

IF
InActiveArea("A7MYCHAR")
!Dead("A7MYCHAR")
HP("A7MYCHAR", 1)
THEN RESPONSE #100
CreateVisualEffectObject("SPFLSRIN", "A7MYCHAR")	// Death animation
Kill("A7MYCHAR")
Wait(2)
ReallyForceSpellRES("A7REST2", "A7MYCHAR")		  // resurrect/cure/heal
Deactivate("A7MYCHAR")
ChangeEnemyAlly("A7MYCHAR", CONTROLLED)
MoveGlobal("ARA799", "A7MYCHAR", [476.446])		 // move creature to an unused area
SetGlobal("SPRITE_IS_DEADA7MYCHAR", "GLOBAL", 0)
SetGlobal("A7MYCHARSPAWNED", "GLOBAL", 0)
SetGlobalTimer("A7MYCHARISDEADTIMER", "GLOBAL", ONE_DAY)
SetGlobal("A7MYCHARISDEAD", "GLOBAL", 1)
Continue()
END

But there is some weird behaviour which I can’t explain. The character has the Explore effect (#268) applied (via item), so that he can walk around without leaving the field of view. When the character dies, his own FoV vanishes for a split second before it is activated again. :mad: This happens at the beginning of his death animation. After that it takes a whole round until the FoV effect vanishes permanently (which is probably caused by the MoveGlobal() action), although I have instructed to wait only for 2 seconds.

 

This isn’t a game-breaking issue, but do you have an explanations for this behaviour or do you know a way around it?

Link to comment

Maybe this happens because the effect given by the equiped item does not work when the character dies. Then when you resurrect, it's working again. Wouldn't it be easier to make the area visible similar to how it's done in the ambush/death-scene of gorion + protagonist in BG1?

Link to comment
Maybe this happens because the effect given by the equiped item does not work when the character dies.
The effect is active while the character is alive, which is the intended behaviour. When he dies, the effect should be gone permanently, but it isn’t. It vanishes for a split second and then lingers for a while (about 6 seconds) before the action MoveGlobal() of my script removes the creature.

 

Wouldn't it be easier to make the area visible similar to how it's done in the ambush/death-scene of gorion + protagonist in BG1?
A static explore effect wouldn’t work in my case. My character can be controlled and moved around, comparable to a familiar. The explore effect is needed because controlled creatures (e.g. summons) don’t explore the surroundings on their own. When they leave the FoV of the PC, it isn’t visible (and selectable) anymore.

 

There might be a way to unequip the item right before the creature dies and to re-equip it again when he is summoned a while later. :mad: But I haven’t found a script command for those actions yet.

 

PS: I have tested it with a familiar (which also has the same explore item equipped) and killed it. The death of the familiar shows the same behaviour as my character. That is, the explore item would still be in effect after its death (indefinitely). So the root of my problem is definitely the explore item which still works after the creature has died.

 

But there still remains the second part of my question, which I have no explanation for. Why does it take over 6 seconds to remove the "dead" creature, when I have limited the waiting time to 2 seconds?

Link to comment

I was thinking that the resurrect/cure/heal that reenables the field of vision by resurrecting the character while he has the item equiped.

 

Have you tired to use "DestroyItem" or "TakePartyItem" before you kill the character or just after you kill the character? You can use "CreateItem" to give it back later.

Link to comment
Have you tired to use "DestroyItem" or "TakePartyItem" before you kill the character or just after you kill the character? You can use "CreateItem" to give it back later.
Unfortunately that doesn’t work either. The item in question is undroppable and unstealable (which probably prevents DestroyItem()). While I can create a new instance of the item (by using GiveItemCreate()) when the character reappears, I haven’t found a way yet how to actually equip it (EquipItem() doesn’t work in my case).

 

As I said, the whole issue isn’t game-breaking. It even works better than the same behaviour on familiars. I’m rather curious about the reasons why it doesn’t work as expected (both issues, the explore effect quirk and the unusually long delay in my script).

Link to comment
The item in question is undroppable and unstealable (which probably prevents DestroyItem()).
DestroyItem works. It's done all the time with minhp or immunity items.
While I can create a new instance of the item (by using GiveItemCreate()) when the character reappears, I haven’t found a way yet how to actually equip it (EquipItem() doesn’t work in my case).
Equipping items via script sucks gigantic naughty bits. You would use FillSlot, however.
Link to comment
Equipping items via script sucks gigantic naughty bits. You would use FillSlot, however.
Using FillSlot() works indeed, thanks.

 

But I still can’t remove the original item with DestroyItem() for some reason.

 

This is my code to destroy the item (which is executed in the dummy creature’s script):

	ActionOverride("A7MYCHAR", DestroyItem("FAMMY"))
Kill("A7MYCHAR")
Wait(2)
...

Link to comment

It works now! :mad: All I had to do was adding a short delay between the DestroyItem() and the Kill() action. The death sequence works perfectly now.

 

This is the working code snippet:

	ActionOverride("A7MYCHAR", DestroyItem("FAMMY"))
SmallWait(1)
Kill("A7MYCHAR")
...

Link to comment

Archived

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

×
×
  • Create New...