Jump to content


Photo

SpellCast


  • Please log in to reply
30 replies to this topic

#1 Bookwyrme

Bookwyrme
  • Modder
  • 5804 posts

Posted 07 March 2008 - 12:40 PM

I've been trying to use SpellCast as a trigger, and it doesn't seem to be triggering anything. Apparently, others have had the same problem.


Has anyone used it successfully?

Or, am I using it incorrectly anyway? It parses, but that doesn't always mean anything much....

IF
Global("TM#MQDeReveal","GLOBAL",0)
OR(6)
SpellCast(Player1,WIZARD_INVISIBILITY)
SpellCast(Player2,WIZARD_INVISIBILITY)
SpellCast(Player3,WIZARD_INVISIBILITY)
SpellCast(Player4,WIZARD_INVISIBILITY)
SpellCast(Player5,WIZARD_INVISIBILITY)
SpellCast(Player6,WIZARD_INVISIBILITY)
THEN
RESPONSE #100
SetGlobal("TM#MQDeReveal","GLOBAL",1)
ClearAllActions()
StartCutSceneMode()
StartCutScene("tm#mqtak")
END

The cutscene does start when a different trigger is used (I tested).

Mods: <a data-cke-saved-href="http://www.shsforums...-auroras-shoes/">Aurora's Shoes (released),

 


 

 


#2 CamDawg

CamDawg

    ALL GLORY TO THE HYPNOTOAD

  • Modder
  • 1505 posts

Posted 07 March 2008 - 04:17 PM

If you're checking to see if a party member is invisible, why not just use StateChecks?

Why is this Hypnotoad video so popu... ALL GLORY TO THE HYPNOTOAD.
____
The Gibberlings Three - Home of IE Mods

The BG2 Fixpack - All the fixes of Baldurdash, plus a few hundred more. Now available, with more fixes being added in every release.


#3 Bookwyrme

Bookwyrme
  • Modder
  • 5804 posts

Posted 07 March 2008 - 04:30 PM

I'm actually trying to check for a whole lot of different things.

One set of checks is *meant* to make sure that the party can't stand and buff in front of the creatures without them responding.

The other set is meant to switch avatars if one of the dispel illusion spells is cast--the creatures themselves aren't illusory, their appearance is.

Buuut, SpellCast is not cooperating.

Mods: <a data-cke-saved-href="http://www.shsforums...-auroras-shoes/">Aurora's Shoes (released),

 


 

 


#4 cmorgan

cmorgan
  • Modder
  • 2301 posts

Posted 07 March 2008 - 08:17 PM

