Jump to content


Photo

Distinctive creature coloring [IMPLEMENTED]


  • Please log in to reply
66 replies to this topic

#21 Chevalier

Chevalier

    Knight of the Realms

  • Modder
  • 2405 posts

Posted 19 December 2009 - 05:56 AM

I love this component! How will this work with Infinity Animations? Any conflicts?

I Ride for the King!


a.k.a. Chev


#22 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 19 December 2009 - 06:28 AM

I love this component! How will this work with Infinity Animations? Any conflicts?

Well, as no one has made a dedicated .tp2 code for the Infinity Animations mod, it's hard to even contemplate, but there shouldn't be too much to fix after, cause the Distinctive CC uses the basic creature animations...

And, yes, by 'dedicated' I mean finished fully working animation revamp that redistributes the animations to each and every .cre file in a game... yes, the tool will make a temporary files that will allow a unique combination of creatures, but it's only for the animation .bam's, not the creatures... besides there are more animation to be first converted...

Edited by Jarno Mikkola, 19 December 2009 - 06:31 AM.

Deactivated account. The user today is known as The Imp.


#23 aVENGER

aVENGER
  • Modder
  • 1680 posts

Posted 19 December 2009 - 07:32 AM

I love this component!


Thanks! :)

How will this work with Infinity Animations? Any conflicts?


I haven't had a chance to try out Infinity Animations yet, but I doubt there will be any issues since aTweaks doesn't edit the actual avatars in any way. All of my work here is done through simple coloring opcodes which are applied at the CRE level.

#24 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 19 December 2009 - 08:36 AM

How will this work with Infinity Animations? Any conflicts?


I haven't had a chance to try out Infinity Animations yet, but I doubt there will be any issues since aTweaks doesn't edit the actual avatars in any way. All of my work here is done through simple coloring opcodes which are applied at the CRE level.

Yeah, but see, the Infinity Animations would alter the demon animations to be color based. Now, the question is, can you reproduce the same result with the creature coloring as they do with the patching the whole animation... as your's would be cleaner in away, as then we need less animation slots...

Edited by Jarno Mikkola, 19 December 2009 - 08:37 AM.

Deactivated account. The user today is known as The Imp.


#25 Sir BillyBob

Sir BillyBob
  • Modder
  • 5315 posts

Posted 19 December 2009 - 08:38 AM

Some features may be redundant with IA. I see you have colored a golem to be an "iron golem" but with IA, we can add in the IWD Iron Golem animation. So there isn't a need for coloring one of the other creatures. However, what that does allow you to now call that red golem something else. Hmm, a red clay golem? Sandstone golem?

BTW, IA will be seen in a mod soon. Very soon...

Now to see how adding this will add even more creatures. Thanks for the great work.

Tired of Bhaal? Try some classics mods instead:
Classic Adventures
Official Classic Adventures Website


#26 aVENGER

aVENGER
  • Modder
  • 1680 posts

Posted 19 December 2009 - 08:48 AM

Wow, looking at Infinity Animations right now... that's some pretty awesome stuff!

I see that they are using a completely different approach i.e. adding actual animation slots, which allows for much more customization than one could ever dream to do with simple coloring opcodes. Nice work! :new_thumbs:

#27 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 21 December 2009 - 06:27 AM

How will this work with Infinity Animations? Any conflicts?

It is compatible if Infinity Animations is installed after aTweaks. It already assigns creatures like snow trolls their specific animations (from IWD in this case) and removes colouring effects, because they could look quite odd (odder?) otherwise. It leaves any colouring effects on creatures we don't have specific animations for (yet). For iron golems, there is a component that gives them the IWD iron golem animation and leaves the BG2 one for the adamantine golems. In a modded game, there are also ruby, sapphire golems etc. which recolouring might make sense for (though it is almost just as easy to repalette the animation and assign new golem slots).

Well, as no one has made a dedicated .tp2 code for the Infinity Animations mod... And, yes, by 'dedicated' I mean finished fully working animation revamp that redistributes the animations to each and every .cre file in a game...

Yes, there is, it is in testing as I think you know.

yes, the tool will make a temporary files that will allow a unique combination of creatures, but it's only for the animation .bam's, not the creatures...

I'm not sure what you mean by "temporary files" but the IA forum is probably more appropriate.

All of my work here is done through simple coloring opcodes which are applied at the CRE level.

