Jump to content

Scripting Help


Caedwyr

Recommended Posts

I'm currently attempting to create an item that will summon an invisible creature to apply a kit via a script. My creature's OVERRIDE script is as follows

 

//Apply geomancer kit and penalties
IF
Global("Cast_CA_APPLY_GEOMANCER","LOCALS",0) //So it only casts once.
Class(Player1,SORCERER)
CheckStatGT(Player1,12,WIS)
CheckStatGT(Player1,8,CHR)
!Alignment(Player1,LAWFUL_GOOD)
!Alignment(Player1,LAWFUL_EVIL)
!Alignment(Player1,CHAOTIC_GOOD)
!Alignment(Player1,CHAOTIC_EVIL)
THEN
RESPONSE #100
 SetGlobal("Cast_CA_APPLY_GEOMANCER","LOCALS",1)
 ActionOverride(Player1,AddKit(CA#DSORC))
 ApplySpellRES("CA#STLOS",Player1)
END

// refuse to cast if wrong class/statistics/alignment combination
IF
OR(7)
 !Class(Player1,SORCERER)
 CheckStatLT(Player1,13,WIS)
 CheckStatLT(Player1,9,CHR)
 Alignment(Player1,LAWFUL_GOOD)
 Alignment(Player1,LAWFUL_EVIL)
 Alignment(Player1,CHAOTIC_GOOD)
 Alignment(Player1,CHAOTIC_EVIL)
Global("Cast_CA_APPLY_GEOMANCER","LOCALS",0) //So it only casts once.
THEN
RESPONSE #100
 DisplayString(Player1,@10)
 SetGlobal("Cast_CA_APPLY_GEOMANCER","LOCALS",1)
END

//I came, I saw, I cast, I go bye-bye.
IF
Global("Cast_CA_APPLY_GEOMANCER","LOCALS",1)
THEN
RESPONSE #100
DestroySelf()
END

 

When I use the item I just get a puff of smoke that must be from the DestroySelf() block, but the kit and CA#STLOS spell are never applied to a Player 1 with the correct stats (test was Elf, Sorcerer, 13 wisdom, 15 charisma, Lawful Neutral).

 

@10 is supposed to display ~Invalid Class/Statistics/Alignment Combination~, but isn't displayed either.

Link to comment

The problem is, the kit isn't applied either.

 

For other strangeness, the animation is set to No Animation in NI, and I can't click on the field for the VVC slot in DLTCEP.

 

There don't appear to be any spelling errors, but its like the script isn't getting activated at all.

Link to comment

How are you making the summoned creature invisible?

 

Is CA#DSORC really your KIT.IDS kit name (or does WeiDU replace it with the kit value -- i.e., it's a variable -- when compiled)? (Never worked with kits, so I'm not sure how it's handled.)

Link to comment

CA#DSORC is the kit name. The application of the kit worked fine from a dialog, but doesn't want to run from a script.

 

I'm using the remove animation effect to make the creature invisible. Its the same invisible creature that I used in the PnP celestials mod with a different name.

 

The invisibility is handled by

[66] Graphics: Transparency Fade, 255

[287] Graphics: Selection Circle Removal

[271] Graphics: Avatar Removal

[315] Grahpics: Animation removal

 

 

The creature is currently summoned by an item, though I'm not sure what effect that would have

 

Here is an image of the summon effect:

summoningeffectcm9.jpg

And here is the extended effects from the item I'm using to try to apply the kit and statloss spell (CA#STLOS)

itemextendedeffectswb9.jpg

Link to comment

271 is disable creature. A disabled creature can't be relied upon to run its script (they don't get normal AI processing).

 

Add a permanent invisibility effect, timing mode 9, instead (although, with 315 and 287, you should be safe, but 315 is ToB-only).

 

The item looks fine. If you want to get rid of the summoning poof, you'll need to use an EFF (see virtually any summoning spell for usage).

Link to comment

Make sure you're doing this from a fresh save (prior to summoning the thing). Make sure the script compiled correctly to override.

 

Add a block to the top of the script to make sure it's correctly assigned to the creature and is running:

IF
True()
THEN
RESPONSE #100
DisplayStringHead(Player1,1)
END

If the script is assigned correctly but isn't running, 271 should be the culprit (it's not an effect you should ever really use outside cutscene creatures or invisible targets). If the script is assigned and is running, then there's a bad condition or action in there somewhere. Try Class(Player1,MAGE_ALL) instead (this includes sorcerers). Try removing all but the Global() triggers and see if the actions then execute correctly.

Link to comment

I didn't see any sort of 1 appear above Player1's head when I used the item (new game after reinstalling the mod having made the changes).

 

Just to make sure my .tp2 code is correct, here are the relevant sections for the things involved with this item:

 

COPY	  ~DruidSor/CREs/CA#AGEO.cre~	~override/CA#AGEO.cre~ // invisible invulnerable creature to cast spell to turn player1 into a geomantic sorcerer for ToB and Tutu (TEMPORARY)

COMPILE ~DruidSor/BAFs/CA#AGEO.BAF~			 		   // Script for invisible creature to apply kit for Tutu and ToB games (TEMPORARY)

COPY	~DruidSor/ITMs/CA#AGEO.itm~	~override/CA#AGEO.itm~
	SAY NAME1 @110
	SAY NAME2 @110
	SAY UNIDENTIFIED_DESC @111
	SAY DESC @111

