Maurolava Posted April 17, 2006 Share Posted April 17, 2006 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
Thauron Posted April 19, 2006 Share Posted April 19, 2006 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
Horred the Plague Posted April 19, 2006 Share Posted April 19, 2006 IFHP(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. <{POST_SNAPBACK}> You can use a top block, with: IF Die() THEN RESPONSE #100 ReallyForceSpellDead(..........) END Link to comment
Thauron Posted April 19, 2006 Share Posted April 19, 2006 Aha, didn't know that was possible. Follow Horred's advice Maurolava and ignore mine for 3. - always follow Horred's advice, especially when it comes to scripts. Link to comment
Avenger Posted April 19, 2006 Share Posted April 19, 2006 Can anyone confirm this: reallyforcespelldead works when the Actor is dead? I thought it is about allowing the Target being dead. Link to comment
devSin Posted April 19, 2006 Share Posted April 19, 2006 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
Horred the Plague Posted April 20, 2006 Share Posted April 20, 2006 Can anyone confirm this:reallyforcespelldead works when the Actor is dead? I thought it is about allowing the Target being dead. <{POST_SNAPBACK}> Here is an in-game example, which I'm sure you know is working: From VAMPIR01.bcs: IF Die() THEN RESPONSE #100 ReallyForceSpellDead(Myself,VAMPIRE_GAS_FORM_CHANGE) END Link to comment
Avenger Posted April 20, 2006 Share Posted April 20, 2006 Well, this is also an example of the target being dead, so, it isn't the perfect example Link to comment
devSin Posted April 20, 2006 Share Posted April 20, 2006 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
Maurolava Posted April 20, 2006 Author Share Posted April 20, 2006 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
devSin Posted April 20, 2006 Share Posted April 20, 2006 As far as I've experienced, Die() is fairly reliable. One time out of many it may accidentally fail, but it should almost always work. Just put it at the top of the script to be safe. Link to comment
Avenger Posted April 23, 2006 Share Posted April 23, 2006 Yeah, if Die() is the first block, then it can fail only when the creature died a chunked death. And i believe it is possible to disable that. Link to comment
devSin Posted April 23, 2006 Share Posted April 23, 2006 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
Thauron Posted April 23, 2006 Share Posted April 23, 2006 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
devSin Posted April 23, 2006 Share Posted April 23, 2006 The game just changes the creature animation to "chunk" and creates some spinning chunks for good measure. Assuming you use (Really)ForceSpellDead(), it should still work. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.