I don't suppose I could prevail upon you to turn your talents toward recolouring the actual BAMs so we can assign proper slots for them? Not necessary for those I mentioned above, but others (like mephits, maybe an alternate mummy) might be good to have. Those colouring opcodes have issues which you've seen, and I mentioned here, namely:

1) They make the CREs almost entirely monochromatic (e.g. all red, no orange or yellow).
2) The "very bright" opcode (#52) makes creatures "glow in the dark" (as aVENGER mentioned here).
3) The "strong/dark" opcode (#51) has the opposite effect - if a creature steps into even soft shadows, it goes almost entirely black.

Incidentally, which opcode did you use for the nabassu/pit fiends? I could strip both opcodes when IA gives them dedicated animations, but why use 6 lines of code when we can use 3 <_<.

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


#28 aVENGER

aVENGER
  • Modder
  • 1680 posts

Posted 21 December 2009 - 07:31 AM

I don't suppose I could prevail upon you to turn your talents toward recolouring the actual BAMs so we can assign proper slots for them? Not necessary for those I mentioned above, but others (like mephits, maybe an alternate mummy) might be good to have.


Sure, I'd love to give it a try. However, as I'm currently dedicating all of my modding time to the Revised Fiends component, it might not happen for some time.

Incidentally, which opcode did you use for the nabassu/pit fiends?


I used #51 for the Pit Fiend and the Nabassu and the #52 for the Balor. Here's the relevant code:

COPY_EXISTING ~DEMNAB01.CRE~ ~override~											// Nabassu
			  ~DEMNAB02.CRE~ ~override~											// Nabassu
			  ~DEMNABSU.CRE~ ~override~											// Nabassu (summoned)
			  ~ENDDEM04.CRE~ ~override~											// Nabassu
			  ~ENDDEM05.CRE~ ~override~											// Nabassu
			  ~OBSDEM05.CRE~ ~override~											// Nabassu
			   ~PPNAB01.CRE~ ~override~											// Nabassu
			   ~PPNAB02.CRE~ ~override~											// Nabassu
			   ~PPNAB03.CRE~ ~override~											// Nabassu
			   ~PMASTER.CRE~ ~override~											// Master of Thralls (named Nabassu within the Planar Prison)
			   ~RUMAR02.CRE~ ~override~											// Nabassu
				~UDNABA.CRE~ ~override~											// Nabassu
			  ~ABYDEM01.CRE~ ~override~											// Tanar'ri (Nabassu within the Planar Sphere)
			  ~TANARI01.CRE~ ~override~											// Tanar'ri (Nabassu within the Planar Sphere)
			  ~OBSDEM01.CRE~ ~override~											// Lea'liyl (named Nabassu within the Planar Sphere)
PATCH_IF (SOURCE_SIZE > 0x2d3) THEN BEGIN										  // file size sanity check (filters out 0 byte files i.e. ALLOW_MISSING)
PATCH_INCLUDE ~aTweaks/lib/fj_cre_validity.tpp~									// Nythrun's CRE re-indexer macros (needed for corrupt and v1 CREs)
  PATCH_IF valid BEGIN
  PATCH_INCLUDE ~aTweaks/lib/fj_cre_reindex.tpp~
  PATCH_INCLUDE ~aTweaks/lib/fj_cre_eff_v2.tpp~
  END
WRITE_SHORT 0x28 "4352"															// Sets avatar to TANARRI (winged demon)
SET opcode = "51"																  // effect: #51 (Colour: Strong/Dark by RGB)
SET target = "1"																   // target: 1 (self)
SET timing = "9"																   // timing mode: 9 (permanent after death)
SET parameter1 = "-168490496"													  // param1: (color designation)
SET parameter2 = "2"															   // param2: 2 (location - major color)
SET parameter3 = "0"															   // param3: 0
SET parameter4 = "0"															   // param4: 0
SET power = "0"																	// power: 0
SET resist_dispel = "0"															// dispel/resistance: 0 (non-magical)
SET duration = "0"																 // duration: 0
SET probability1 = "100"														   // probability1: 100%
SET probability2 = "0"															 // probability2: 0%
SET dicenumber = "0"															   // dicenumber: 0
SET dicesize = "0"																 // dicesize: 0
SET savingthrow = "0"															  // saving throw type: 0 (none)
SET savebonus = "0"																// save bonus: 0
SET school = "0"																   // school: 0 (schoolless)
SET lowestafflvl = "0"															 // lowest level affected: 0
SET highestafflvl = "0"															// highest level affected: 0
SET casterx = "0"																  // casterx: 0
SET castery = "0"																  // castery: 0
SET targetx = "0"																  // targetx: 0
SET targety = "0"																  // targety: 0
SET casterlvl  = "0"															   // caster level: 0
SET sectype = "0"																  // secondary type: 0
SPRINT ~resource~ ~~															   // resref: none
SPRINT ~resource2~ ~~															  // resref2: none
SPRINT ~resource3~ ~~															  // resref3: none
SPRINT ~vvcresource~ ~~															// vvcresref: none
SPRINT ~effsource~ ~~															  // effsource: none
SPRINT ~effvar~ ~~																 // effvar: none
LAUNCH_PATCH_MACRO ~ADD_CRE_EFFECT~												// add new creature effect
END																				// ends file size sanity check
BUT_ONLY_IF_IT_CHANGES


COPY_EXISTING   ~DEMPIT.CRE~ ~override~											// Pit Fiend
			  ~DEMPIT01.CRE~ ~override~											// Pit Fiend
			  ~DEMPITSU.CRE~ ~override~											// Pit Fiend (summoned)
			   ~TELPIT1.CRE~ ~override~											// Pit Fiend
			   ~TELPIT2.CRE~ ~override~											// Pit Fiend
PATCH_IF (SOURCE_SIZE > 0x2d3) THEN BEGIN										  // file size sanity check (filters out 0 byte files i.e. ALLOW_MISSING)
PATCH_INCLUDE ~aTweaks/lib/fj_cre_validity.tpp~									// Nythrun's CRE re-indexer macros (needed for corrupt and v1 CREs)
  PATCH_IF valid BEGIN
  PATCH_INCLUDE ~aTweaks/lib/fj_cre_reindex.tpp~
  PATCH_INCLUDE ~aTweaks/lib/fj_cre_eff_v2.tpp~
  END
WRITE_SHORT 0x28 "4352"															// Sets avatar to TANARRI (winged demon)
SET opcode = "51"																  // effect: #51 (Colour: Strong/Dark by RGB)
SET target = "1"																   // target: 1 (self)
SET timing = "9"																   // timing mode: 9 (permanent after death)
SET parameter1 = "61440"														   // param1: (color designation)
SET parameter2 = "2"															   // param2: 2 (location - major color)
SET parameter3 = "0"															   // param3: 0
SET parameter4 = "0"															   // param4: 0
SET power = "0"																	// power: 0
SET resist_dispel = "0"															// dispel/resistance: 0 (non-magical)
SET duration = "0"																 // duration: 0
SET probability1 = "100"														   // probability1: 100%
SET probability2 = "0"															 // probability2: 0%
SET dicenumber = "0"															   // dicenumber: 0
SET dicesize = "0"																 // dicesize: 0
SET savingthrow = "0"															  // saving throw type: 0 (none)
SET savebonus = "0"																// save bonus: 0
SET school = "0"																   // school: 0 (schoolless)
SET lowestafflvl = "0"															 // lowest level affected: 0
SET highestafflvl = "0"															// highest level affected: 0
SET casterx = "0"																  // casterx: 0
SET castery = "0"																  // castery: 0
SET targetx = "0"																  // targetx: 0
SET targety = "0"																  // targety: 0
SET casterlvl  = "0"															   // caster level: 0
SET sectype = "0"																  // secondary type: 0
SPRINT ~resource~ ~~															   // resref: none
SPRINT ~resource2~ ~~															  // resref2: none
SPRINT ~resource3~ ~~															  // resref3: none
SPRINT ~vvcresource~ ~~															// vvcresref: none
SPRINT ~effsource~ ~~															  // effsource: none
SPRINT ~effvar~ ~~																 // effvar: none
LAUNCH_PATCH_MACRO ~ADD_CRE_EFFECT~												// add new creature effect
END																				// ends file size sanity check
BUT_ONLY_IF_IT_CHANGES


COPY_EXISTING  ~BALOR01.CRE~ ~override~											// Balor
			  ~DEMBAL01.CRE~ ~override~											// Balor
			  ~DEMBAL02.CRE~ ~override~											// Balor
			  ~DEMOSUM2.CRE~ ~override~											// Balor
			  ~ENDDEM03.CRE~ ~override~											// Balor
				~GORDEM.CRE~ ~override~											// Balor (mismatched animation fixed)
			  ~GORDEMC1.CRE~ ~override~											// Balor
			  ~JONDEM02.CRE~ ~override~											// Balor (mismatched animation fixed)
			  ~JONDEM04.CRE~ ~override~											// Balor (mismatched animation fixed)
			  ~M05DEMON.CRE~ ~override~											// Balor
			  ~MELSUM04.CRE~ ~override~											// Balor
			   ~SUDEMON.CRE~ ~override~											// Balor
			  ~SUDEMON2.CRE~ ~override~											// Balor
			   ~SUDEMW1.CRE~ ~override~											// Balor
			   ~TELBAL1.CRE~ ~override~											// Balor
			   ~TELBAL2.CRE~ ~override~											// Balor
			   ~UDBALOR.CRE~ ~override~											// Balor
PATCH_IF (SOURCE_SIZE > 0x2d3) THEN BEGIN										  // file size sanity check (filters out 0 byte files i.e. ALLOW_MISSING)
PATCH_INCLUDE ~aTweaks/lib/fj_cre_validity.tpp~									// Nythrun's CRE re-indexer macros (needed for corrupt and v1 CREs)
  PATCH_IF valid BEGIN
  PATCH_INCLUDE ~aTweaks/lib/fj_cre_reindex.tpp~
  PATCH_INCLUDE ~aTweaks/lib/fj_cre_eff_v2.tpp~
  END
WRITE_SHORT 0x28 "4352"															// Sets avatar to TANARRI (winged demon)
SET opcode = "52"																  // effect: #52 (Colour: Very Bright by RGB)
SET target = "1"																   // target: 1 (self)
SET timing = "9"																   // timing mode: 9 (permanent after death)
SET parameter1 = "16909824"														// param1: (color designation)
SET parameter2 = "2"															   // param2: 2 (location - major color)
SET parameter3 = "0"															   // param3: 0
SET parameter4 = "0"															   // param4: 0
SET power = "0"																	// power: 0
SET resist_dispel = "0"															// dispel/resistance: 0 (non-magical)
SET duration = "0"																 // duration: 0
SET probability1 = "100"														   // probability1: 100%
SET probability2 = "0"															 // probability2: 0%
SET dicenumber = "0"															   // dicenumber: 0
SET dicesize = "0"																 // dicesize: 0
SET savingthrow = "0"															  // saving throw type: 0 (none)
SET savebonus = "0"																// save bonus: 0
SET school = "0"																   // school: 0 (schoolless)
SET lowestafflvl = "0"															 // lowest level affected: 0
SET highestafflvl = "0"															// highest level affected: 0
SET casterx = "0"																  // casterx: 0
SET castery = "0"																  // castery: 0
SET targetx = "0"																  // targetx: 0
SET targety = "0"																  // targety: 0
SET casterlvl  = "0"															   // caster level: 0
SET sectype = "0"																  // secondary type: 0
SPRINT ~resource~ ~~															   // resref: none
SPRINT ~resource2~ ~~															  // resref2: none
SPRINT ~resource3~ ~~															  // resref3: none
SPRINT ~vvcresource~ ~~															// vvcresref: none
SPRINT ~effsource~ ~~															  // effsource: none
SPRINT ~effvar~ ~~																 // effvar: none
LAUNCH_PATCH_MACRO ~ADD_CRE_EFFECT~												// add new creature effect
END																				// ends file size sanity check
BUT_ONLY_IF_IT_CHANGES


#29 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 22 December 2009 - 07:53 AM

Here's the relevant code:

Cheers :cheers:.

You can compress your code quite a bit with FUNCTIONs instead of MACROs, as I think GeN1e mentioned above. The main difference is that with FUNCTIONs you don't need to initialise all the null values. Add ACTION_FOR_EACH to your COPYs and you can drop the ALLOW_MISSING section, which creates evil zero-byte files in the override (apart from cluttering it up, it will cause mods to fail that don't use SOURCE_SIZE checks).

