Author Topic: A Few Script Questions  (Read 2391 times)

Offline Dundee Slaytern

  • Planewalker
  • *****
  • Posts: 10
A Few Script Questions
« on: June 04, 2006, 11:10:41 PM »
Yoz. Decided to get some help from here, since the number of active modders on Ironworks Forums is relatively low.

..) I need some tips on how to make a character cast anti-invisibility spells when necessary. I have tried both Detect() and StateCheck() to no avail. It has been very frustrating thus far, especially when the enemy is ImpInvi and my casters are not doing anything about it...

..) Is there any definite fix for the KIT.IDS issue?

..) Tips on how to avoid lag due to big scripts will be welcomed too. I have no lag issues when there is no combat, due to the sequence of my scripts, but it becomes a slideframe show during combats.

Cheers.

Offline SimDing0™

  • Back In Black
  • Global Moderator
  • Planewalker
  • *****
  • Posts: 3496
  • Gender: Male
  • Word Enhancer
Re: A Few Script Questions
« Reply #1 on: June 06, 2006, 01:00:48 PM »
Quote
..) I need some tips on how to make a character cast anti-invisibility spells when necessary. I have tried both Detect() and StateCheck() to no avail. It has been very frustrating thus far, especially when the enemy is ImpInvi and my casters are not doing anything about it...
I've never been sure precisely how STATE_IMPROVEDINVISIBILITY works--it's one of those things I really must test someday. Try Detect() and !See() in combination. I suspect the latter may ignore improved-invisible characters, since I've never known the AI to try and cast at one.

Quote
..) Is there any definite fix for the KIT.IDS issue?
Most respectable mods these days include a patch to fix this which you can copy (nobody really expects you to ask permission for this). Download any of my mods and take a look at the ALWAYS block at the top of the TP2--alternatively, somebody will hopefully post it here.

Quote
..) Tips on how to avoid lag due to big scripts will be welcomed too. I have no lag issues when there is no combat, due to the sequence of my scripts, but it becomes a slideframe show during combats.
Avoid setting tons of variables. These don't cause game lag as such, but they do make the script slower to respond.
Ensure the least likely triggers are at the top. For cast 'n' attack, this will usually be !GlobalTimerNotExpired, since a caster spends most of their time waiting between spells (save actual casting time during which scripts aren't parsed).

Offline Razfallow

  • Planewalker
  • *****
  • Posts: 10
  • Gender: Male
Re: A Few Script Questions
« Reply #2 on: June 07, 2006, 05:05:07 AM »
I've never been sure precisely how STATE_IMPROVEDINVISIBILITY works--it's one of those things I really must test someday.
When you cast Improved Invisibility, Shadow Door or Mislead, the STATE_INVISIBLE and STATE_IMPROVEDINVISIBILITY are both true. If you reveal your presence by casting offensive spell, by attacking enemy or if your image from Mislead spell is killed, STATE_IMPROVEDINVISIBILITY remains true, but STATE_INVISIBLE is false now.

Offline Dundee Slaytern

  • Planewalker
  • *****
  • Posts: 10
Re: A Few Script Questions
« Reply #3 on: June 07, 2006, 12:07:37 PM »
Finally got my Oracle spell/scroll to work. :) Thanks.

Some more questions.

..) Will LastSeenBy() work in conjunction with Detect()?

..) What does the Stat 'TRUE_SIGHT' from Detectable Spells cover?

Does CheckStatGT(Myself,0,TRUE_SIGHT) mean I have the spell True Sight active if the statement is true?

Offline Razfallow

  • Planewalker
  • *****
  • Posts: 10
  • Gender: Male
Re: A Few Script Questions
« Reply #4 on: June 07, 2006, 01:05:51 PM »
..) Will LastSeenBy() work in conjunction with Detect()?
Yes, it will.

