Mr.HiM Posted March 31, 2010 Share Posted March 31, 2010 Hi Guys, I have learnt some of the basic's by creating a new spell based on an existing spell and making that available in game, which was straight forward enough... however i wanted to go one step further and learn how to convert an existing monster ability into a player ability. I have got as far as making the script, ie the difficult bit, and have hit a snag.... i have copied the begining, the ability and main sections and deleted parts which seem to belong to other abilities in the script (See Below). What im after is for some to spot where im going wrong, im quick at picking things up, i have a big learning curve ahead of me. :) ------------------------------------------------------------------------------------------------------------------------------------------------------------------- #include "log_h"#include "abi_templates"#include "spell_constants_h"#include "talent_constants_h"#include "ability_summon_h"#include "plt_tut_modal"#include "plt_cod_aow_spellcombo7"#include "sys_traps_h"#include "monster_constants_h"#include "spell_constants_h" const int CUSTOM_SPELL2 = 777778; void _HandleImpact(struct EventSpellScriptImpactStruct stEvent){ // ------------------------------------------------------------------------- // VAR BLOCK // ------------------------------------------------------------------------- int nScalingVector = SCALING_VECTOR_DURATION; int nAttackingValue = PROPERTY_ATTRIBUTE_SPELLPOWER; int nResistance = RESISTANCE_INVALID; float fDuration = 0.0f; float fScaledValue = 0.0f; int nEffect = 0; int nHandler = SPELL_HANDLER_CUSTOM; effect eDamage; effect eEffect; effect[] eEffects; // make sure there is a location, just in case if (IsObjectValid(stEvent.oTarget) == TRUE) { stEvent.lTarget = GetLocation(stEvent.oTarget); } // ------------------------------------------------------------------------- // Handle Spells // ------------------------------------------------------------------------- switch (stEvent.nAbility) case CUSTOM_SPELL2: { Log_Trace_Spell("_ApplyImpactDamageAndEffects","MONSTER_REVENANT_PULL", stEvent.nAbility, stEvent.oTarget); effect eDamage = EffectDamage(MONSTER_REVENANT_PULL_DAMAGE_PER_LEVEL* GetLevel(stEvent.oCaster), DAMAGE_TYPE_SPIRIT); ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, eDamage, stEvent.oTarget); // force pull character forward effect ePull = EffectKnockdown(stEvent.oCaster, 0, ABILITY_TALENT_MONSTER_REVENANT_PULL); ePull = SetEffectEngineFloat(ePull, EFFECT_FLOAT_KNOCKBACK_DISTANCE, -0.5f); ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, ePull, stEvent.oTarget, 0.0f, stEvent.oCaster, stEvent.nAbility); ApplyEffectVisualEffect(stEvent.oCaster, stEvent.oTarget, 1050, EFFECT_DURATION_TYPE_INSTANT, 0.0, stEvent.nAbility); break; }} void main(){ event ev = GetCurrentEvent(); int nEventType = GetEventType(ev); switch(nEventType) { case EVENT_TYPE_SPELLSCRIPT_PENDING: { Ability_SetSpellscriptPendingEventResult(COMMAND_RESULT_SUCCESS); break; } case EVENT_TYPE_SPELLSCRIPT_CAST: { // Get a structure with the event parameters struct EventSpellScriptCastStruct stEvent = Events_GetEventSpellScriptCastParameters(ev); // Hand this through to cast_impact SetAbilityResult(stEvent.oCaster, stEvent.nResistanceCheckResult); break; } case EVENT_TYPE_SPELLSCRIPT_IMPACT: { // Get a structure with the event parameters struct EventSpellScriptImpactStruct stEvent = Events_GetEventSpellScriptImpactParameters(ev); Log_Trace(LOG_CHANNEL_COMBAT_ABILITY, GetCurrentScriptName() + ".EVENT_TYPE_SPELLSCRIPT_IMPACT",Log_GetAbilityNameById(stEvent.nAbility)); // Handle impact if (CheckSpellResistance(stEvent.oTarget, stEvent.oCaster, stEvent.nAbility) == FALSE) { _HandleImpact(stEvent); } else { UI_DisplayMessage(stEvent.oTarget, UI_MESSAGE_RESISTED); } break; } }} ------------------------------------------------------------------------------------------------------------------------------------------------------------------- Link to comment Share on other sites More sharing options...
Mr.HiM Posted March 31, 2010 Author Share Posted March 31, 2010 After saving the spell this is what i get in the logs when its complied... E: 13:35:48 - customclass_customspell2.nss - customclass_customspell2.nss(55): Break outside of loop or case statement (while compiling var_constants_h.nss) I found that if i add a bracket to line 55, which makes some amount of sense to me i get this error, i think there is some amount of code i need to adapt this further, but i need some help. E: 15:06:45 - blacktemplar_pull.nss - blacktemplar_pull.nss(61): Unknown state in compiler :( Link to comment Share on other sites More sharing options...
Mr.HiM Posted March 31, 2010 Author Share Posted March 31, 2010 THIS-------------------------------------------------------------------------------------------------------------------------------------------------------------------switch (stEvent.nAbility) case CUSTOM_SPELL2:{Log_Trace_Spell("_ApplyImpactDamageAndEffects","MONSTER_REVENANT_PULL", stEvent.nAbility, stEvent.oTarget); effect eDamage = EffectDamage(MONSTER_REVENANT_PULL_DAMAGE_PER_LEVEL* GetLevel(stEvent.oCaster), DAMAGE_TYPE_SPIRIT);ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, eDamage, stEvent.oTarget); // force pull character forwardeffect ePull = EffectKnockdown(stEvent.oCaster, 0, ABILITY_TALENT_MONSTER_REVENANT_PULL);ePull = SetEffectEngineFloat(ePull, EFFECT_FLOAT_KNOCKBACK_DISTANCE, -0.5f);ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, ePull, stEvent.oTarget, 0.0f, stEvent.oCaster, stEvent.nAbility);ApplyEffectVisualEffect(stEvent.oCaster, stEvent.oTarget, 1050, EFFECT_DURATION_TYPE_INSTANT, 0.0, stEvent.nAbility); break;}}------------------------------------------------------------------------------------------------------------------------------------------------------------------- INTO THIS------------------------------------------------------------------------------------------------------------------------------------------------------------------- switch (stEvent.nAbility) { case CUSTOM_SPELL2: { Log_Trace_Spell("_ApplyImpactDamageAndEffects","MONSTER_REVENANT_PULL", stEvent.nAbility, stEvent.oTarget); effect eDamage = EffectDamage(MONSTER_REVENANT_PULL_DAMAGE_PER_LEVEL* GetLevel(stEvent.oCaster), DAMAGE_TYPE_SPIRIT); ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, eDamage, stEvent.oTarget); // force pull character forward effect ePull = EffectKnockdown(stEvent.oCaster, 0, ABILITY_TALENT_MONSTER_REVENANT_PULL); ePull = SetEffectEngineFloat(ePull, EFFECT_FLOAT_KNOCKBACK_DISTANCE, -0.5f); ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, ePull, stEvent.oTarget, 0.0f, stEvent.oCaster, stEvent.nAbility); ApplyEffectVisualEffect(stEvent.oCaster, stEvent.oTarget, 1050, EFFECT_DURATION_TYPE_INSTANT, 0.0, stEvent.nAbility); break; }}------------------------------------------------------------------------------------------------------------------------------------------------------------------- Link to comment Share on other sites More sharing options...
Mr.HiM Posted March 31, 2010 Author Share Posted March 31, 2010 Wow the matching brace tool is useful, this is what i now have... it complies ok but if anyone could take a look at it that would be grand... im sure its no where near ready yet. Any thoughts guys? Cheers!! ------------------------------------------------------------------------------------------------------------------------------------------------------------------- #include "log_h"#include "abi_templates"#include "spell_constants_h"#include "talent_constants_h"#include "ability_summon_h"#include "plt_tut_modal"#include "plt_cod_aow_spellcombo7"#include "sys_traps_h"#include "monster_constants_h"#include "spell_constants_h" const int CUSTOM_SPELL2 = 777778; void _HandleImpact(struct EventSpellScriptImpactStruct stEvent){ // ------------------------------------------------------------------------- // VAR BLOCK // ------------------------------------------------------------------------- int nScalingVector = SCALING_VECTOR_DURATION; int nAttackingValue = PROPERTY_ATTRIBUTE_SPELLPOWER; int nResistance = RESISTANCE_INVALID; float fDuration = 0.0f; float fScaledValue = 0.0f; int nEffect = 0; int nHandler = SPELL_HANDLER_CUSTOM; effect eDamage; effect eEffect; effect[] eEffects; // make sure there is a location, just in case if (IsObjectValid(stEvent.oTarget) == TRUE) { stEvent.lTarget = GetLocation(stEvent.oTarget); } // ------------------------------------------------------------------------- // Handle Spells // ------------------------------------------------------------------------- switch (stEvent.nAbility) { case CUSTOM_SPELL2: { Log_Trace_Spell("_ApplyImpactDamageAndEffects","MONSTER_REVENANT_PULL", stEvent.nAbility, stEvent.oTarget); effect eDamage = EffectDamage(MONSTER_REVENANT_PULL_DAMAGE_PER_LEVEL* GetLevel(stEvent.oCaster), DAMAGE_TYPE_SPIRIT); ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, eDamage, stEvent.oTarget); // force pull character forward effect ePull = EffectKnockdown(stEvent.oCaster, 0, ABILITY_TALENT_MONSTER_REVENANT_PULL); ePull = SetEffectEngineFloat(ePull, EFFECT_FLOAT_KNOCKBACK_DISTANCE, -0.5f); ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, ePull, stEvent.oTarget, 0.0f, stEvent.oCaster, stEvent.nAbility); ApplyEffectVisualEffect(stEvent.oCaster, stEvent.oTarget, 1050, EFFECT_DURATION_TYPE_INSTANT, 0.0, stEvent.nAbility); break; }}} void main(){ event ev = GetCurrentEvent(); int nEventType = GetEventType(ev); switch(nEventType) { case EVENT_TYPE_SPELLSCRIPT_PENDING: { Ability_SetSpellscriptPendingEventResult(COMMAND_RESULT_SUCCESS); break; } case EVENT_TYPE_SPELLSCRIPT_CAST: { // Get a structure with the event parameters struct EventSpellScriptCastStruct stEvent = Events_GetEventSpellScriptCastParameters(ev); // Hand this through to cast_impact SetAbilityResult(stEvent.oCaster, stEvent.nResistanceCheckResult); break; } case EVENT_TYPE_SPELLSCRIPT_IMPACT: { // Get a structure with the event parameters struct EventSpellScriptImpactStruct stEvent = Events_GetEventSpellScriptImpactParameters(ev); Log_Trace(LOG_CHANNEL_COMBAT_ABILITY, GetCurrentScriptName() + ".EVENT_TYPE_SPELLSCRIPT_IMPACT",Log_GetAbilityNameById(stEvent.nAbility)); // Handle impact if (CheckSpellResistance(stEvent.oTarget, stEvent.oCaster, stEvent.nAbility) == FALSE) { _HandleImpact(stEvent); } else { UI_DisplayMessage(stEvent.oTarget, UI_MESSAGE_RESISTED); } break; } }}------------------------------------------------------------------------------------------------------------------------------------------------------------------- Link to comment Share on other sites More sharing options...
Mr.HiM Posted April 1, 2010 Author Share Posted April 1, 2010 Hi Guys, I have added all the files and scripts as per the dragon age wiki "adding spell", and although i can see the module is enabled in the downloadable content the command "runscript addtalent 777777" does nothing... i know the addtalent command works as i can add pre-existing spells but the new ones i made are not working at all. Here are the abibase and guitypes files if you wouldn't mind taking a look;http://i771.photobucket.com/albums/xx351/mrhim/guitypes.png http://i771.photobucket.com/albums/xx351/mrhim/AbiBase.png Any idea's? :confused: Link to comment Share on other sites More sharing options...
Mr.HiM Posted April 2, 2010 Author Share Posted April 2, 2010 I have made the changes above, disabled all other addin's and started with a new game in DAO and DAA and nothing... So for the moment i went back to basic's to see if there is something wrong... So i wanted to use something i knew that worked, so practically copied the full heal tutorial step by step to add the FULL_HEAL spell and just left everything the same and again this spell to does not appear in game... One thing came to mind... when you are creating the 'ABIBASE' file there are other workbooks in the excel file too, are these supposed to be deleted? :unsure: I cant see where im going wrong... Someone?!? Link to comment Share on other sites More sharing options...
Recommended Posts