Here's an example from Infinity Animations. I've changed the first example to use a FUNCTION to add your values (normally we delete them, as in the second example):
ACTION_IF FILE_EXISTS_IN_GAME ~dw#nabsu.cre~ BEGIN //SCS2 overwrites an abishai with a nabassu
  OUTER_SPRINT abi ~t-none~
  OUTER_SPRINT nab ~demabi01~
END ELSE BEGIN
  OUTER_SPRINT abi ~demabi01~
  OUTER_SPRINT nab ~t-none~
END
//The "nab" variable is used below; the "abi" variable is used in a later routine for colored abishai

ACTION_FOR_EACH nb IN ~abydem01~ ~caddem13~ ~caddem5~ ~%nab%~ ~demnab01~ ~demnab02~ ~demnabr1~ ~demnabr2~ ~demnabsu~ ~dw#nabsu~ ~enddem04~ ~enddem05~ ~esp04~ ~finnabas~ ~obsdem01~ ~obsdem05~ ~pmaster~ ~ppnab01~ ~ppnab02~ ~ppnab03~ ~rumar02~ ~tanari01~ ~tg#dem2~ ~udnaba~ ~z#gnab01~ ~z#gnabas~ BEGIN
  ACTION_IF FILE_EXISTS_IN_GAME ~%nb%.cre~ BEGIN //Nabassus get a green-gray tanar'ri animation
	COPY_EXISTING ~%nb%.cre~ ~override~
	  PATCH_INCLUDE ~infinityanimations/lib/fj_cre_validity.tpp~
	  //You don't need to check SOURCE_SIZE because the above macro does it
	  PATCH_IF valid BEGIN
		PATCH_INCLUDE ~infinityanimations/lib/fj_cre_reindex.tpp~
		//You don't need to include fj_cre_eff_v2 because the above macro includes it if necessary
		WRITE_SHORT 0x28 0x1001 //Animation (nabassu)
		WRITE_BYTE 0x2f 20 //Skin color (dark moldy green)
		LAUNCH_PATCH_FUNCTION ADD_CRE_EFFECT
		   INT_VAR opcode = 51 //Color: Strong/Dark by RGB
		   timing = 9 //Permanent after death
		   parameter1 = ~-168490496~ //Color designation
		   parameter2 = 2 //Major color
		   resist_dispel = 2 //Not dispellable/bypass resistance
		END
	  END
	BUT_ONLY
  END