..) What does the Stat 'TRUE_SIGHT' from Detectable Spells cover?
spcl232   True Sight
spcl732   True Sight
spin684   True Sight
spin696   Moon Dog Sight
sppr505   True Seeing
sppr950   True Sight
spwi609   True Sight

Does CheckStatGT(Myself,0,TRUE_SIGHT) mean I have the spell True Sight active if the statement is true?
Yes, that's right.

Offline Dundee Slaytern

  • Planewalker
  • *****
  • Posts: 10
Re: A Few Script Questions
« Reply #5 on: June 07, 2006, 10:12:51 PM »
Thanks, Razfallow. :) That was a big help.

Does anybody have any idea on how to check whether a character has the Use Any Item ability?

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: A Few Script Questions
« Reply #6 on: June 08, 2006, 01:34:51 AM »
Quote
Does anybody have any idea on how to check whether a character has the Use Any Item ability?
CheckStatGT(Myself,0,191)

Offline Dundee Slaytern

  • Planewalker
  • *****
  • Posts: 10
Re: A Few Script Questions
« Reply #7 on: June 08, 2006, 07:14:42 PM »
Gracias, devSim. It had been impeding my Assassin's game. :) I hope I am not too annoying, but I need to ask another question. :)

For items in which there are multiple abilities, how do you make the user casts the other abilities other than the first one?

For example, the Ring of Gaxx has Invisibility and Improved Haste. If I do the following,

UseItem("RING39",Myself)

The user will cast Invisibility. How about for the Improved Haste?

Thanks in advance!

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: A Few Script Questions
« Reply #8 on: June 08, 2006, 07:53:44 PM »
Try SelectWeaponAbility(I:Slot,I:Ability). See SLOTS.IDS for the slots.

If you have the ring in the left slot, and wanted improved haste, SelectWeaponAbility(SLOT_RING_LEFT,1) and then UseItem("RING39",Myself).

This may work (assuming ability count starts at 0), but probably won't.

UseItem() and co. are overloaded, so it could be that UseItem(S:Item*,O:Target*,I:AbilNum*) would actually work, but you'd need to edit the IDS file to check.

Other than that, I have no idea, sorry.

Offline Dundee Slaytern

  • Planewalker
  • *****
  • Posts: 10
Re: A Few Script Questions
« Reply #9 on: June 14, 2006, 09:48:26 PM »
Try SelectWeaponAbility(I:Slot,I:Ability). See SLOTS.IDS for the slots.

If you have the ring in the left slot, and wanted improved haste, SelectWeaponAbility(SLOT_RING_LEFT,1) and then UseItem("RING39",Myself).

This may work (assuming ability count starts at 0), but probably won't.

UseItem() and co. are overloaded, so it could be that UseItem(S:Item*,O:Target*,I:AbilNum*) would actually work, but you'd need to edit the IDS file to check.

Other than that, I have no idea, sorry.
No luck on that front. Oh well... such is life. :(

Another question.

How do I detect whether or not I just got the 'Rest&Rememorise' option from Wish? I wish to set it so that I can reset the GLOBALs for all my once-a-day items.

Cheers.

Offline Avenger_teambg

  • Planewalker
  • *****
  • Posts: 399
Re: A Few Script Questions
« Reply #10 on: June 20, 2006, 09:17:08 AM »
You can set the globals right from the spell effect.

Offline Dundee Slaytern

  • Planewalker
  • *****
  • Posts: 10
Re: A Few Script Questions
« Reply #11 on: June 22, 2006, 07:54:35 AM »
You can set the globals right from the spell effect.

Which command will do the trick?

Am I right in saying that the spell id for Wish:Rest is 3613?

Will SpellCast(Myself,3613) work?

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: A Few Script Questions
« Reply #12 on: June 22, 2006, 12:10:28 PM »
There is no scriptable way to detect the casting of the ToB Wish spells (SPWISH*).

Without really reading what he wrote, I think Avenger is suggesting that you add an effect to the spell to set a global variable, which can then be detected by script.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: