Jump to content

Scriptable Spells v3


Recommended Posts

Democracy belongs to those who show up.

 

 

Sometimes it belongs to whoever shows up with working code :p

 

Ah-men!

 

Nythrun, you are going to make me come out of retirement, aren't you? Well that, and I can't seem to keep NWN2 stable on my system.

 

A couple of months back, I think I sent a copy of Horred's last update to CamDawg. Did you perchance get a copy of that to work with or are you going it from the notes in this thread?

 

I might still have a copy of it lying around somewhere if you are interested. It would likely be sometime this weekend before I could get it to you.

 

Thanks,

Link to comment

I'd appreciate it, thanks. If you've wiki access, just up there would be fine too - I'll not be doing anything with this for at least a week, so no rush (my cup runneth over as it is!) I'm using whatever I've gleaned from the discussion here, less anything that seems totally redundant or needs to be coded differently to work better. Anything that I'm getting wrong, someone jump in and say so :p There's a few open slots left too.

 

/edited to add (god I never shut up)

 

I wasn't planning on coding anything for on-cre effects, for several reasons. It'll probably be better to point people to something like

<<<<<<<<embedded.effect
>>>>>>>>

COPY ~embedded.effect~ ~override~
 PATCH_IF 1 THEN BEGIN
INSERT_BYTES 0x00 0x108
WRITE_LONG   0x08 0x00 // opcode
WRITE_LONG   0x0c 0x1
WRITE_LONG   0x10 0x00 // parameter 1
WRITE_LONG   0x14 0x00 // parameter 2
WRITE_LONG   0x1c 0x9
WRITE_SHORT  0x24 0x64
WRITE_ASCII  0x28 ~~   // resref
WRITE_LONG   0x78 0xffffffff
WRITE_LONG   0x7c 0xffffffff
WRITE_LONG   0x80 0xffffffff
WRITE_LONG   0x84 0xffffffff
WRITE_LONG   0x9c 0xffff
 END

COPY_EXISTING ~somecre.cre~ ~override~
 PATCH_IF (SOURCE_SIZE > 0x2d4) THEN BEGIN
READ_LONG  0x02a0 "kso"
READ_LONG  0x02a8 "smo"
READ_LONG  0x02b0 "mso"
READ_LONG  0x02b8 "iso"
READ_LONG  0x02bc "ilo"
READ_LONG  0x02c4 "elo"
READ_LONG  0x02c8 "elc"
WRITE_LONG 0x02a0 ("kso" >= "elo") ? ("kso" + 0x108) : "kso"
WRITE_LONG 0x02a8 ("smo" >= "elo") ? ("smo" + 0x108) : "smo"
WRITE_LONG 0x02b0 ("mso" >= "elo") ? ("mso" + 0x108) : "mso"
WRITE_LONG 0x02b8 ("iso" >= "elo") ? ("iso" + 0x108) : "iso"
WRITE_LONG 0x02bc ("ilo" >= "elo") ? ("ilo" + 0x108) : "ilo"
WRITE_LONG 0x02c8 ("elc" + 0x1)
INSERT_FILE "elo" ~embedded.effect~
 END
UNLESS ~%embedded.effect%~

for the rare fringe cases where that's necessary.

 

Items and spells that use .effs are another story, though, and probably ought to be added.

Link to comment

The problem with that, by the way, is that while it's true that proficiency/stats overwrite rather than increment, the engine reads the highest value present on the creature when doing CheckStatGT and the like. So none of the "cure stat by adding new stat with zero parameter" stuff is going to work at all.

 

I'll still run through the unused things today and see if I can't mine out the rest that are reserved by the engine (e.g. 185 reads as greater than zero after being set to zero, no idea what it's used for if anything).

 

/edit

 

utterly stupid typo fixed.

Link to comment

By "doesn't work" I mean after setting the stat and state to zero with an effect, CheckStatGT(Myself,0,%stat%) returns true anyway.

  1. Stat 182 / State 26 - doesn't work - on the list as DISPEL_GOOD, gotta go.
  2. Stat 188 / State 32 - does work with the scripting state opcode only - but displays the Magic Saucer .bam underfoot, dunno what it means
  3. Stat 193 / State 37 - does work with the scripting state opcode only - didn't see any side effects, but didn't look too long.

There also appears to be some inexplicable behavior with stat 200, I've gotten it to work before, but now it's refusing and I'm not at all sure why. Going to have to test a bit more to be sure I'm not pulling up false negatives here.

 

/edit

 

Figured that out. And somehow the stat can be set for a duration of zero and it still works :)

Link to comment

In addition to pulling the redundant LEVEL_DRAIN, I'll be yanking 176 GAZE_REFLECTION (HasItem covers this). Very tempted to pull SPELL_DEFLECTION, SPELL_TURNING, SPELL_TRAP also, as they'll never work well.

 

/edit

 

One other bit: if someone still wants a No ToB version of something like this, it would be mighty helpful to check which stats are actually available in those games.

OUTER_SET "stat" = 200

<<<<<<<<zzstatsc.baf
IF
Global("FJStatsCheck","LOCALS",0)
THEN
RESPONSE #100
ReallyForceSpellRes("zzstatsc",Myself)
DisplayStringHead(Myself,2642)
SetGlobal("FJStatsCheck","LOCALS",1)
END

IF
GlobalLT("FJStatsCheck","LOCALS",3)
THEN
RESPONSE #100
IncrementGlobal("FJStatsCheck","LOCALS",1)
Wait(3)
END