END

ACTION_FOR_EACH nb IN ~caddem11~ ~caddem18~ ~caddem25~ ~caddem3~ ~dempit~ ~dempit01~ ~dempitr1~ ~dempitr2~ ~dempitsu~ ~dubnd11~ ~dw#bazpf~ ~dw#pitsu~ ~heldem3~ ~heldem4~ ~heldem5~ ~psbaatl~ ~rempitsu~ ~telpit1~ ~telpit2~ ~tg#dem1~ ~z#gpit01~ ~z#gpitfd~ ~z_whel1~ ~z_whel2~ ~z_whel3~ ~z_whel4~ BEGIN
  ACTION_IF FILE_EXISTS_IN_GAME ~%nb%.cre~ BEGIN //Pit Fiends get the NWN animation
	COPY_EXISTING ~%nb%.cre~ ~override~
	  PATCH_IF SOURCE_SIZE > 0x2d3 BEGIN //Other validity checks not necessary because we did them earlier
		WRITE_SHORT 0x28 0x5035 //Animation (pit_fiend_nwn)
		WRITE_BYTE 0x2f 46 //Skin color (red)
		LAUNCH_PATCH_FUNCTION DELETE_CRE_EFFECT
		  INT_VAR opcode_to_delete = 51 //Strong-dark by RGB
		END
	  END
	BUT_ONLY
  END
