SpellCast
#1
Posted 07 March 2008 - 12:40 PM
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).
#2
Posted 07 March 2008 - 04:17 PM
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
Posted 07 March 2008 - 04:30 PM
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.
#4
Posted 07 March 2008 - 08:17 PM
#5
Posted 07 March 2008 - 09:26 PM
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
Posted 07 March 2008 - 11:05 PM
Haven't tried the ANYONE method, though. I'll give that one a go.
#7
Posted 09 March 2008 - 01:06 PM
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.
#8 -Guest-
Posted 09 March 2008 - 03:26 PM
What do you have the script running on (area, creature, etc.)?
#9
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.
#10 -Guest-
Posted 09 March 2008 - 09:24 PM
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
Posted 10 March 2008 - 12:13 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.I'm also wondering if the .cre running that script can't recognise the target just cast invisibility, because well, the target's invisible.
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
Posted 10 March 2008 - 07:12 AM
#13 -Guest-
Posted 10 March 2008 - 08:33 AM
Your test confirms only that her script checks See([PC]) and that you do, in fact, turn invisible when casting SPWI206.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.
#14
Posted 10 March 2008 - 12:07 PM
Wrong. It also confirms that SpellCast() works in other scripts, at least where [PC] is the target.Your test confirms only that her script checks See([PC]) and that you do, in fact, turn invisible when casting SPWI206.
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-
Posted 10 March 2008 - 03:33 PM
(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."Wrong. It also confirms that SpellCast() works in other scripts, at least where [PC] is the target.
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.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.
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
Posted 10 March 2008 - 04:21 PM
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-
Posted 10 March 2008 - 05:06 PM
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-
Posted 10 March 2008 - 05:12 PM
IF SpellCast([2],2206) Global("TM#Stuff","GLOBAL",0) THEN RESPONSE #100 DoStuff() ENDshould 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
Posted 10 March 2008 - 05:49 PM
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).(sigh) That was never in dispute ("The usage is correct and the block should be working").Wrong. It also confirms that SpellCast() works in other scripts, at least where [PC] is the target.
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.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."
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
Posted 10 March 2008 - 07:04 PM
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
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.