IF
GlobalGT("FJStatsCheck","LOCALS",2)
CheckStatGT(Myself,0,%stat%)
THEN
RESPONSE #100
ReallyForceSpellRes("zzstatsr",Myself)
PlaySound("CAS_M06")
DisplayStringHead(Myself,12087)
ReallyForceSpell(Myself,CLERIC_RESTORATION)
END


IF
GlobalGT("FJStatsCheck","LOCALS",2)
CheckStatLT(Myself,1,%stat%)
THEN
RESPONSE #100
DisplayStringHead(Myself,1682)
ReallyForceSpell(Myself,SIRINE_TELEPORT_FAKE)
END
>>>>>>>>

COPY ~zzstatsc.baf~ ~override/zzstatsc.bcs~
 EVALUATE_BUFFER
 COMPILE_BAF_TO_BCS  

COPY_EXISTING ~wolf01.cre~ ~override/zzstatsc.cre~
 WRITE_SHORT 0x024 0x64
 WRITE_SHORT 0x026 0x64
 WRITE_BYTE  0x234 0x20
 WRITE_ASCII 0x248 ~zzstatsc~
 WRITE_ASCII 0x280 ~zzstatsc~

COPY_EXISTING ~spcl131.spl~ ~override/zzstatsc.spl~
 DELETE_BYTES 0x72 (SOURCE_SIZE - 0x72)
 INSERT_BYTES 0x72 (0x28 + 0x60)
 WRITE_LONG   0x64 0x72
 WRITE_SHORT  0x68 0x1
 WRITE_LONG   0x6a (0x72 + 0x28)
 WRITE_SHORT  0x6e 0x0
 WRITE_SHORT  0x70 0x0
 WRITE_BYTE   (0x72 + 0x00) 0x1
 WRITE_SHORT  (0x72 + 0x02) 0x4
 WRITE_BYTE   (0x72 + 0x0c) 0x5
 WRITE_SHORT  (0x72 + 0x0e) 0x1
 WRITE_SHORT  (0x72 + 0x10) 0x1
 WRITE_SHORT  (0x72 + 0x1c) 0x1
 WRITE_SHORT  (0x72 + 0x1e) 0x2
 WRITE_SHORT  (0x72 + 0x22) 0x1
 WRITE_SHORT  (0x72 + 0x24) 0x1
 WRITE_SHORT  (0x72 + 0x26) 0x1
 // 0x11a for sstate, 0xe9 for stat
 WRITE_SHORT  (0x9a + 0x00) 0xe9
 WRITE_BYTE   (0x9a + 0x02) 0x2
 WRITE_LONG   (0x9a + 0x04) 0x22
 WRITE_LONG   (0x9a + 0x08) "stat"
 WRITE_BYTE   (0x9a + 0x0c) 0x0
 WRITE_LONG   (0x9a + 0x0e) 0x0
 WRITE_BYTE   (0x9a + 0x12) 0x64
 WRITE_SHORT  (0x9a + 0x30) 0xd8
 WRITE_BYTE   (0x9a + 0x32) 0x2
 WRITE_LONG   (0x9a + 0x34) 0x2
 WRITE_LONG   (0x9a + 0x38) 0x0
 WRITE_BYTE   (0x9a + 0x3c) 0x0
 WRITE_LONG   (0x9a + 0x3e) 0x100
 WRITE_BYTE   (0x9a + 0x42) 0x64

COPY_EXISTING ~zzstatsc.spl~ ~override/zzstatsr.spl~
 WRITE_SHORT  (0x9a + 0x00) 0xe9
 WRITE_BYTE   (0x9a + 0x02) 0x2
 WRITE_LONG   (0x9a + 0x04) 0x0
 WRITE_LONG   (0x9a + 0x08) 0x0
 WRITE_BYTE   (0x9a + 0x0c) 0x0
 WRITE_LONG   (0x9a + 0x0e) 0x1
 WRITE_BYTE   (0x9a + 0x12) 0x64
 WRITE_SHORT  (0x9a + 0x30) 0xe0
 WRITE_BYTE   (0x9a + 0x32) 0x2
 WRITE_LONG   (0x9a + 0x34) 0x0
 WRITE_LONG   (0x9a + 0x38) 0x0
 WRITE_BYTE   (0x9a + 0x3c) 0x0
 WRITE_LONG   (0x9a + 0x3e) 0x1
 WRITE_BYTE   (0x9a + 0x42) 0x64

 

Knock yourselves out if you want to :)

Link to comment

Yeah, I know.

 

I will never, ever check 154 and neither will anyone else (it's an instant modifier anyway and not applied for the entire casting duration, yes?) It's a waste to have an ids listing for something useless (did we really need to check both luck stats when only one is available in the game?). Mostly, that's just a sigh ;)

Link to comment

The million dollar question, isn't it ;)

 

What's the spell meant to do? If it's something unique I'd just set a variable with a limited duration (you can add this as a spell effect, I'm sure you know this). Stats are really for stuff that already interacts with other modifiers ;)

Link to comment

I just need to mark the creature targeted by the spell, with something that can be checked from another creature's script. As far as I can tell,

IF
 See(...)
 CheckStat(LastSeenBy,??,??)
THEN

is the only nice way of doing it. If not, I'm all ears. ;)

 

This is an attempted version of "Phantasmal Killer" 3E spell.

Link to comment

Gotcha...unfortuately the last public release is already trying to use more stats than are actually available. No one has done anything with 193/ss 37 yet, so if you want to experiment, feel free - it'll won't conflict with anything other than lack of ToB. It also hasn't seen extensive testing...so if anything odd turns up, you'll have interesting discoveries to report ;)

 

Of course, you've already EXTEND_BOTTOMed every creature script once, might as well do it again /teasing

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...