END
We don't patch balors separately since it is not necessary for most (only for those that have botched animations), but I suppose we should now to strip any colour effects as well.

Also, you only change vanilla CREs or modded ones too? Just wondering... I think for your Revised Fiends component you might consider patching all of them, or there might be some major disparity in a modded game. If you like, I can provide a list of all CREs from my latest BWP install (using the Creature Lister in my signature) which is what I use for a reference.

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


#30 aVENGER

aVENGER
  • Modder
  • 1680 posts

Posted 22 December 2009 - 10:03 AM

You can compress your code quite a bit with FUNCTIONs instead of MACROs, as I think GeN1e mentioned above. The main difference is that with FUNCTIONs you don't need to initialise all the null values. Add ACTION_FOR_EACH to your COPYs and you can drop the ALLOW_MISSING section, which creates evil zero-byte files in the override (apart from cluttering it up, it will cause mods to fail that don't use SOURCE_SIZE checks).


Cool. I've tried using functions before, but for some reason had very little success. Then again, it seems that the newer WeiDU versions have fixed some of the issues I encountered back then, so I'll give it another try.


Also, you only change vanilla CREs or modded ones too?


For now, that component only handles vanilla CREs. I could expand that to catch modded creatures as well, but it would have to be on a case-by-case basis since I take over Fiend scripts from the unmodded game. Sample code:

// Nabassu

