Jump to content


Photo

SpellCast


  • Please log in to reply
30 replies to this topic

#21 cmorgan

cmorgan
  • Modder
  • 2301 posts

Posted 10 March 2008 - 07:24 PM

Don't be ashamed in any way shape or form. Or rather, understand that i have been styudyting this stuff for a blasted long time, and stared at the OR() trigger a bunch of times, and it just didn't pop out, because I was foxcusing on the trigger failiure rather than the script failure... :D


To make sure *I* understand, the object reference [2] is EA.IDS, right:


Relates to offset 0x270 in the .cre file format.

10

1 INANIMATE
rngsta01.cre - Sun Statue (Temple of Aumanator)

2 PC
Player Character, ie. directly controlled by the Player (set for players when they join the party)

3 FAMILIAR
E31.cre, boo.cre

4 ALLY
5 CONTROLLED
6 CHARMED
28 GOODBUTRED
29 GOODBUTBLUE
30 GOODCUTOFF
31 NOTGOOD
126 ANYTHING
128 NEUTRAL
199 NOTEVIL
200 EVILCUTOFF
201 EVILBUTGREEN
202 EVILBUTBLUE
255 ENEMY

Meaning that any party-joinables are flagged as [2]...

and the spell resource number is not the actual spell, of course (SPPR101) but the numerical reference used by SPELL.IDS:

http://iesdp.gibberl...s/bg2/spell.htm

#22 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 10 March 2008 - 08:54 PM

Yeah, 2 is the value for PC in ea.ids and 2206 corresponds to WIZARD_INVISIBILITY (spwi206) in spell.ids. In practical terms, there is no real difference between using the text or the numbers, unless you have some funky mods messing with your basic values, in which case you might have bigger problems than deciding whether to use numbers or text.

PC should include any characters directly controlled by the player(s), according to the IESDP anyway. I don't think 2 includes familiars (3 in ea.ids), but that should be a pretty odd occurrence, as Guest says. Our mystery guest's point is probably the OR is unnecessary. In any case, I thought Player1 [..] Player 6 correspond to multiplayers, not to NPC slots. Not sure about that though - the IESDP entry on object.ids only documents the Player#Fill entries.

You might as well throw a Range([PC],30) in the trigger blocks, which should allow your CREs to respond only if a character is in visual range (regardless of whether visible or not), rather than trying to respond if a character casts some spell on the other side of the area. If it's a smaller interior area, it probably isn't necessary.

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


#23 Bookwyrme

Bookwyrme
  • Modder
  • 5804 posts

Posted 10 March 2008 - 09:08 PM

Visual area is perfectly reasonable :) That'll save me from checking to see if the creatures could see it (or from deciding that that was just getting too nitpicky to worry about).

Does SpellCast work for Cleric spells as well as wizard?

Now, with all my OR's correctly positioned, things work beautifully for Wizard spells, but not at all for cleric spells.

Knowing whether or not SpellCast is the right trigger there will help me look to see if I need another command--or if I've made another coding error somewhere in the script.

Edit: I should reread triggers first. It's SpellCastPriest, and so far, the variations I have tested do work. Whew! Would you believe I've been at this on and off for weeks now?

For anyone interested, the version attached works (so far as I've tested). It's not *quite* what is in the mod, but the basics are the same--it's mostly a streamlined version of the script & dialog for testing purposes, with a little change to the .cres for the sake of my sanity.

Attached Files


Edited by Bookwyrme, 10 March 2008 - 09:29 PM.

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

 


 

 


#24 -Guest-

-Guest-
  • Guest

Posted 10 March 2008 - 09:24 PM

Does SpellCast work fro Cleric spells as well as wizard?

SpellCastPriest() is what you want. You can also detect innates with SpellCastInnate(), but there's a huge caveat in that the spell has to be the correct level (e.g., SPIN789 has to be Level 7 to be detected), which then means you can't use it with HaveSpell() (where the level needs to be 1 to prevent crashing).

PC should include any characters directly controlled by the player(s), according to the IESDP anyway. I don't think 2 includes familiars (3 in ea.ids), but that should be a pretty odd occurrence, as Guest says. Our mystery guest's point is probably the OR is unnecessary. In any case, I thought Player1 [..] Player 6 correspond to multiplayers, not to NPC slots. Not sure about that though - the IESDP entry on object.ids only documents the Player#Fill entries.

Player1 - Player6 correspond to the join order (or thereabouts; I never quite got it exact, and in some tests, I swear a dead PC changed their order in the party according to the object); the Fill entries correspond to the actual GUI party order.

PC unfortunately does catch EA FAMILIAR objects (this is why everybody in the game will dialogue with your familiar -- the engine auto-deposits familiars in *front* of Player1 for every jump and area transition, so the waiting NPCs all See([2]) and pick up the familiar and start talking to Ferret). (It makes sense, as you'd otherwise be able to run your familiar past all the triggers and forced encounters along any route and get screwed up if you never actually take a true PC down the same path.) PC doesn't pick up any other friendly characters (thankfully), however (no summons or EA ALLY junk), so it's basically party+familiar.

(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

Honestly, unless it makes it easier for you, I wouldn't bother. It's a convenience if you have a good memory for the numbers (and work with them often enough to be able to memorize them), but it won't make any difference except in the weirdest case (as Miloch says, only if some mod horribly screwed the IDS files before your mod is installed).

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).

I like to think that I know what I'm talking about (except when I don't, of course!). The action works fine and the code originally posted is fine. I've been doing this long enough to hopefully not have to give concrete evidence (such as from a test) for every single point that comes up just to prove that, hey, I know how that works, thanks.

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 has nothing to do with normal or irregular scripts. SpellCast() doesn't work that way. It is a big deal because your test didn't prove what you suggested it did (and heaven forbid I come along and point it out).

#25 Bookwyrme

Bookwyrme
  • Modder
  • 5804 posts

Posted 10 March 2008 - 09:32 PM

Thanks, Guest, for your answer:) Was off checking things when you posted & didn't think to reload. I think that now I will take myself off to sleep & hopefully tomorrow get that quest finished!!