// Internal Name of the Kit
ADD_KIT ~CA#DSORC~

// appended to CLASWEAP.2da
~CA#DSORC			   1		   0		   1		   1		   0		   0		   0		   0~
// appended column-wise to WEAPPROF.2da
~CA#DSORC 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0~
// appended to ABCLASRQ.2da
~CA#DSORC			   0	   0	   0	   0	   13	  9~
// appended to ABCLSMOD.2da
~CA#DSORC			   -2	  -2	  -2	  0	   0	   0~
// appended to ABDCDSRQ.2da
~CA#DSORC			   0	   0	   0	   0	   17	  17~
// appended to ABDCSCRQ.2da
~CA#DSORC			   0	   0	   0	   0	   17	  17~
// appended to ALIGNMNT.2da
~CA#DSORC			   0	   1	   0	   1	   1	   1	   0	   1	   0~
// appended to DUALCLAS.2da
~CA#DSORC			   0	   0	   0	   0	   0	   0~

// path to your CLAB-style 2da file
~DruidSor/2DAs/CA#DSOR.2da~

// PC races and classes allowed to use this kit, from KITTABLE.2da
~~

// usability flags, added to the end of the KITLIST.2da entry
~0x00004000	 19~

// HLA table to use; see LUABBR.2da
~GE0~

// list of starting equipment for PCs starting in ToB. Appended column-wise to 25STWEAP.2da
~* * * BAG29 RING06 RING40 * BOOT01 AMUL21 BRAC15 BELT10 AROW11,40 BULL03,40 BOLT06,40 POTN52,5 POTN4,2 POTN14,5 SLNG05 DAGG05,40 STAF20~

/* Lower, mixed, and help kit names and descriptions, added to KITLIST.2da */
SAY @100
SAY @100
SAY @102

 

The book shows up correctly in the game with the right name and description text, and not needing any identification.

Link to comment

Removing everything but the global triggers as follows:

 

IF
True()
THEN
RESPONSE #100
DisplayStringHead(Player1,1)
END

//Apply geomancer kit and penalties
IF
Global("Cast_CA_APPLY_GEOMANCER","LOCALS",0) //So it only casts once.
//Class(Player1,SORCERER)
// CheckStatGT(Player1,12,WIS)
// CheckStatGT(Player1,8,CHR)
// !Alignment(Player1,LAWFUL_GOOD)
// !Alignment(Player1,LAWFUL_EVIL)
// !Alignment(Player1,CHAOTIC_GOOD)
// !Alignment(Player1,CHAOTIC_EVIL)
THEN
RESPONSE #100
 ActionOverride(Player1,AddKit(CA#DSORC))
 ApplySpellRES("CA#STLOS",Player1)
 SetGlobal("Cast_CA_APPLY_GEOMANCER","LOCALS",1)
END

// refuse to cast if wrong class/statistics/alignment combination
//IF
// OR(7)
//  !Class(Player1,SORCERER)
//  CheckStatLT(Player1,13,WIS)
//  CheckStatLT(Player1,9,CHR)
//  Alignment(Player1,LAWFUL_GOOD)
//  Alignment(Player1,LAWFUL_EVIL)
//  Alignment(Player1,CHAOTIC_GOOD)
//  Alignment(Player1,CHAOTIC_EVIL)
// Global("Cast_CA_APPLY_GEOMANCER","LOCALS",0) //So it only casts once.
//THEN
//RESPONSE #100
//  DisplayStringHead(Player1,@10)
//  SetGlobal("Cast_CA_APPLY_GEOMANCER","LOCALS",1)
//END

//I came, I saw, I cast, I go bye-bye.
IF
Global("Cast_CA_APPLY_GEOMANCER","LOCALS",1)
THEN
RESPONSE #100
DestroySelf()
END

 

Doesn't cause any change in the behaviour. I still get a puff of smoke when I use the item and nothing happens (I haven't used a secondary effect file yet to eliminate the smoke puff, that'll be for when I get it to actually work)

 

 

The creature I summon has the following for its Icons and Script page in DLTCEP

 

creaturescriptwh8.jpg

Link to comment

Not offhand, but your script isn't running at all (and you'll probably find the creature hanging out in the area undestroyed in your saved games).

 

Are you sure you're COMPILEing the correct script (i.e., does this work?)

<<<<<<<<ca#ageo.baf
IF
Class(Player1,19)
CheckStatGT(Player1,12,WIS)
CheckStatGT(Player1,8,CHR)
!Alignment(Player1,LAWFUL_GOOD)
!Alignment(Player1,LAWFUL_EVIL)
!Alignment(Player1,CHAOTIC_GOOD)
!Alignment(Player1,CHAOTIC_EVIL)
THEN
RESPONSE #100
 ActionOverride(Player1,AddKit(CA#DSORC))
 ApplySpellRES("CA#STLOS",Player1)
 DestroySelf()
END

IF
 True()
THEN
 RESPONSE #100
DisplayStringHead(Player1,@10)
DestroySelf()
END
>>>>>>>>
COMPILE ~ca#ageo.baf~
COPY	  ~DruidSor/CREs/CA#AGEO.cre~ ~override~
 WRITE_ASCII 0x248 ~ca#ageo~ #8

Link to comment

Archived

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

×
×
  • Create New...