COPY_EXISTING ~DEMNAB01.CRE~ ~override~											// Nabassu
			  ~DEMNAB02.CRE~ ~override~											// Nabassu
			  ~DEMNABSU.CRE~ ~override~											// Nabassu (summoned)
//			  ~ENDDEM04.CRE~ ~override~										  // Nabassu (unused?)
//			  ~ENDDEM05.CRE~ ~override~										  // Nabassu (unused?)
			  ~OBSDEM01.CRE~ ~override~											// Lea'liyl (named Nabassu within the Planar Sphere)
			  ~OBSDEM05.CRE~ ~override~											// Nabassu
//			 ~PPNAB01.CRE~ ~override~											// Nabassu (cutscene only?)
//			 ~PPNAB02.CRE~ ~override~											// Nabassu (cutscene only?)
//			 ~PPNAB03.CRE~ ~override~											// Nabassu (cutscene only?)
			   ~PMASTER.CRE~ ~override~											// Master of Thralls (named Nabassu within the Planar Prison)
			   ~RUMAR02.CRE~ ~override~											// Nabassu
				~UDNABA.CRE~ ~override~											// Nabassu
			  ~ABYDEM01.CRE~ ~override~											// Tanar'ri (Nabassu within the Planar Sphere)
			  ~TANARI01.CRE~ ~override~											// Tanar'ri (Nabassu within the Planar Sphere)
PATCH_INCLUDE ~aTweaks/lib/fj_cre_validity.tpp~									// Nythrun's CRE re-indexer macros (needed for corrupt and v1 CREs)
  PATCH_IF valid BEGIN
  PATCH_INCLUDE ~aTweaks/lib/fj_cre_reindex.tpp~
  PATCH_INCLUDE ~aTweaks/lib/fj_cre_eff_v2.tpp~
END
REPLACE_CRE_ITEM ~RR#DNABA~ #0 #0 #0 ~UNDROPPABLE~ ~WEAPON1~ EQUIP				 // replace default weapon with a less powerful weapon (closer to PnP damage output)
LAUNCH_PATCH_FUNCTION ~RR#MDCRE~												   // Starts FUNCTION call (aTweaks' Creature Modification function)
INT_VAR																			// Initialize variables
"newxpv"   = "16000"															   // new XP value
"newhp"	= "76"																  // new hit point value
"newac"	= "-5"																  // new Armor Class value
"newth"	= "13"																  // new THAC0 value
"newapr"   = "3"																   // new number of attacks per round
"newsvd"   = "10"																  // new Save vs. Death
"newsvw"   = "12"																  // new Save vs. Wand
"newsvp"   = "11"																  // new Save vs. Polymorph
"newsvb"   = "12"																  // new Save vs. Breath
"newsvs"   = "13"																  // new Save vs. Spell
"newmr"	= "50"																  // new Magic Resistance value
"newfr"	= "100"																 // new Resist Fire value
"newcr"	= "50"																  // new Resist Cold value
"newer"	= "100"																 // new Resist Electricity value
"newlvl1"  = "7"																   // new level (first class)
"newstr"   = "19"																  // new Strength value
"newint"   = "14"																  // new Intelligence value
"newwis"   = "15"																  // new Wisdom value
"newdex"   = "14"																  // new Dexterity value
"newcon"   = "19"																  // new Constitution value
"newchr"   = "18"																  // new Charisma value
"newmor"   = "16"																  // new morale value
"newmorb"  = "4"																   // new morale break value
"newmorr"  = "15"																  // new morale recovery value
"newalign" = "51"																  // new alignment (Chaotic Evil)
STR_VAR																			// initialize strings
"enfc01"   = "DEMNAB01"															// enforced creature 1 (uses strict PnP values)
"enfc02"   = "DEMNAB02"															// enforced creature 2 (uses strict PnP values)
"enfc03"   = "DEMNABSU"															// enforced creature 3 (uses strict PnP values)
"enfc04"   = "UDNABA"															  // enforced creature 4 (uses strict PnP values)
END																				// ends FUNCTION call
LAUNCH_PATCH_FUNCTION ~RR#MDCSC~												   // Starts FUNCTION call (aTweaks' Creature Script Modification function)
STR_VAR																			// Initialize strings
"newscript"  = "RR#HNABA"														  // new AI script
"script01"   = ""																  // first AI script name
"script02"   = "None"															  // second AI script name
"script03"   = "WTASIGHT"														  // third AI script name
"script04"   = "SUMTAN01"														  // fourth AI script name
"script05"   = "TANARI2"														   // fifth AI script name
"script06"   = "TANARI"															// sixth AI script name
"script07"   = "DEMNAB02"														  // seventh AI script name
"skipfile"   = "DEMNABSU"														  // skip script patching for a designated file
END																				// ends FUNCTION call
LAUNCH_PATCH_FUNCTION ~DELETE_CRE_EFFECT~										  // delete the EFF with the designated opcode
INT_VAR opcode_to_delete = "193" END											   // mark opcode #193 (Invisible Detection by Script) for deletion
LAUNCH_PATCH_FUNCTION ~ADD_CRE_EFFECT~											 // Starts FUNCTION call (add new creature effect built-in function)
INT_VAR
opcode = "300"																	 // effect: #300 (NPC Bump)
target = "1"																	   // target: 1 (self)
timing = "9"																	   // timing mode: 9 (permanent after death)
parameter2 = "1"																   // param2: 1 (constant value)
probability1 = "100"															   // probability1: 100%
STR_VAR
"effsource" = ""																   // effsource: none
END
PATCH_IF ("%SOURCE_RES%" STRING_EQUAL_CASE ~DEMNABSU~) BEGIN					   // special case, summoned Fiends now grant XP via script
WRITE_LONG  0x14 "0"															   // set new XP value
END
BUT_ONLY_IF_IT_CHANGES

