Jump to content

Help with new script BG2


Maurolava

Recommended Posts

So, I have this idea about a script for a custom item that I make, is a figurine that will summon a Gr. air elemental. I have never done a script, so I do not even know where to start.

 

Anyway, what I am looking for is to do three things:

 

1. As soon as it is summon, it will cast "mass cure" on the party.

 

2. It will attack the closest enemy.

2a. if there is 6 enemies within range the elemental will cast "Storm of Vengeance" and then wait for 4 rounds, in the mean time he will go back to attack the closest enemy, if after the 4 rounds there still 6 enemies he will cast the Storm again...wash and repeat.

 

3. If the elemental is kill, it will cast "Shield of archons" on player 1 and the will display a text in top of him.

 

So, it is possible. Can anyone help me?

 

Thank you in advance!

Link to comment

I am no scripting expert, but since the experts are a bit slow lately I'll give it a try - and if I am wrong I at least have bumped your question, didn't I? :) I haven't written blocks of code, but you should be able to figure out how to use these commands by scrolling through IESDP.

 

1. As soon as it is summon, it will cast "mass cure" on the party.

 

Give your creature the appropriate spell and try a IF HaveSpell(...) THEN Spell(...) combination at the very start of your creature script - it should always be fired first then.

 

2. It will attack the closest enemy.

2a. if there is 6 enemies within range the elemental will cast "Storm of Vengeance" and then wait for 4 rounds, in the mean time he will go back to attack the closest enemy, if after the 4 rounds there still 6 enemies he will cast the Storm again...wash and repeat.

 

For a normal attacking sequence, see almost any other creature script. You should only add a NumCreatureVsPartyLT(...) to the normal combat actions and a block with NumCreatureVsPartyGT(...) THEN Spell(...) (or ForceSpell if you want the creature to be able to cast this spell no matter if it still has this spell memorized ot not, bad thing is the spell won't be interruptable anymore. Better would probably be to use SpellNoDec(...) - this will allow the creature to cast the spell over and over again as long as it starts with the spell in his spellbook, but it is interruptable.) Not sure about the waiting 4 turns though.

 

3. If the elemental is kill, it will cast "Shield of archons" on player 1 and the will display a text in top of him.

 

Dead creatures can't fire spells or run scripts - thus I would try to achieve this effect as follows.

Let the creature start with item: minhp1 (Imoen's amulet, which prevents her from dying in Irenicus' dungeon), then add to your script:

 

IF

HP(Myself,1)

THEN

RESPONSE #100

ReallyForceSpell(...) // - this makes the spell be cast uninterruptable + with casting speed 0.

DisplayStringHead(Player1,...)

DestroyItem("Minhp1") // makes the creature killable again

Kill(Myself)

END

 

If there is an easier way to do this, or if I made a mistake somewhere (- like I said I am no creature script expert at all) - correct me please, anyone.

Link to comment
IF

HP(Myself,1)

THEN

RESPONSE #100

ReallyForceSpell(...) // - this makes the spell be cast uninterruptable + with casting speed 0.

DisplayStringHead(Player1,...)

DestroyItem("Minhp1") // makes the creature killable again

Kill(Myself)

END

 

If there is an easier way to do this, or if I made a mistake somewhere (- like I said I am no creature script expert at all) - correct me please, anyone.

 

You can use a top block, with:

 

IF
 Die()
THEN
 RESPONSE #100
   ReallyForceSpellDead(..........)
END

Link to comment

The Dead() actions allow dead objects to do stuff, and must be used if you know the creature is going to be dead (e.g., IF Die() THEN). It has nothing to do with target (IIRC, you can ForceSpell() any object, dead or living, trigger or creature or door, etc.).

Link to comment

Yeah, it made me think too. I don't ever recall *Dead() actions being used on somebody other than Myself.

 

I tried ReallyForceSpell("Sarevok",2112) and ReallyForceSpellDead("Sarevok",2112), killed Sarevok, and both seemed to work (of course, without a corpse, only the console feedback and casting sound run).

Link to comment

ok, I have a question on the last one, the one about die(), I was in another forum and they told me this:

 

It won't work. Let me explain why: Any script is made of several blocks. Each block starts with an IF and finishes with an END. The game's program checks them one after another. If you use your suggested block containing the "Die()" code, at the time the creature dies, if the program is accidentally checking this particular block, then you are lucky and the program will detect the "Die()" condition and will trigger your actions in that block; but if the program is checking one of the other blocks, when the elemental dies, the program will stop checking other blocks. The more blocks you have in your script, the less chance you have for program to be checking that particular block at the time your creature dies.

 

Hence, if you test the script in practice, one time out of many it may accidentally work but it won't always work.

 

Therefore, you can't really write a script for when the creature dies and be certain that it will work unless you have only one single block in your script.

 

So, is this true?, is there really a chnge that it may not happen??

Link to comment

Even then, it's pretty rare. Take the first pocket plane challenge. Some of these creatures have very complex scripts (not to mention most have at least 3 or 4 scripts assigned); even chunked, I've yet to see their Die() block fail.

Link to comment

Actually, might it not be fitting that, if this creature takes so much damage that he dies a chunked death, that it is unable to cast the spell he is supposed to cast when dying a 'normal' death?

 

And, as Avenger said, I don't think it is very difficult to disable chunking death for your creature.

Link to comment

Archived

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

×
×
  • Create New...