You have *no* idea how good that will feel. It's taken me weeks to catch two basic errors--and I only caught this one with a lot of help.

Thanks again, all of you.

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

 


 

 


#26 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 10 March 2008 - 10:12 PM

I like to think that I know what I'm talking about

That's great that you do. But you can't assume everyone immediately will recognise your unquestioned authority, especially when you provided no authority for it originally, not even a name (though I can pretty much guess that by now).

It is a big deal because your test didn't prove what you suggested it did (and heaven forbid I come along and point it out).

Actually my test did prove what I thought might be happening, it just didn't match the OP's script (heaven forbid... especially when I didn't have the full script at the time). I don't mind you pointing it out - in fact, I would've thanked you for it if it were done without the dismissive sarcasm. That really isn't appropriate in a thread where someone's trying to help someone else, and you just happen to know more about it or observe something another poster overlooked.

The original poster asked whether anyone had success using SpellCast() in other scripts - I tested and affirmed it worked without resorting to a brusque (and anonymous) "it works," an arrogant "I know what I'm talking about" or a rude dismissal of other posters. But let's not turn this into a personal attack; it sounds like the problem is resolved. Yay, Guest.

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


#27 -Guest-

-Guest-
  • Guest

Posted 10 March 2008 - 11:58 PM

Once you get everything up and running and assuming it works the way you want it to, you can probably further simplify the script by folding all the triggers into a single block
IF

Or(n)

  SpellCast([PC],SPELL1)

  SpellCast([PC],SPELL2)

  SpellCast([PC],SPELL3)

Global("MyVar","GLOBAL",0)

THEN

RESPONSE #100

DoStuff()

END
(not necessary, but it would keep things smaller and probably make it easier for you to check and update the list of spells you want to catch than having to run through a bunch of blocks for all the different spells).

#28 Bookwyrme

Bookwyrme
  • Modder
  • 5804 posts

Posted 11 March 2008 - 07:59 AM

I'm a little confused... is [PC] the actual term that will catch all party members?

I probably could list all the spells in a single OR block but it would be a really *long* block, so I think that there I will stick with separate blocks :)

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

 


 

 


#29 -Guest-

-Guest-
  • Guest

Posted 11 March 2008 - 11:33 AM

[PC] will catch any party member of the party's familiar, yes.

#30 -Guest-

-Guest-
  • Guest

Posted 11 March 2008 - 12:54 PM

I probably could list all the spells in a single OR block but it would be a really *long* block, so I think that there I will stick with separate blocks

Yeah, there's nothing wrong with keeping them in separate blocks (this really is a case of whatever way is easiest to keep track of them is best). You could collapse them into blocks by spell type, though (say, one block with invisible detection spells, another with invisibility spells, one with combat protection buffs, etc.), if you just don't want an OR() group with 1,000 triggers or so. ;-)

To make sure *I* understand, the object reference [2] is EA.IDS, right:

I missed this, sorry. It's the numerical value of the target's allegiance (from EA.IDS); the numbers can be substituted for the IDS symbols for everything in the [EA.GENERAL.RACE.CLASS.SPECIFIC.ALIGNMEN] object spec.

Note that, unlike most stat-based values (which is a simple expression of value_specified == value_of_attribute), there is some amount of special handling for allegiance (EA 2 also picks up EA 3, EA 30 picks up everything <= 30, etc.), and you have the class combinations (202 MAGE_ALL, etc.) and alignment masks (3 MASK_EVIL, etc.), so it's not always going to be that the value in the CRE file exactly matches the value used.

Also note that NOTGOOD picks up static AI objects (door, trigger, and container regions in the ARE, etc.), so you must specify additional parameters if you want it to actually do something useful (e.g., [NOTGOOD.HUMANOID] will finally switch it to picking up only *actors* of !GOODCUTOFF allegiance that are General HUMANOID -- other objects in the ARE need no longer apply).

and the spell resource number is not the actual spell, of course (SPPR101) but the numerical reference used by SPELL.IDS:

The engine is hardcoded to know what these values do -- it's the same format as in the IDS file, but the engine doesn't care about the IDS and you can use values that aren't defined as easily as values that are. The specific format is <Spell Type><Spell Number>, where spell type is a single digit (1-4) that lets the engine know the prefix of the spell file (1=SPPR, 2=SPWI, 3=SPIN, 4=SPCL) and spell number are exactly the 3 digits of the spell's complete suffix (e.g., you can specify SPCL123.SPL as 4123, SPIN739 as 3739, SPPR101 as 1101, but you can't make a number for MYSPELL.SPL or for SPPR505D or SPCL411F).

#31 cmorgan

cmorgan
  • Modder
  • 2301 posts

Posted 11 March 2008 - 06:57 PM

The coolest thing in the world is discovering a whole new range of things to learn :D Thank you!

Edited by cmorgan, 11 March 2008 - 06:57 PM.