Edited by aVENGER, 27 December 2009 - 04:54 AM.


#31 --agris--

--agris--
  • Guest

Posted 27 December 2009 - 08:49 AM

Not to change the (current) subject, but I really enjoy this part of aTweaks. Having different colored mephits / golems / etc is cool! Would there be a way to add the color opcode operation to creatures introduced by mods, as long as they use the standard bg2 models + animation sequences?

#32 aVENGER

aVENGER
  • Modder
  • 1680 posts

Posted 27 December 2009 - 09:42 AM

Sure, this method is applicable to any CRE file and, of course, the other mod authors are free to borrow any code from aTweaks for their own creatures. Alternatively, if someone could provide me with a list of filenames for any mod-added creatures that still need coloring, I'd be happy to include them in aTweaks' patching code.

However, this may become redundant soon with Infinity Animations coming along nicely. 8)

#33 --agris--

--agris--
  • Guest

Posted 27 December 2009 - 01:48 PM

Does each .CRE file contain a variable specifying what animation sequence is to be used with it? What about what "type" of creature it is? (I'm thinking whatever variable contains the information necessary for ranger's racial attack bonus to work)

If so, could weidu parse all the .CRE files, searching for all known combinations of those variable and associate it with the respective color scheme of that monster. (i.e. the pit fiend always uses DEMON023.whatever animation set and therefor has opcode ## applied to it) and apply your color code to creatures added by all mods, that don't use new animations? Some sort of check like:

IF(creature.type == demonic) && (animation_set == ITERATIVE_VAR)
apply opcode 52 to XXX.CRE

with ITERATIVE_VAR being a list of known animation sequences for the variable "type" when it is equal to, in this case, "demonic". Does that make sense? I don't know weidu so this is difficult to explain.

I'm just thinking of a way to automate it for creatures added by mods which use stock bg2 art. i.e a named pit fiend added by a mod uses no custom art, and could get the same coloring that you gave all the pit fiends in the un-modded game.

#34 aVENGER

aVENGER
  • Modder
  • 1680 posts

Posted 27 December 2009 - 02:03 PM

Does each .CRE file contain a variable specifying what animation sequence is to be used with it? What about what "type" of creature it is? (I'm thinking whatever variable contains the information necessary for ranger's racial attack bonus to work)


Well, it depends. In general, creatures that look the same use the same animation which can be identified as a string of numbers (i.e. all Mephits use the "IMP - 32515" animation) and usually have a similar "race" designation too. However, in this particular case, the tricky part would be determining exactly what type of a Mephit the creature is. It's possible to extrapolate some data from script names and such, but in general, it's not very accurate. That's why I think it might be easier for someone with a full Big World installation to simply parse through the CRE files via tp2 specifically designed to identify certain creatures based on various parameters and then manually compile a list from the relevant results.

I'm just thinking of a way to automate it for creatures added by mods which use stock bg2 art. i.e a named pit fiend added by a mod uses no custom art, and could get the same coloring that you gave all the pit fiends in the un-modded game.


I think Miloch is going to do just that with Infinity Animations. :)

#35 --agris--

--agris--
  • Guest

Posted 27 December 2009 - 02:18 PM