Still looking for answers for you, bookwyrme - glad you posted though, because I can't find why it isn't working for you so far :(

#5 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 07 March 2008 - 09:26 PM

Does it work if you replace the Player1 .. Player6 lines with SpellCast([ANYONE],WIZARD_INVISIBILITY), for testing purposes at least?

I'm also wondering if the .cre running that script can't recognise the target just cast invisibility, because well, the target's invisible. You can try it with a different spell as a trigger, if you haven't.

There are some instances of this usage in the vanilla game, such as in mage10d.bcs. Dunno if it works though.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#6 Bookwyrme

Bookwyrme
  • Modder
  • 5804 posts

Posted 07 March 2008 - 11:05 PM

I've tried different spells, yes---including some summoning spells.

Haven't tried the ANYONE method, though. I'll give that one a go.

Mods: <a data-cke-saved-href="http://www.shsforums...-auroras-shoes/">Aurora's Shoes (released),

 


 

 


#7 Bookwyrme

Bookwyrme
  • Modder
  • 5804 posts

Posted 09 March 2008 - 01:06 PM

Nope, the ANYONE method doesn't work.

Has anyone ever used this in a mod and had it work?

I *could* switch a lot of things over to dialog cues, but it wouldn't be quite the same scenario I had wanted to create.

Mods: <a data-cke-saved-href="http://www.shsforums...-auroras-shoes/">Aurora's Shoes (released),

 


 

 


#8 -Guest-

-Guest-
  • Guest

Posted 09 March 2008 - 03:26 PM

The usage is correct and the block should be working (assuming you're talking about BG2). Make sure that Global("TM#MQDeReveal","GLOBAL",0) actually is 0, and make sure that your TRIGGER.IDS file has "0x0091 SpellCast()" (I'm not sure what mod would ever change it, but you never know). Ensure that WIZARD_INVISIBILITY is mapped to 2206 (SPWI206) in SPELL.IDS and that the spell file is marked a wizard spell (again, not sure why anyone would change it).

What do you have the script running on (area, creature, etc.)?

#9 Bookwyrme

Bookwyrme
  • Modder
  • 5804 posts

Posted 09 March 2008 - 05:57 PM

and make sure that your TRIGGER.IDS file has "0x0091 SpellCast()" (I'm not sure what mod would ever change it, but you never know). Ensure that WIZARD_INVISIBILITY is mapped to 2206 (SPWI206) in SPELL.IDS and that the spell file is marked a wizard spell (again, not sure why anyone would change it).


How and where would I check that? It's not something I'm familiar with.

What do you have the script running on (area, creature, etc.)?


Creature--creatures actually; there are four and it should kick in whichever one of them is targeted by or sees one of the spells.

Edit: Looking again at the SpellID's question you raised: I have no other mods installed while I'm doing the initial coding/testing & am working on a clean install, so I doubt that is the issue.

Edited by Bookwyrme, 09 March 2008 - 09:17 PM.

Mods: <a data-cke-saved-href="http://www.shsforums...-auroras-shoes/">Aurora's Shoes (released),

 


 

 


#10 -Guest-

-Guest-
  • Guest

Posted 09 March 2008 - 09:24 PM

You would just look in the IDS files and make sure 0x0091 SpellCast(O:,I:) and 2206 WIZARD_INVISIBILITY are there.

Normal creatures or invisible creatures (don't use bird animations or the disable creature effect if you want them to run scripts normally)?

Try appending the area script with the same block (it should absolutely work from there if any PCs cast SPWI206 in that area).

#11 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 10 March 2008 - 12:13 AM

I'm also wondering if the .cre running that script can't recognise the target just cast invisibility, because well, the target's invisible.

I did some testing that confirms this. I did a CLUAConsole:CreateCreature("mage10d") and then cast Invisibility. If you look at her script, it should make her say "Do not think to attack me. Cast your spells elsewhere." then she goes invisible herself. But this didn't happen because, as I'd guessed, she couldn't see me once I'd cast the spell. I wandered about a bit and once I did reappear, then she responded correctly. I then spawned her again and tried with Haste and Protection from Evil (also triggers in the same script) and she responded immediately.

So, hmm, one possible solution is to have your CREs detect invisible, either by spell or item, if that's not too cheesy. I have some scripts that let NPC mages cast Detect Invis (or True Sight or whatever) if they can hear (detect) a PC but not see him - probably examples in vanilla scripts too.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#12 Bookwyrme

Bookwyrme
  • Modder
  • 5804 posts

Posted 10 March 2008 - 07:12 AM

It's not just Detect Invisibility that isn't triggering--Summon Undead (or whatever the spell's proper name is--I got it right in script ;) ) doesn't work either; neither do the other spells I've tested, though I admit I've lost track of just which ones I've tried with atm.

Mods: <a data-cke-saved-href="http://www.shsforums...-auroras-shoes/">Aurora's Shoes (released),

 


 

 


#13 -Guest-

-Guest-
  • Guest

Posted 10 March 2008 - 08:33 AM

I did some testing that confirms this. I did a CLUAConsole:CreateCreature("mage10d") and then cast Invisibility. If you look at her script, it should make her say "Do not think to attack me. Cast your spells elsewhere." then she goes invisible herself. But this didn't happen because, as I'd guessed, she couldn't see me once I'd cast the spell. I wandered about a bit and once I did reappear, then she responded correctly. I then spawned her again and tried with Haste and Protection from Evil (also triggers in the same script) and she responded immediately.

Your test confirms only that her script checks See([PC]) and that you do, in fact, turn invisible when casting SPWI206.

#14 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 10 March 2008 - 12:07 PM

Your test confirms only that her script checks See([PC]) and that you do, in fact, turn invisible when casting SPWI206.

Wrong. It also confirms that SpellCast() works in other scripts, at least where [PC] is the target.

As Guest suggested, make sure your variable is zero, or just take that check out for testing purposes.

Edit: You might also want to post your tm#mqtak cutscene that's supposed to be triggering. There might be something in it that won't act on an invisible player, or something like that.

Edited by Miloch, 10 March 2008 - 12:09 PM.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#15 -Guest-

-Guest-
  • Guest

Posted 10 March 2008 - 03:33 PM

Wrong. It also confirms that SpellCast() works in other scripts, at least where [PC] is the target.

(sigh) That was never in dispute ("The usage is correct and the block should be working"). It does not confirm your claim that "the .cre running that script can't recognise the target just cast invisibility, because well, the target's invisible."

Edit: You might also want to post your tm#mqtak cutscene that's supposed to be triggering. There might be something in it that won't act on an invisible player, or something like that.

The cutscene would simply stall, and as he said, he got it to work by removing the SpellCast() triggers. So either the global isn't 0 when it should be or the script isn't kicking in when it's supposed to.

I'm still waiting for info on if these are invisible cutscene creatures (as stated, some avatars and the disable creature effect can break scripts); otherwise, I can't think of a likely reason why it wouldn't be working. (If it isn't the case, though, I'd still recommend adding that block to the area script just to make sure SpellCast() triggers are working at all.)

#16 cmorgan

cmorgan
  • Modder
  • 2301 posts

Posted 10 March 2008 - 04:21 PM

Bookwyrme, m'lady moderess, I am posting your code from tm_dpri.baf, for other folks to see, because I can't seem to make headway either - SpellCast is not recognizing stuff.


I really don't see why this isn't working, but as i said, teh true gurus are Cuv, Rabain, Cirrerek, Yovanoeth, DavidW, devSin, igi, Nythrun, etc - I deal with party AI only in the very global sense, and rely on Miloch to slowly teach me heavy-duty carefully-attuned-to-what-the-cre-should-actually-be-able-to-do-if-they-were-a-PC AI scripting.


//////If revealed, but not attacked, they will try to talk (@CMorgan: Here's where the difficulty starts***_:

IF
OR(6)
Global("TM#MQDeReveal","GLOBAL",0)
SpellCast(Player1,WIZARD_TRUE_SIGHT)
SpellCast(Player2,WIZARD_TRUE_SIGHT)
SpellCast(Player3,WIZARD_TRUE_SIGHT)
SpellCast(Player4,WIZARD_TRUE_SIGHT)
SpellCast(Player5,WIZARD_TRUE_SIGHT)
SpellCast(Player6,WIZARD_TRUE_SIGHT)
THEN
RESPONSE #100
SetGlobal("TM#MQDeReveal","GLOBAL",1)
ClearAllActions()
StartCutSceneMode()
StartCutScene("tm#mqil")
END


IF
OR(6)
Global("TM#MQDeReveal","GLOBAL",0)
SpellCast(Player1,WIZARD_DETECT_ILLUSION)
SpellCast(Player2,WIZARD_DETECT_ILLUSION)
SpellCast(Player3,WIZARD_DETECT_ILLUSION)
SpellCast(Player4,WIZARD_DETECT_ILLUSION)
SpellCast(Player5,WIZARD_DETECT_ILLUSION)
SpellCast(Player6,WIZARD_DETECT_ILLUSION)
THEN
RESPONSE #100
SetGlobal("TM#MQDeReveal","GLOBAL",1)
ClearAllActions()
StartCutSceneMode()
StartCutScene("tm#mqil")
END

IF
OR(6)
Global("TM#MQDeReveal","GLOBAL",0)
SpellCast(Player1,CLERIC_TRUE_SIGHT)
SpellCast(Player2,CLERIC_TRUE_SIGHT)
SpellCast(Player3,CLERIC_TRUE_SIGHT)
SpellCast(Player4,CLERIC_TRUE_SIGHT)
SpellCast(Player5,CLERIC_TRUE_SIGHT)
SpellCast(Player6,CLERIC_TRUE_SIGHT)
THEN
RESPONSE #100
SetGlobal("TM#MQDeReveal","GLOBAL",1)
ClearAllActions()
StartCutSceneMode()
StartCutScene("tm#mqil")
END


IF
OR(6)
Global("TM#MQDeReveal","GLOBAL",0)
SpellCast(Player1,WIZARD_ORACLE)
SpellCast(Player2,WIZARD_ORACLE)
SpellCast(Player3,WIZARD_ORACLE)
SpellCast(Player4,WIZARD_ORACLE)
SpellCast(Player5,WIZARD_ORACLE)
SpellCast(Player6,WIZARD_ORACLE)
THEN
RESPONSE #100
SetGlobal("TM#MQDeReveal","GLOBAL",1)
ClearAllActions()
StartCutSceneMode()
StartCutScene("tm#mqil")
END

//But don't expect to stand and buff right in front and then fight

IF
OR(6)
SEE(Player1)
SEE(Player2)
SEE(Player3)
SEE(Player4)
SEE(Player5)
SEE(Player6)
OR(6)
Global("TM#MQDeReveal","GLOBAL",0)
SpellCast(Player1,WIZARD_INVISIBILITY)
SpellCast(Player2,WIZARD_INVISIBILITY)
SpellCast(Player3,WIZARD_INVISIBILITY)
SpellCast(Player4,WIZARD_INVISIBILITY)
SpellCast(Player5,WIZARD_INVISIBILITY)
SpellCast(Player6,WIZARD_INVISIBILITY)
THEN
RESPONSE #100
SetGlobal("TM#MQDeReveal","GLOBAL",1)
ClearAllActions()
StartCutSceneMode()
StartCutScene("tm#mqtak")
END


I think both Nythrun and devSin would say "change those to the number in the .ids file to make sure it isn't a messed up .ids" (and devSin would say in addition "real coders bypass the ids for the number in the first place :) ), but I have not done this myself. (I even went so far as to set up the crossmod variables for us non-numerical folks by setting thinhs like
%KIVAN_BANTER%
and
%undercellar_third_door_to_the_left_at_position_X_357_Y_201%
so I could read it in plain old english :) )


EDIT: erm... y'know, looking at it for the 75th time, I just saww the OR() are in the wrong spot - better check that first...

Global("TM#MQDeReveal","GLOBAL",0)
OR(6)
SpellCast(Player1,WIZARD_ORACLE)
SpellCast(Player2,WIZARD_ORACLE)
SpellCast(Player3,WIZARD_ORACLE)
SpellCast(Player4,WIZARD_ORACLE)
SpellCast(Player5,WIZARD_ORACLE)
SpellCast(Player6,WIZARD_ORACLE)

Edited by cmorgan, 10 March 2008 - 04:29 PM.


#17 -Guest-

-Guest-
  • Guest

Posted 10 March 2008 - 05:06 PM

That's a huge bug, yes (symbols vs. numbers wouldn't make much difference in this case -- at least one of those would have to be correct in the IDS files).

Or(6) Global() ... SpellCast() is saying that the Global() must be 0 or Player1-5 casts the spell at the same time that Player6 casts the spell (and the engine can only respond to a single SpellCast() at a time, which means these blocks would only fire when Global() is 0 and Player6 casts the spell).

#18 -Guest-

-Guest-
  • Guest

Posted 10 March 2008 - 05:12 PM

Forgot... also note that it should be possible to collapse these into a single SpellCast() trigger. E.g.,
IF

SpellCast([2],2206)

Global("TM#Stuff","GLOBAL",0)

THEN

RESPONSE #100

DoStuff()

END
should give you the same behavior with few to no caveats (the only I can think of is if a crafty familiar did the casting instead of Player1-6 since they get nabbed by PC EA checks, but like that's ever going to happen).

#19 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 10 March 2008 - 05:49 PM

Wrong. It also confirms that SpellCast() works in other scripts, at least where [PC] is the target.

(sigh) That was never in dispute ("The usage is correct and the block should be working").

Actually, the 1st, 3rd and 7th posts in this thread kind of suggest it was in dispute. Some anonymous suggestion that it "should be working" doesn't prove anything, unless one provides concrete evidence (such as from a test).

It does not confirm your claim that "the .cre running that script can't recognise the target just cast invisibility, because well, the target's invisible."

Yeah. Well it does for normal scripts. So the script I tested had a sight check and the script posted (apparently) doesn't, big deal. The fact there is no range or sight check in the posted script is somewhat troubling. One probably doesn't want it triggering from the other side of the area.

Also, the code originally posted that supposedly doesn't work hasn't got the ambiguous OR problem that the code cmorgan posted has. Perhaps the code tested is different from the original code posted though.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#20 Bookwyrme

Bookwyrme
  • Modder
  • 5804 posts

Posted 10 March 2008 - 07:04 PM

Ugh. Yeah, the OR(6) is a big issue (Is very embarrassed)

And with all the blocks in the script, I'm not sure whether the ones I tested had the ambiguity or not--there are lots of spells to check for.

So, I'll go through and fix that in each & every instance

And then test.

(Edit) I would use SpellCast([2],2206)*, because, really, a familiar casting the spell ought to have the same effect as a party NPC, only I didn't know how to test for that. But (hangs head) I'm still not sure where to find the numbered IDs for all the different spells rather than the names. Edit2: Ooooh, ok, there they are. Right in front of me. Right. I'm going to use that, then, too, since it seems much simpler. Won't change everything, though, till I've tried it on a couple of blocks--a lesson I really should already have learned :P

And then I'll make a minimod with just these to test before I try sticking it into the main mod. I'll let you know the results...

And, whatever the result, thank you, thank you all for checking and rechecking and explaining.

Edited by Bookwyrme, 10 March 2008 - 07:21 PM.

Mods: <a data-cke-saved-href="http://www.shsforums...-auroras-shoes/">Aurora's Shoes (released),