Seamhainn Posted August 23, 2007 Share Posted August 23, 2007 Though I know that a Battle Meditation Force Power exists (though I did not find the mod yet), I want to create one by my own the hard way. I imagine the Power as follows: 1. I already have a new tga icon file for it, where the source was the Aura icon. 2. As Battle Meditation strengthens the resolve of ones friends and weakens the one of ones enemies, the Power should give the party a boost for Strength, Dexterity, and maybe Defence of +3. The enemies should be untouched, as I consider it to strong otherwise. I am not sure if that is to strong (or weak) as a Power and how high the cost should be. 3. The visual effect should be like Heal (or Cure - I don't know the right name of the Power, as I have onle the German version). Its the one were white lines/curves are around the party members. It would be great if the color could be changed (to blue or somesuch). I glanced over the explanations for stoffe's Soulburn Force Power, and as I understand it, the color can't be changed (or can be changed, but looks the changed way for all its accompanied Powers). Is that true? The source which I copied and modified from the tutorial is as follows. Though get error messages while compiling it (sorry, I don't know how to put the code in a proper box as it is costum): Mod note: Fixed code box. ~M int FORCE_POWER_BATTLE_MEDITATION = 132; // This variable must match the Row ID of your power in spells 2da, so change this to match your spells.2da void main() { /*****************************************/ /* STEP 1 - DECLARE THE VARIABLES NEEDED */ /*****************************************/ object oTarget = GetSpellTargetObject(); // This will set oTarget equal to who you cast the spell at // In this case it will be yourself effect eTargetVisual; // This variable will be used to set the visual effects effect eBuff; // This variable will be used to set the actual buff SWFP_HARMFUL = FALSE; // The variable SWFP_HARMFUL has already been declared in the include file // It is used by the signal event command to let the target know if this is // an attack spell or not. /************************************************** *******/ /* STEP 2 - REMOVE THE SPELL EFFECTS TO PREVENT STACKING */ /************************************************** *******/ // Check for and remove this power if the character is already under the effects // This is to prevent the power from stacking after multiple casting if(GetHasSpellEffect(FORCE_POWER_BATTLE_MEDITATION)) { Sp_RemoveSpellEffectsGeneral(FORCE_POWER_BATTLE_MEDITATION , oTarget); // This is a function call to one of Bioware's original scripts // it will check all of the effects oTarget has and remove them if they were // given by the Sith Rage power } /****************************************/ /* STEP 3 - SIGNAL THE SPELL CAST EVENT */ /****************************************/ // Signal SpellCast Trigger SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), SWFP_HARMFUL)); /**********************************/ /* STEP 4 - DETERMINE THE EFFECTS */ /**********************************/ // Set Character Icon Effect eBuff = SetEffectIcon(eBuff, 6); // This is the Force Armor Icon // A complete Listing of All Valid Icons is in the 2da File - effecticon.2da // Build Visual Effects // These are the visual effects that will be played when the spell is cast // A listing of all visual effects is in the 2da visualeffects eTargetVisual = EffectVisualEffect(VFX_PRO_FORCE_ARMOR); // Use the command EffectLinkEffects to merge multiple effects into one variable eTargetVisual = EffectLinkEffects(eTargetVisual, EffectVisualEffect(VFX_IMP_HEAL)); //Determine actual effects eBuff = EffectLinkEffects(eBuff, EffectAbilityIncrease(ABILITY_STRENGTH, 3)); eBuff = EffectLinkEffects(eBuff, EffectAbilityIncrease(ABILITY_DEXTERITY, 3)); /******************************/ /* STEP 5 - APPLY THE EFFECTS */ /******************************/ //Apply Visual Effects - they will last 3 seconds ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eTargetVisual, oTarget, 3.0); //Apply Icon and Buff - the buff will last 60 seconds ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBuff, oTarget, 60.0); } I get the following error messages: Compiling: k_sp1_battle.nss k_sp1_battle.nss(21): Error: Undeclared identifier "SWFP_HARMFUL" k_sp1_battle.nss(33): Error: Undeclared identifier "Sp_RemoveSpellEffectsGeneral " k_sp1_battle.nss(43): Error: Undeclared identifier "SWFP_HARMFUL" Compilation aborted with errors Total Execution time = 78 ms Thanks and take care, Link to comment Share on other sites More sharing options...
stoffe Posted August 23, 2007 Share Posted August 23, 2007 It would be great if the color could be changed (to blue or somesuch). I glanced over the explanations for stoffe's Soulburn Force Power, and as I understand it, the color can't be changed (or can be changed, but looks the changed way for all its accompanied Powers). Is that true? You should be able to do a reskinned variant of the heal visual effect since it uses a model, v_heal_imp.mdl, for its pretty lights. To do this could make a copy of line 1019 in visualeffects.2da and change the value of your new line in the imp_root_m_node column to the name of a custom MDL file. Then extract v_heal_imp.mdl from models.bif with KotorTool, rename it to what you set in visualeffects.2da above. Open it with a hex editor and locate the names of any textures it uses. Extract those textures with KotorTool, rename them (the new name should contain exactly the same number of characters as the old one), overwrite the old texture name with the new one in the MDL file with the hex editor. Then reskin the renamed textures as you want them, and put all of it in the override folder. Finally, modify your script and replace VFX_IMP_HEAL with the row label of the new line you copied into visualeffects.2da, to make your power use your new visual instead. I get the following error messages: Compiling: k_sp1_battle.nss k_sp1_battle.nss(21): Error: Undeclared identifier "SWFP_HARMFUL" k_sp1_battle.nss(33): Error: Undeclared identifier "Sp_RemoveSpellEffectsGeneral " k_sp1_battle.nss(43): Error: Undeclared identifier "SWFP_HARMFUL" Compilation aborted with errors Total Execution time = 78 ms Those are caused by attempting to use an undeclared function and global variable. The SWFP_HARMFUL global and Sp_RemoveSpellEffectsGeneral() function are declared in the k_inc_force.nss include file. If you add #include "k_inc_force" at the top the compile errors should go away. However, since you are only using the function that strips existing effects originating from the same power, and nothing else, from this include file you might as well save yourself some bloat and just copy that particular function to your script. Though your script would only apply the buffs to the caster, not to any nearby friends. To do the latter you will need to, if used by a party member, loop through present party members and apply the effects them as well, or, if used by an NPC, loop through nearby friendlies and apply the buff to them. Here is a variant of your script that does this, I've added a bunch of code comments to it to hopefully make it easier to read. Feel free to ask if anything is unclear. [color=PaleGreen]// Forward declarations of functions implemented below[/color] void Sp_RemoveSpellEffectsGeneral(int nSpell_ID, object oTarget); void ST_ApplyBuff(object oTarget, effect eBuff); [color=PaleGreen]// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[/color] [color=PaleGreen]// Main function, do the force power impact effects[/color] [color=PaleGreen]// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[/color] void main() { [color=PaleGreen]//Create buff effects[/color] effect eBuff = EffectLinkEffects( EffectAbilityIncrease(ABILITY_STRENGTH, 3), EffectAbilityIncrease(ABILITY_DEXTERITY, 3)); eBuff = SetEffectIcon(eBuff, 6); [color=PaleGreen]// The force user is a party member, apply to the player party.[/color] if (IsObjectPartyMember(OBJECT_SELF)) { int i; [color=PaleGreen]// Loop through all party members present and buff them![/color] for (i = 0; i < GetPartyMemberCount(); i++) { object oTarget = GetPartyMemberByIndex(i); ST_ApplyBuff(oTarget, eBuff); } } [color=PaleGreen]// The force user is NOT a party member. Apply to all nearby with the same faction as me.[/color] else { int iMyFac = GetStandardFaction(OBJECT_SELF); location lLoc = GetLocation(OBJECT_SELF); [color=PaleGreen]// Find the first creature within a 10m radius.[/color] object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, lLoc); [color=PaleGreen]// Loop through all nearby creatures within a 10m radius.[/color] while (GetIsObjectValid(oTarget)) { [color=PaleGreen]// If this creature is in the same faction as me, buff them![/color] if (GetIsFriend(oTarget) && (GetStandardFaction(oTarget) == iMyFac)) { ST_ApplyBuff(oTarget, eBuff); } [color=PaleGreen]// Find the next creature within the 10m radius.[/color] oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, lLoc); } } } [color=PaleGreen]// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[/color] [color=PaleGreen]// Support function, apply buffs and visual effects to target[/color] [color=PaleGreen]// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[/color] void ST_ApplyBuff(object oTarget, effect eBuff) { [color=PaleGreen]// Get spells.2da line number of the power used.[/color] int iID = GetSpellId(); [color=PaleGreen]// Remove existing effects from this power, it should not stack if re-cast.[/color] if(GetHasSpellEffect( iID )) { Sp_RemoveSpellEffectsGeneral( iID, oTarget ); } [color=PaleGreen]// Signal SpellCast event on target[/color] SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, iID, FALSE)); [color=PaleGreen]// Apply visuals, they are Fire & Forget, thus no duration can be set[/color] ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_PRO_FORCE_ARMOR), oTarget); ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_HEAL), oTarget); [color=PaleGreen]//Apply Icon and Buff - the buff will last 60 seconds[/color] ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBuff, oTarget, 60.0); } [color=PaleGreen]// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[/color] [color=PaleGreen]// Copied from k_inc_force.nss - remove effects originating from a[/color] [color=PaleGreen]// particular force power.[/color] [color=PaleGreen]// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[/color] void Sp_RemoveSpellEffectsGeneral(int nSpell_ID, object oTarget) { int bValid = FALSE; effect eAOE; [color=PaleGreen]// Check if the target has any effects from the specified power[/color] if(GetHasSpellEffect(nSpell_ID, oTarget)) { [color=PaleGreen]//Search through the valid effects on the target.[/color] eAOE = GetFirstEffect(oTarget); while (GetIsEffectValid(eAOE) && bValid == FALSE) { [color=PaleGreen]//If the effect was created by the spell then remove it[/color] if(GetEffectSpellId(eAOE) == nSpell_ID) { RemoveEffect(oTarget, eAOE); bValid = TRUE; } [color=PaleGreen]//Get next effect on the target[/color] eAOE = GetNextEffect(oTarget); } } } Link to comment Share on other sites More sharing options...
Seamhainn Posted August 24, 2007 Author Share Posted August 24, 2007 You should be able to do a reskinned variant of the heal visual effect since it uses a model, v_heal_imp.mdl, for its pretty lights. To do this could make a copy of line 1019 in visualeffects.2da and change the value of your new line in the imp_root_m_node column to the name of a custom MDL file. I did that. Then extract v_heal_imp.mdl from models.bif with KotorTool, rename it to what you set in visualeffects.2da above. Open it with a hex editor and locate the names of any textures it uses. Extract those textures with KotorTool, rename them (the new name should contain exactly the same number of characters as the old one), overwrite the old texture name with the new one in the MDL file with the hex editor. Then reskin the renamed textures as you want them, and put all of it in the override folder. I don't have a hex editor. which one should I use? A reskin must be done with Photoshop or somesuch? Finally, modify your script and replace VFX_IMP_HEAL with the row label of the new line you copied into visualeffects.2da, to make your power use your new visual instead. That all sounds easy, except for an absolut beginner like me... Snip... Here is a variant of your script that does this, I've added a bunch of code comments to it to hopefully make it easier to read. Feel free to ask if anything is unclear. Snip... I understand everything more or less. Compiling worked like a charm. Though I not only got a ncs but also a ndb file what is it used for? The mod should work without the modified visual effect, and I will try it out at home this weekend. As I toyed with 2da files, you mentioned that I should use a patcher to install the files into override. Where can I find one and a tutorial to use it? If I want to add explanatory lines in dialog.tlk for Battle Meditation, I assume it is not possibile to patch those lines? And as dialog.tlk is quite big it forbits sharing it by itself. Thanks for your great help! Link to comment Share on other sites More sharing options...
Wedge Suron Posted August 25, 2007 Share Posted August 25, 2007 I'ts a feat in K1 and a power in TSL Link to comment Share on other sites More sharing options...
stoffe Posted August 25, 2007 Share Posted August 25, 2007 I don't have a hex editor. which one should I use? A reskin must be done with Photoshop or somesuch? I'm using UltraEdit but any hex editor should work, there are probably a whole bunch of free ones available. Check on http://www.download.com. The names of the textures usually start with fx_ in that type of model. If you have Photoshop you can use that for reskinning. If you don't you can use Gimp instead, it's a free image manipulation program that's pretty decent. I understand everything more or less. Compiling worked like a charm. Though I not only got a ncs but also a ndb file what is it used for? NDB files are script debugger data files. They aren't used by the game itself for anything so you can just throw them away. Newer versions of the script compiler adapted for use with KOTOR don't tend to generate them at all. As I toyed with 2da files, you mentioned that I should use a patcher to install the files into override. Where can I find one and a tutorial to use it? If I want to add explanatory lines in dialog.tlk for Battle Meditation, I assume it is not possibile to patch those lines? And as dialog.tlk is quite big it forbits sharing it by itself. If you want to release your mod and make it easier for others to install and make it compatible with other mods it may be a good idea to use a mod installer. It can add new lines to 2DA files that already exist in the override folder of the user, and append new entries to their dialog.tlk file, among other things. Link to comment Share on other sites More sharing options...
Seamhainn Posted August 25, 2007 Author Share Posted August 25, 2007 Where can I find the installer? Link to comment Share on other sites More sharing options...
Ghost Down Posted August 25, 2007 Share Posted August 25, 2007 Here you go Click me! - Ghost Down Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.