Jump to content


Photo

Any new way work like script trigger CheckStats in BG:EE?


  • Please log in to reply
12 replies to this topic

#1 c4_angel

c4_angel
  • Member
  • 18 posts

Posted 22 January 2017 - 09:58 PM

To make sure my mods being mostly compatible with other mods, in original games I often use the expanded stats(effect opcode 318) which provided by ToBEx, because almost every unused hardcoded stat in vanilla game, is being used by other great and famous mods like the SCS.

Obviously this way is nomore functional in BG:EE.

 

So my question is just the topic, is there any new way work like script trigger CheckStats in BG:EE, to detect a creature is affected by a specific spell, or has a specific item equiped, or not?


Edited by c4_angel, 22 January 2017 - 10:00 PM.


#2 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 23 January 2017 - 07:09 AM

Splstate.ids, CheckSpellState(Object,SPELLSTATE), opcode 328.

Retired from modding.


#3 c4_angel

c4_angel
  • Member
  • 18 posts

Posted 23 January 2017 - 11:46 AM

Splstate.ids, CheckSpellState(Object,SPELLSTATE), opcode 328.

Thanks, but I have some further questions:

 

1. The explanation in DLECEPv7,7 makes me confused. e.g.

"Known values for 'Type' are:

0   Chaotic Command"

does it mean when a creature is being effected by cleric spell "Chaotic Command", the creature is automatically set to this state so can be detect in script with CheckSpellState? Or an effect with opcode 328 must exist?

 

2. I found the value of "Chaotic Command" in splstate.ids is 41, does it mean when using opcode 328 with the "Type" set to a whatever number, then the make the number plus 41, so it can be detected in script with the related state name? e.g. the value of "DEFENSIVE_STANCE" in splstate.ids is 81, when I set the "Type" to 40, does CheckSpellState(Object,DEFENSIVE_STANCE) return a TRUE? 

 

3. Then, if 2 is true, is the splstate.ids expandable? Like the value of "XXX_STATE" set to 10000, does it work?

 

Thank you very much.


Edited by c4_angel, 23 January 2017 - 11:47 AM.


#4 Argent77

Argent77
  • Administrator
  • 1397 posts

Posted 24 January 2017 - 03:24 AM

SPLSTATE.IDS can be expanded (afaik, limited to the range 0 to 255). Use opcode 328 to set a spell state. Script trigger CheckSpellState(O:Object*,I:State*splstate) and several effect opcodes (e.g. 324 or 326) can be used to target objects marked that way.

 

Opcodes make use of target types defined in SPLPROT.2DA. SPLPROT.2DA uses special target codes (see this post). You can use Near Infinity to configure your spell effects, which decodes them into easier to understand statements.


Edited by Argent77, 24 January 2017 - 03:25 AM.


#5 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 24 January 2017 - 03:47 AM

2. I found the value of "Chaotic Command" in splstate.ids is 41, does it mean when using opcode 328 with the "Type" set to a whatever number, then the make the number plus 41

 

DLTCEP is lying :) Set type to the entry number in splstate.ids, i.e. 41 for CC.


Edited by GeN1e, 24 January 2017 - 03:47 AM.

Retired from modding.


#6 c4_angel

c4_angel
  • Member
  • 18 posts

Posted 24 January 2017 - 06:23 AM

SPLSTATE.IDS can be expanded (afaik, limited to the range 0 to 255). Use opcode 328 to set a spell state. Script trigger CheckSpellState(O:Object*,I:State*splstate) and several effect opcodes (e.g. 324 or 326) can be used to target objects marked that way.

 

Opcodes make use of target types defined in SPLPROT.2DA. SPLPROT.2DA uses special target codes (see this post). You can use Near Infinity to configure your spell effects, which decodes them into easier to understand statements.

Thanks a lot. I will make a try.



#7 c4_angel

c4_angel
  • Member
  • 18 posts

Posted 24 January 2017 - 06:23 AM

2. I found the value of "Chaotic Command" in splstate.ids is 41, does it mean when using opcode 328 with the "Type" set to a whatever number, then the make the number plus 41

 

DLTCEP is lying :) Set type to the entry number in splstate.ids, i.e. 41 for CC.

Aha. Thank you.



#8 c4_angel

c4_angel
  • Member
  • 18 posts

Posted 03 February 2017 - 12:25 PM

 
Opcodes make use of target types defined in SPLPROT.2DA. SPLPROT.2DA uses special target codes (see this post). You can use Near Infinity to configure your spell effects, which decodes them into easier to understand statements.

Totally confused with SPLPROT.2DA...

Any further instructions or examples of using that 2DA? PLEAAAAAASE...

#9 Argent77

Argent77
  • Administrator
  • 1397 posts

Posted 03 February 2017 - 04:17 PM

Using custom spell states requires a bit of preparation. In a nutshell:

1. Add your spell state to SPLSTATE.IDS (either hardcoded like this or programmatically look for and use an empty slot). This step is optional. If you skip it you have to use the straight number everywhere (including scripts).

APPEND ~splstate.ids~ ~123 YOUR_STATE_NAME~

2. Apply opcode 328 (Set spell state) to your creature with permanent timing and parameter2 = 123 (your spell state). Effect can be added with Near Infinity or another resource editor.

To target creatures marked with your spell state:
For spell effects: Opcodes 324 or 326 can be used to target spell states. Set parameter2 of your effect to 110 (SPLSTATE = parameter1) or 111 (SPLSTATE != parameter1) and parameter1 to 123 (your spell state). Effect can be defined in NI or another resource editor.

For scripts: Use trigger CheckSpellState(Target, YOUR_STATE_NAME)



#10 c4_angel

c4_angel
  • Member
  • 18 posts

Posted 03 February 2017 - 05:35 PM

To target creatures marked with your spell state:
For spell effects: Opcodes 324 or 326 can be used to target spell states. Set parameter2 of your effect to 110 (SPLSTATE = parameter1) or 111 (SPLSTATE != parameter1) and parameter1 to 123 (your spell state). Effect can be defined in NI or another resource editor.
Kinda understood, still a question: set parameter2 to 110or111 is that decimal or hexadecimal? coz in the G3 post 0x110 is related to ALIGNMENT, and I can nowhere find decimal 110 or 111 or
0x6e/0x6f, g3 nor iesdp...

#11 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5148 posts

Posted 03 February 2017 - 10:20 PM

...

Opcode 324 in the new engine. The 0x should indicate heaxdecimal number, but an up to date editor should make assumption such as this obsolete, as it should contain such info. I would first try and find if the info is contained in the latest Near Infinity.


Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#12 Argent77

Argent77
  • Administrator
  • 1397 posts

Posted 04 February 2017 - 04:45 AM

Near Infinity does all of it for you. 110 or 111 are the entry positions in the SPLPROT.2DA (which are not always plainly noted in the first column and therefore more difficult to determine manually). They should work in both BG1EE and BG2EE. For IWDEE you have to find it out yourself since this game is still on v1.4.



#13 c4_angel

c4_angel
  • Member
  • 18 posts

Posted 04 February 2017 - 06:51 AM

Finally works. Thank you all!