Ahh I see. I looked in the infinity animations forum but I have to admit, I didn't understand a lot of what was happening there. It looked like an "animation bank" for all bg2-engine converted animations, with a tp2 in testing for importing new creature animations, not coloring existing ones.

#36 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 27 December 2009 - 02:32 PM

If so, could weidu parse all the .CRE files, searching for all known combinations of those variable and associate it with the respective color scheme of that monster. (i.e. the pit fiend always uses DEMON023.whatever animation set and therefor has opcode ## applied to it) and apply your color code to creatures added by all mods, that don't use new animations? Some sort of check like:

IF(creature.type == demonic) && (animation_set == ITERATIVE_VAR)
apply opcode 52 to XXX.CRE

That WeiDU can but in most cases but that's not enough. The animation can be read from the creature file, as can the type(sort of) with this:
COPY_EXISTING_REGEXP GLOB ~.*\.cre~ ~override~
READ_BYTE ~0x0028~ ~anim~
...
And then comparing the ~anim~ etc. variables to the given functions.
But the problem comes with too many creature being the same with a few variables, and too much code to handle too many to get them all... so it's better to know their exact .cre names, and leave the few that have not been included, unchanged, and if new mods come, just request their authors to either copy the used code, or give aVENGER of the creature name they have made.

Deactivated account. The user today is known as The Imp.


#37 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 27 December 2009 - 02:57 PM

I looked in the infinity animations forum but I have to admit, I didn't understand a lot of what was happening there. It looked like an "animation bank" for all bg2-engine converted animations, with a tp2 in testing for importing new creature animations, not coloring existing ones.

It can also be used for making properly recoloured animations and giving the relevant creatures this animation. See here for a nabassu that doesn't look (as much) like a Christmas tree ornament (no offense aVENGER, it's not your fault, it's the opcode's :() and a unique pit fiend from NWN a few posts above it. We have no unique mephits but there are some from NWN I believe that could be ported, or the existing ones could probably be recolored fairly easy without getting glow-in-the-dark effects etc.

As for the list of creatures by animations, I already mentioned I had that or you can output it yourself from the Creature Lister in my signature. Here is the list from my "expert" BWP install, which you can sort by animation, creature name or whatever you want. After sorting, one can grab all relevant CREs and paste them into a WeiDU code template, doing batches of them in one foul swoop like the code I posted above. I wouldn't trust WeiDU to do it without looking at them first though, because many have incorrect animations to begin with on a BWP install.
Attached File  bwp_cres.rar   901.17K   353 downloads

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


#38 aVENGER

aVENGER
  • Modder
  • 1680 posts

Posted 27 December 2009 - 11:39 PM

It can also be used for making properly recoloured animations and giving the relevant creatures this animation. See here for a nabassu that doesn't look (as much) like a Christmas tree ornament (no offense aVENGER, it's not your fault, it's the opcode's :() and a unique pit fiend from NWN a few posts above it.


None taken. :) I know this coloring method is fairly crude, but back when I first coded it up, there was no way to add new animation slots i.e. Infinity Animations wasn't around yet. In fact, I think I'll probably depreciate this component as soon as Infinity Animations gets established as the mainstream standard.

As for the list of creatures by animations, I already mentioned I had that or you can output it yourself from the Creature Lister in my signature. Here is the list from my "expert" BWP install, which you can sort by animation, creature name or whatever you want.


Cheers, I'll take a look, but I think it might be better to leave this to you guys. We don't want to needlessly recolor CREs if they are getting a brand new avatar anyway. ;)

#39 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 28 December 2009 - 12:54 AM

In fact, I think I'll probably depreciate this component as soon as Infinity Animations gets established as the mainstream standard.

... you'll depreciate only the parts that would use the wrong animation before your changes, right. Cause I want Myself to be one of the uniquely recolored Mephits. Unless of course you wish to maintain the "Distinctive creature coloring" in "Infinity Animation" mod. ^_^
Edit, fixed so the Orc_Imp mind-interlink might work. ^_^

Edited by Jarno Mikkola, 28 December 2009 - 07:19 AM.

Deactivated account. The user today is known as The Imp.


#40 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 28 December 2009 - 06:13 AM

Unless of course you wish to maintain the "Recoloring portion of the Infinity Animation" mod.

There won't be such a component in Infinity Animations, because it takes only a bit longer to repalette existing animations (BG2 ones anyway) and assign them new slots. So this is probably the best place for any recolours that don't make it to that stage.

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