Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.02 KB | None | 0 0
  1. /*
  2. Rasael
  3. -custom summon code
  4. -supports multiple summons at the same time
  5. -supports custom summon AI
  6. -supports buffing summons
  7. -supports dismissing summons manually
  8. -supports dispelling summons
  9. -Better graphics than default system
  10. -Centralized include, easy to edit.
  11. */
  12.  
  13. #include "hench_i0_hensho"
  14. #include "nwnx_clock"
  15.  
  16. void ApplySizeIncrease(object oTarget, float fSizeIncrease )
  17. {
  18. effect eScale = EffectSetScale(fSizeIncrease);
  19. eScale = SupernaturalEffect(eScale);
  20. ApplyEffectToObject(DURATION_TYPE_PERMANENT, eScale, oTarget);
  21. }
  22.  
  23. void ApplyGood(object oTarget)
  24. {
  25. effect eVis = EffectNWN2SpecialEffectFile("fx_succubus_eyes", oTarget); //yellow eyes
  26. effect eVis2 = EffectNWN2SpecialEffectFile("fx_defaultitem_holy", oTarget); //holy radiance
  27.  
  28. ApplyEffectToObject(2, SupernaturalEffect(eVis), oTarget, 0.0f);
  29. ApplyEffectToObject(2, SupernaturalEffect(eVis2), oTarget, 0.0f);
  30.  
  31. SetSubRace(oTarget, "Outsider");
  32. FeatAdd(oTarget, FEAT_WEAPON_PROFICIENCY_MARTIAL, FALSE, FALSE, FALSE);
  33. FeatAdd(oTarget, FEAT_WEAPON_PROFICIENCY_EXOTIC, FALSE, FALSE, FALSE);
  34.  
  35. DelayCommand(1.5f, AssignCommand(oTarget, ActionEquipMostDamagingMelee(OBJECT_INVALID, FALSE)));
  36.  
  37. effect eImmuneToNonMagicWeapons = EffectDamageReduction(1, DAMAGE_POWER_PLUS_ONE, 0, DR_TYPE_MAGICBONUS);
  38. eImmuneToNonMagicWeapons = SupernaturalEffect(eImmuneToNonMagicWeapons);
  39.  
  40. ApplyEffectToObject(DURATION_TYPE_PERMANENT, eImmuneToNonMagicWeapons, oTarget);
  41. }
  42.  
  43. void ApplyEvil(object oTarget)
  44. {
  45. effect eVis = EffectNWN2SpecialEffectFile("fx_wraith_eyes", oTarget); //red eyes
  46. effect eVis2 = EffectNWN2SpecialEffectFile("zombie_disease", oTarget); //vile skin
  47.  
  48. ApplyEffectToObject(2, SupernaturalEffect(eVis), oTarget, 0.0f);
  49. ApplyEffectToObject(2, SupernaturalEffect(eVis2), oTarget, 0.0f);
  50.  
  51. SetSubRace(oTarget, "Outsider");
  52. FeatAdd(oTarget, FEAT_WEAPON_PROFICIENCY_MARTIAL, FALSE, FALSE, FALSE);
  53. FeatAdd(oTarget, FEAT_WEAPON_PROFICIENCY_EXOTIC, FALSE, FALSE, FALSE);
  54.  
  55. DelayCommand(1.5f, AssignCommand(oTarget, ActionEquipMostDamagingMelee(OBJECT_INVALID, FALSE)));
  56.  
  57. effect eImmuneToNonMagicWeapons = EffectDamageReduction(1, DAMAGE_POWER_PLUS_ONE, 0, DR_TYPE_MAGICBONUS);
  58. eImmuneToNonMagicWeapons = SupernaturalEffect(eImmuneToNonMagicWeapons);
  59.  
  60. ApplyEffectToObject(DURATION_TYPE_PERMANENT, eImmuneToNonMagicWeapons, oTarget);
  61. }
  62.  
  63. void ApplySpirit(object oTarget)
  64. {
  65. effect eVis = EffectNWN2SpecialEffectFile("fx_erinyes_eyes", oTarget); //blue eyes
  66. effect eVis2 = EffectNWN2SpecialEffectFile("fx_telthor_s", oTarget); //spirit visual
  67.  
  68. ApplyEffectToObject(2, SupernaturalEffect(eVis), oTarget, 0.0f);
  69. ApplyEffectToObject(2, SupernaturalEffect(eVis2), oTarget, 0.0f);
  70.  
  71. SetSubRace(oTarget, "Outsider");
  72. SetLocalInt(oTarget, "X2_L_IS_INCORPOREAL", TRUE); //won't do anything, already past spawning.
  73. //X2_L_IS_INCORPOREAL: will maybe work with GetIsSpirit so Spirit Shamans abilities work
  74. //If not then we say that summoning magic prevents those abilities from working.
  75.  
  76. effect eConceal = EffectConcealment(10, MISS_CHANCE_TYPE_NORMAL);
  77. eConceal = SupernaturalEffect(eConceal);
  78. effect eGhost = EffectCutsceneGhost();
  79. eGhost = SupernaturalEffect(eGhost);
  80.  
  81. ApplyEffectToObject(DURATION_TYPE_PERMANENT, eConceal, oTarget);
  82. ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGhost, oTarget);
  83. }
  84.  
  85. void ApplyShadow(object oTarget)
  86. {
  87. effect eVis = EffectVisualEffect(VFX_DUR_SPELL_SHADOW_SIMULACRUM);
  88. ApplyEffectToObject(2, SupernaturalEffect(eVis), oTarget, 0.0f);
  89.  
  90. SetLocalInt(oTarget, "X2_L_IS_INCORPOREAL", TRUE); //won't do anything, already past spawning.
  91. //X2_L_IS_INCORPOREAL: will maybe work with GetIsSpirit so Spirit Shamans abilities work
  92. //If not then we say that summoning magic prevents those abilities from working.
  93.  
  94. effect eConceal = EffectConcealment(50, MISS_CHANCE_TYPE_NORMAL);
  95. eConceal = SupernaturalEffect(eConceal);
  96. effect eGhost = EffectCutsceneGhost();
  97. eGhost = SupernaturalEffect(eGhost);
  98.  
  99. ApplyEffectToObject(DURATION_TYPE_PERMANENT, eConceal, oTarget);
  100. ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGhost, oTarget);
  101. }
  102.  
  103. void AttackNearest(object oSummon, location lSummon, object oCaster)
  104. {
  105. /*
  106. AssignCommand(oSummon, HenchResetHenchmenState());
  107. SetAssociateState(NW_ASC_MODE_DEFEND_MASTER, FALSE, oSummon);
  108. SetAssociateState(NW_ASC_MODE_STAND_GROUND, FALSE, oSummon);
  109.  
  110. object oNearest = GetFirstObjectInShape(SHAPE_SPHERE, 24.0f, lSummon, FALSE, OBJECT_TYPE_CREATURE);
  111. int nLoop;
  112. while(GetIsObjectValid(oNearest) == TRUE && nLoop < 15)
  113. {
  114. if(GetIsEnemy(oCaster, oNearest) == TRUE || GetIsReactionTypeHostile(oCaster, oNearest) == TRUE)
  115. {
  116. AssignCommand(oSummon, ClearAllActions());
  117. AssignCommand(oSummon, ActionAttack(oNearest, FALSE));
  118. return;
  119. }
  120.  
  121. nLoop = nLoop + 1;
  122. oNearest = GetNextObjectInShape(SHAPE_SPHERE, 24.0f, lSummon, FALSE, OBJECT_TYPE_CREATURE);
  123. }
  124. */
  125. }
  126.  
  127. int SUMMON_DOMINATE = 66633459;
  128.  
  129. #include "cmi_ginc_spells"
  130. #include "nw_i0_spells"
  131.  
  132.  
  133. void RemoveSummon(object oSummon)
  134. {
  135. if(GetIsObjectValid(oSummon) == FALSE) {return;}
  136.  
  137. SetPlotFlag(oSummon, FALSE);
  138. RemoveEffectsFromSpell(oSummon, SUMMON_DOMINATE);
  139. ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectCutsceneImmobilize(), oSummon);
  140. DestroyObject(oSummon, 1.5f, FALSE);
  141.  
  142. int iVis = VFX_IMP_UNSUMMON;
  143. string iVisualOverride = GetLocalString(oSummon, "dismissal_vfx1");
  144. string iVisualOverride2 = GetLocalString(oSummon, "dismissal_vfx2");
  145. location lSummon = GetLocation(oSummon);
  146.  
  147. if(iVisualOverride == "")
  148. {ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(iVis), lSummon);}
  149. else
  150. {ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectNWN2SpecialEffectFile(iVisualOverride, oSummon, GetPositionFromLocation(lSummon)), lSummon);}
  151.  
  152. if(iVisualOverride2 != "")
  153. {ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectNWN2SpecialEffectFile(iVisualOverride2, oSummon, GetPositionFromLocation(lSummon)), lSummon);}
  154. }
  155.  
  156. void BladeDance(object oCaster, object oBlade, object oItem)
  157. {
  158. if(GetIsObjectValid(oCaster) == FALSE || GetIsObjectValid(oBlade) == FALSE)
  159. return;
  160.  
  161. if(GetArea(oBlade) == OBJECT_INVALID)
  162. {DelayCommand(12.0f, BladeDance(oCaster, oBlade, oItem)); return;}
  163.  
  164. if(GetArea(oCaster) == OBJECT_INVALID)
  165. {DelayCommand(12.0f, BladeDance(oCaster, oBlade, oItem)); return;}
  166.  
  167. object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oCaster);
  168. if(oWeapon == oItem)
  169. {
  170. SendMessageToPC(oCaster, "<color=white>*Bladedance: Expired - Weapon equipped by caster*");
  171. return;
  172. }
  173.  
  174. DelayCommand(6.0f, BladeDance(oCaster, oBlade, oItem));
  175. }
  176.  
  177. void Control(object oMaster, string sSpellName, float fDuration, string sBlueprint, location lTarget, int iCompetative = FALSE, int iNoSummon = FALSE, int iID = -1)
  178. {
  179. object oMislead = GetAssociate(ASSOCIATE_TYPE_SUMMONED, oMaster);
  180. PlayCustomAnimation(oMislead, "standupB", 0, 1.3f);
  181.  
  182. int iCL = GetLocalInt(oMaster, "mislead_casterlevel");
  183. object oCaster = GetLocalObject(oMaster, "caster");
  184.  
  185. int nChoice;
  186. int nTime = GetUNIXTime();
  187.  
  188. SetIsTemporaryFriend(oMaster, oCaster, FALSE, 20000.0f);
  189. SetIsTemporaryFriend(oCaster, oMaster, FALSE, 20000.0f);
  190.  
  191. SetLocalInt(oMislead, "mislead_casterlevel", iCL);
  192. SetLocalObject(oMislead, "mislead_master", oCaster);
  193. SetLocalObject(oMislead, "mislead_summoner", oMaster);
  194. SetLocalObject(oMaster, "mislead_summon", oMislead);
  195. SetLocalString(oMislead, "dismissal_vfx1", "sp_evocation_aoe");
  196. SetLocalString(oMislead, "dismissal_vfx2", "fx_ritual_conjure");
  197.  
  198. if(fDuration > 0.0f)
  199. SetLocalInt(oMislead, "mislead_endtime", nTime + FloatToInt(fDuration));
  200.  
  201. string sNewTag = ObjectToString(oCaster)+sSpellName;
  202. SetTag(oMislead, sNewTag);
  203.  
  204. if(sBlueprint == "cmi_phantbear" || sBlueprint == "cmi_phantwolf" || sBlueprint == "bg_revenanta" || sBlueprint == "bg_revenantb")
  205. ApplyPhantomStats(oMaster);
  206. else if(sBlueprint == "bg_spir_weapon")
  207. ExecuteScript ("bg_spell_spirit_weapon1", oMislead);
  208. else if(sBlueprint == "c_ghoul_pm_crt_undead" || sBlueprint == "c_ghast_pm_crt_undead" || sBlueprint == "c_mummy_pm_crt_undead" || sBlueprint == "c_s_mummy_pm_crt_undead")
  209. {
  210. string sScript = GetLocalString(oCaster,"X2_S_PM_SPECIAL_ITEM");
  211.  
  212. if (sScript != "")
  213. ExecuteScript (sScript, oMislead);
  214. }
  215.  
  216. if(iNoSummon == FALSE)
  217. SetLocalInt(oMislead, "summon", TRUE);
  218.  
  219. //if(nTime == 0 && fDuration > 0.0f) //singleplayer only
  220. // {AssignCommand(oMislead, DelayCommand(fDuration, RemoveSummon(oMislead)));}
  221.  
  222. //SetEventHandler(oMislead, 10, "bg_illusion_die");
  223. //DelayCommand(2.0f, SetEventHandler(oMaster, 0, "bg_illusion_remove")); //heartbeat of master, kills himself when summon is gone
  224.  
  225. if(iID == 63) //gate
  226. {
  227. nChoice = GetLocalInt(oCaster, "BGC_"+IntToString(iID));
  228. if(nChoice > 0)
  229. {
  230. if(nChoice == 7) {SetFirstName(oMislead, "Angel"); ApplyGood(oMislead); AdjustAlignment(oMislead, ALIGNMENT_GOOD, 100);}
  231.  
  232. else if(nChoice == 105) {SetFirstName(oMislead, "Night Hag"); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100);}
  233. else if(nChoice == 107) {SetFirstName(oMislead, "Xorn"); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100);}
  234.  
  235. else if(nChoice == 201) {SetFirstName(oMislead, "Succubus"); ApplyEvil(oMislead); AdjustAlignment(oMislead, ALIGNMENT_EVIL, 100);}
  236. else if(nChoice == 202) {SetFirstName(oMislead, "Hezrou"); ApplyEvil(oMislead); AdjustAlignment(oMislead, ALIGNMENT_EVIL, 100);}
  237. else if(nChoice == 203) {SetFirstName(oMislead, "Balor"); ApplyEvil(oMislead); AdjustAlignment(oMislead, ALIGNMENT_EVIL, 100);}
  238.  
  239. else if(nChoice == 301) {SetFirstName(oMislead, "Erinyes"); ApplyEvil(oMislead); AdjustAlignment(oMislead, ALIGNMENT_EVIL, 100);}
  240. else if(nChoice == 302) {SetFirstName(oMislead, "Horned Devil"); ApplyEvil(oMislead); AdjustAlignment(oMislead, ALIGNMENT_EVIL, 100);}
  241. else if(nChoice == 303) {SetFirstName(oMislead, "Pit Fiend"); ApplyEvil(oMislead); AdjustAlignment(oMislead, ALIGNMENT_EVIL, 100);}
  242. }
  243. }
  244.  
  245. else if(iID == 476) //summon shadow
  246. {
  247. ApplyShadow(oMislead); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100);
  248. }
  249.  
  250. else if(iID == 69 || iID == 96 || iID == 451
  251. || iID == 128) //planar binding
  252. {
  253. nChoice = GetLocalInt(oCaster, "BGC_"+IntToString(iID));
  254. if(nChoice > 0)
  255. {
  256. //GOOD
  257. if(nChoice == 1) {SetCreatureAppearanceType(oMislead, 2326); SetFirstName(oMislead, "Celestial Lion"); ApplyGood(oMislead); AdjustAlignment(oMislead, ALIGNMENT_GOOD, 100); ApplySizeIncrease(oMislead,3.0);}
  258. else if(nChoice == 2) {SetCreatureAppearanceType(oMislead, 37); SetFirstName(oMislead, "Celestial Stag"); ApplyGood(oMislead); AdjustAlignment(oMislead, ALIGNMENT_GOOD, 100); ApplySizeIncrease(oMislead,3.0);}
  259. else if(nChoice == 3) {SetCreatureAppearanceType(oMislead, 1055); SetFirstName(oMislead, "Celestial Wolf"); ApplyGood(oMislead); AdjustAlignment(oMislead, ALIGNMENT_GOOD, 100); ApplySizeIncrease(oMislead,1.0);}
  260. else if(nChoice == 4) {SetCreatureAppearanceType(oMislead, 1053); SetFirstName(oMislead, "Celestial Bear"); ApplyGood(oMislead); AdjustAlignment(oMislead, ALIGNMENT_GOOD, 100); ApplySizeIncrease(oMislead,1.0);}
  261. else if(nChoice == 5) {SetCreatureAppearanceType(oMislead, 1061); SetFirstName(oMislead, "Celestial Dire Bear"); ApplyGood(oMislead); AdjustAlignment(oMislead, ALIGNMENT_GOOD, 100); ApplySizeIncrease(oMislead,1.0);}
  262.  
  263. //NEUTRAL
  264. else if(nChoice == 100) {SetFirstName(oMislead, "Fire Mephit"); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); ApplySizeIncrease(oMislead,1.0);}
  265. else if(nChoice == 101) {SetFirstName(oMislead, "Ice Mephit"); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); ApplySizeIncrease(oMislead,1.0);}
  266. else if(nChoice == 102) {SetFirstName(oMislead, "Sylph"); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); ApplySizeIncrease(oMislead,1.0);}
  267. else if(nChoice == 103) {SetFirstName(oMislead, "Djinn"); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); ApplySizeIncrease(oMislead,1.0);}
  268. else if(nChoice == 104) {SetCreatureAppearanceType(oMislead, 1303); SetFirstName(oMislead, "Gibberling"); AdjustAlignment(oMislead, ALIGNMENT_CHAOTIC, 100); ApplySizeIncrease(oMislead,1.0);}
  269. else if(nChoice == 106) {SetFirstName(oMislead, "Shadow Mastiff"); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); ApplySizeIncrease(oMislead,1.0);}
  270.  
  271. //Demon
  272. else if(nChoice == 201) {SetFirstName(oMislead, "Succubus"); ApplyEvil(oMislead); AdjustAlignment(oMislead, ALIGNMENT_EVIL, 100); ApplySizeIncrease(oMislead,1.0);}
  273. else if(nChoice == 202) {SetFirstName(oMislead, "Hezrou"); ApplyEvil(oMislead); AdjustAlignment(oMislead, ALIGNMENT_EVIL, 100); ApplySizeIncrease(oMislead,1.0);}
  274.  
  275. //Devil
  276. else if(nChoice == 300) {SetFirstName(oMislead, "Imp"); ApplyEvil(oMislead); AdjustAlignment(oMislead, ALIGNMENT_EVIL, 100); ApplySizeIncrease(oMislead,1.0);}
  277. else if(nChoice == 301) {SetFirstName(oMislead, "Erinyes"); ApplyEvil(oMislead); AdjustAlignment(oMislead, ALIGNMENT_EVIL, 100); ApplySizeIncrease(oMislead,1.0);}
  278. else if(nChoice == 302) {SetFirstName(oMislead, "Horned Devil"); ApplyEvil(oMislead); AdjustAlignment(oMislead, ALIGNMENT_EVIL, 100); ApplySizeIncrease(oMislead,1.0);}
  279. else if(nChoice == 304) {SetFirstName(oMislead, "Hell Hound"); ApplyEvil(oMislead); AdjustAlignment(oMislead, ALIGNMENT_EVIL, 100); ApplySizeIncrease(oMislead,1.0);}
  280. }
  281. }
  282.  
  283. else if(iID == 174 || iID == 175 || iID == 176
  284. || iID == 177 || iID == 179 || iID == 180
  285. || iID == 181 || iID == 182 || iID == 178 ) //summon Cr
  286. {
  287. nChoice = GetLocalInt(oCaster, "BGC_"+IntToString(iID));
  288. if(nChoice > 0)
  289. {
  290. //nature
  291. if(nChoice == 13) {SetCreatureAppearanceType(oMislead, 181); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Wolf"); ApplySizeIncrease(oMislead,1.0);}
  292. else if(nChoice == 1) {SetCreatureAppearanceType(oMislead, 175); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Dire Wolf"); ApplySizeIncrease(oMislead,1.0);}
  293. else if(nChoice == 2) {SetCreatureAppearanceType(oMislead, 387); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Dire Rat"); ApplySizeIncrease(oMislead,1.0);}
  294. else if(nChoice == 3) {SetCreatureAppearanceType(oMislead, 37); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Stag"); ApplySizeIncrease(oMislead,1.0);}
  295. else if(nChoice == 4) {SetCreatureAppearanceType(oMislead, 499); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Rabbit"); ApplySizeIncrease(oMislead,1.0);}
  296. else if(nChoice == 5) {SetCreatureAppearanceType(oMislead, 503); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Weasel"); ApplySizeIncrease(oMislead,1.0);}
  297. else if(nChoice == 6) {SetCreatureAppearanceType(oMislead, 159); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Giant Spider"); ApplySizeIncrease(oMislead,1.0);}
  298. else if(nChoice == 7) {SetCreatureAppearanceType(oMislead, 2326); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Lion"); ApplySizeIncrease(oMislead,1.0);}
  299. else if(nChoice == 8) {SetCreatureAppearanceType(oMislead, 1502); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Snake"); ApplySizeIncrease(oMislead,1.0);}
  300. else if(nChoice == 9) {SetCreatureAppearanceType(oMislead, 13); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Brown Bear"); ApplySizeIncrease(oMislead,1.0);}
  301. else if(nChoice == 10) {SetCreatureAppearanceType(oMislead, 9); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Dire Badger"); ApplySizeIncrease(oMislead,1.0);}
  302. else if(nChoice == 11) {SetCreatureAppearanceType(oMislead, 10); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Bat"); ApplySizeIncrease(oMislead,1.0);}
  303. else if(nChoice == 12) {SetCreatureAppearanceType(oMislead, 21); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Boar"); ApplySizeIncrease(oMislead,1.0);}
  304. else if(nChoice == 14) {SetCreatureAppearanceType(oMislead, 15); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Dire Bear"); ApplySizeIncrease(oMislead,1.0);}
  305. else if(nChoice == 15) {SetCreatureAppearanceType(oMislead, 22); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Dire Boar"); ApplySizeIncrease(oMislead,1.0);}
  306.  
  307. //astral
  308. else if(nChoice == 100) {SetCreatureAppearanceType(oMislead, 10); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Bat Spirit"); ApplySpirit(oMislead); ApplySizeIncrease(oMislead,1.0);}
  309. else if(nChoice == 101) {SetCreatureAppearanceType(oMislead, 181); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Wolf Spirit"); ApplySpirit(oMislead); ApplySizeIncrease(oMislead,1.0);}
  310. else if(nChoice == 102) {SetCreatureAppearanceType(oMislead, 37); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Stag Spirit"); ApplySpirit(oMislead); ApplySizeIncrease(oMislead,1.0);}
  311. else if(nChoice == 103) {SetCreatureAppearanceType(oMislead, 2326); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Lion Spirit"); ApplySpirit(oMislead); ApplySizeIncrease(oMislead,1.0);}
  312. else if(nChoice == 104) {SetCreatureAppearanceType(oMislead, 159); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Spider Spirit"); ApplySpirit(oMislead); ApplySizeIncrease(oMislead,1.0);}
  313. else if(nChoice == 105) {SetCreatureAppearanceType(oMislead, 1062); AdjustAlignment(oMislead, ALIGNMENT_NEUTRAL, 100); SetFirstName(oMislead, "Ant Spirit"); ApplySpirit(oMislead); ApplySizeIncrease(oMislead,1.0);}
  314.  
  315. //celestial
  316. else if(nChoice == 200) {SetCreatureAppearanceType(oMislead, 8); AdjustAlignment(oMislead, ALIGNMENT_GOOD, 100); SetFirstName(oMislead, "Celestial Badger"); ApplyGood(oMislead); ApplySizeIncrease(oMislead,1.0);}
  317. else if(nChoice == 201) {SetCreatureAppearanceType(oMislead, 9); AdjustAlignment(oMislead, ALIGNMENT_GOOD, 100); SetFirstName(oMislead, "Celestial Dire Badger"); ApplyGood(oMislead); ApplySizeIncrease(oMislead,1.0);}
  318. else if(nChoice == 202) {SetCreatureAppearanceType(oMislead, 19); AdjustAlignment(oMislead, ALIGNMENT_GOOD, 100); SetFirstName(oMislead, "Celestial Beetle"); ApplyGood(oMislead); ApplySizeIncrease(oMislead,1.0);}
  319. else if(nChoice == 203) {SetCreatureAppearanceType(oMislead, 37); AdjustAlignment(oMislead, ALIGNMENT_GOOD, 100); SetFirstName(oMislead, "Celestial Stag"); ApplyGood(oMislead); ApplySizeIncrease(oMislead,1.0);}
  320. else if(nChoice == 204) {SetCreatureAppearanceType(oMislead, 503); AdjustAlignment(oMislead, ALIGNMENT_GOOD, 100); SetFirstName(oMislead, "Celestial Weasel"); ApplyGood(oMislead); ApplySizeIncrease(oMislead,1.0);}
  321. else if(nChoice == 205) {SetCreatureAppearanceType(oMislead, 2326); AdjustAlignment(oMislead, ALIGNMENT_GOOD, 100); SetFirstName(oMislead, "Celestial Lion"); ApplyGood(oMislead); ApplySizeIncrease(oMislead,1.0);}
  322.  
  323. //fiendish
  324. else if(nChoice == 300) {SetCreatureAppearanceType(oMislead, 387); AdjustAlignment(oMislead, ALIGNMENT_EVIL, 100); SetFirstName(oMislead, "Fiendish Dire Rat"); ApplyEvil(oMislead); ApplySizeIncrease(oMislead,1.0);}
  325. else if(nChoice == 301) {SetCreatureAppearanceType(oMislead, 181); AdjustAlignment(oMislead, ALIGNMENT_EVIL, 100); SetFirstName(oMislead, "Fiendish Wolf"); ApplyEvil(oMislead); ApplySizeIncrease(oMislead,1.0);}
  326. else if(nChoice == 302) {SetCreatureAppearanceType(oMislead, 1003); AdjustAlignment(oMislead, ALIGNMENT_EVIL, 100); SetFirstName(oMislead, "Fiendish Wolverine"); ApplyEvil(oMislead); ApplySizeIncrease(oMislead,1.0);}
  327. else if(nChoice == 303) {SetCreatureAppearanceType(oMislead, 21); AdjustAlignment(oMislead, ALIGNMENT_EVIL, 100); SetFirstName(oMislead, "Fiendish Boar"); ApplyEvil(oMislead); ApplySizeIncrease(oMislead,1.0);}
  328. else if(nChoice == 304) {SetCreatureAppearanceType(oMislead, 1502); AdjustAlignment(oMislead, ALIGNMENT_EVIL, 100); SetFirstName(oMislead, "Fiendish Snake"); ApplyEvil(oMislead); ApplySizeIncrease(oMislead,1.0);}
  329. else if(nChoice == 305) {SetCreatureAppearanceType(oMislead, 159); AdjustAlignment(oMislead, ALIGNMENT_EVIL, 100); SetFirstName(oMislead, "Fiendish Spider"); ApplyEvil(oMislead); ApplySizeIncrease(oMislead,1.0);}
  330. }
  331. }
  332.  
  333. else if(iID == 1618) //bladedance
  334. {
  335. int iBABa = GetTRUEBaseAttackBonus(oCaster);
  336. int iBABb = GetTRUEBaseAttackBonus(oMislead);
  337. int nBABc = iBABa - iBABb;
  338.  
  339. if(nBABc != 0)
  340. {
  341. effect eBABm = EffectBABMinimum(nBABc);
  342. ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(eBABm), oMislead, 0.0f);
  343. }
  344.  
  345. SetBaseAbilityScore(oMislead, ABILITY_STRENGTH, GetAbilityScore(oCaster, ABILITY_STRENGTH));
  346. SetBaseAbilityScore(oMislead, ABILITY_CONSTITUTION, GetAbilityScore(oCaster, ABILITY_CONSTITUTION));
  347. SetBaseAbilityScore(oMislead, ABILITY_DEXTERITY, GetAbilityScore(oCaster, ABILITY_DEXTERITY));
  348. SetBaseAbilityScore(oMislead, ABILITY_WISDOM, GetAbilityScore(oCaster, ABILITY_WISDOM));
  349.  
  350. ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectAbilityIncrease(ABILITY_STRENGTH, 2), oMislead, 6.0f);
  351.  
  352. SetWillSavingThrow(oMislead, GetWillSavingThrow(oCaster));
  353. SetReflexSavingThrow(oMislead, GetReflexSavingThrow(oCaster));
  354. SetFortitudeSavingThrow(oMislead, GetFortitudeSavingThrow(oCaster));
  355.  
  356. FeatAdd(oMislead, FEAT_WEAPON_PROFICIENCY_EXOTIC, FALSE, FALSE, FALSE);
  357.  
  358. object oItem = GetLocalObject(oCaster, "bladedance_item");
  359. object oNewItem = CopyItem(oItem, oMislead, TRUE);
  360.  
  361. SetDroppableFlag(oNewItem, FALSE);
  362. SetLocalInt(oNewItem, "item_no_trade", 1);
  363.  
  364. AssignCommand(oMislead, ClearAllActions());
  365. AssignCommand(oMislead, ActionEquipItem(oNewItem, INVENTORY_SLOT_RIGHTHAND));
  366.  
  367. DelayCommand(1.0f, SetBaseAttackBonus(1, oMislead));
  368. DelayCommand(6.0f, BladeDance(oCaster, oMislead, oItem));
  369. }
  370. else if(iID == 1633) //army of death
  371. {
  372. SetLocalString(oMislead, "slot", sSpellName);
  373. DelayCommand(5.0f, SetEventHandler(oMislead, 10, "bg_spell_conjdmarmy1"));
  374. }
  375. else if(iID == 1595)
  376. {
  377. int iMyParry = ((iCL * 2) - 10);
  378. if(iMyParry < 5)
  379. iMyParry = 5;
  380.  
  381. SetBaseSkillRank(oMislead, SKILL_PARRY, iMyParry, TRUE);
  382. SetActionMode(oMislead, ACTION_MODE_PARRY, TRUE);
  383. }
  384.  
  385. //Do not buff called creatures. Done in cmi_ginc_spells.
  386. BuffSummons(oCaster, 0, 0, ASSOCIATE_TYPE_SUMMONED, oMislead, iCompetative, iID);
  387.  
  388. //SendMessageToPC(oCaster, "ID == "+IntToString(iID)+" nChoice == "+IntToString(nChoice));
  389.  
  390. AssignCommand(oCaster, ApplyEffectToObject(DURATION_TYPE_PERMANENT, SetEffectSpellId(SupernaturalEffect(EffectCutsceneDominated()), SUMMON_DOMINATE), oMislead, fDuration));
  391. SetIsCompanionPossessionBlocked(oMislead, FALSE);
  392.  
  393. if(GetRacialType(oMislead) == RACIAL_TYPE_OUTSIDER)
  394. {
  395. int nEvil = GetAlignmentGoodEvil(oMislead);
  396.  
  397. if(nEvil == ALIGNMENT_EVIL)
  398. {
  399. SetEventHandler(oMislead, 1, "inc_demon_devil_behavior1"); //behave like a proper evil summon
  400. }
  401. }
  402.  
  403. SetDescription(oMislead, "This is a "+GetName(oMislead)+".");
  404.  
  405. DestroyObject(oMaster, 2.0);
  406. AssignCommand(oMislead, DelayCommand(fDuration, RemoveSummon(oMislead)));
  407. //DelayCommand(2.0f, AttackNearest(oMislead, lTarget, oCaster));
  408. }
  409.  
  410. void NodeDoSummon(object oNode, string sBlueprint, int iDuration, float fDuration, int iVisual, location lTarget, string sSpellName, int iCompetative = FALSE, int iNoSummon = FALSE, int iID = -1)
  411. {
  412. //SendMessageToPC(GetPrimaryPlayer(),"Debug: Found ID = "+IntToString(iID));
  413. if(iID == 63) //gate
  414. {
  415. object oMaster = GetLocalObject(oNode, "caster");
  416. int nChoice = GetLocalInt(oMaster, "BGC_"+IntToString(iID));
  417.  
  418. if(nChoice > 0)
  419. {
  420. iCompetative = 10; //scale up to level 20
  421.  
  422. if(nChoice == 7) {sBlueprint = "gate_summon_angel"; iCompetative = 0;}
  423.  
  424. else if(nChoice == 107) {sBlueprint = "gate_summon_xorn"; iCompetative = 0;}
  425. else if(nChoice == 105) {sBlueprint = "c_night_hag";}
  426. else if(nChoice == 103) {sBlueprint = "c_djinni";}
  427.  
  428. else if(nChoice == 200) {sBlueprint = "bg_shadowdemon";}
  429. else if(nChoice == 201) {sBlueprint = "c_summ_succubus";}
  430. else if(nChoice == 202) {sBlueprint = "c_hezrou";}
  431. else if(nChoice == 203) {sBlueprint = "c_balor";}
  432.  
  433. else if(nChoice == 301) {sBlueprint = "c_erinyes";}
  434. else if(nChoice == 302) {sBlueprint = "c_devilhorn";}
  435. else if(nChoice == 303) {sBlueprint = "c_fiend";}
  436. else if(nChoice == 304) {sBlueprint = "gate_summon_devil"; iCompetative = 0;}
  437.  
  438. else if(nChoice == 403) {sBlueprint = "c_elmairelder";}
  439. else if(nChoice == 413) {sBlueprint = "c_elmfireelder";}
  440. else if(nChoice == 423) {sBlueprint = "c_elmwaterelder";}
  441. else if(nChoice == 433) {sBlueprint = "c_elmearthelder";}
  442. }
  443. }
  444. else if(iID == 69 || iID == 96 || iID == 451
  445. || iID == 128) //planar binding & ally
  446. {
  447. object oMaster = GetLocalObject(oNode, "caster");
  448. int nChoice = GetLocalInt(oMaster, "BGC_"+IntToString(iID));
  449.  
  450. if(nChoice > 0)
  451. {
  452. //GOOD
  453. if(nChoice == 1) {sBlueprint = "c_celestialbear";} //lion
  454. else if(nChoice == 2) {sBlueprint = "c_celestialwolf";} //stag
  455. else if(nChoice == 3) {sBlueprint = "c_celestialwolf";}
  456. else if(nChoice == 4) {sBlueprint = "c_celestialbear";}
  457. else if(nChoice == 5) {sBlueprint = "c_celestialdbear";}
  458.  
  459. //NEUTRAL
  460. else if(nChoice == 100) {sBlueprint = "c_firemephit";}
  461. else if(nChoice == 101) {sBlueprint = "c_impice";}
  462. else if(nChoice == 102) {sBlueprint = "c_summ_sylph";}
  463. else if(nChoice == 103) {sBlueprint = "c_djinni";}
  464. else if(nChoice == 104) {sBlueprint = "c_djinni";} //gibberling
  465. else if(nChoice == 106) {sBlueprint = "c_dogshadow";}
  466.  
  467. //Demon
  468. else if(nChoice == 200) {sBlueprint = "bg_shadowdemon";}
  469. else if(nChoice == 201) {sBlueprint = "c_summ_succubus";}
  470. else if(nChoice == 202) {sBlueprint = "c_hezrou";}
  471.  
  472. //Devil
  473. else if(nChoice == 300) {sBlueprint = "c_summ_imp";}
  474. else if(nChoice == 301) {sBlueprint = "c_erinyes";}
  475. else if(nChoice == 302) {sBlueprint = "c_devilhorn";}
  476. else if(nChoice == 303) {sBlueprint = "c_fiend";}
  477. else if(nChoice == 304) {sBlueprint = "c_doghell";}
  478.  
  479. //Elemental
  480. else if(nChoice == 400) {sBlueprint = "c_elmair";}
  481. else if(nChoice == 401) {sBlueprint = "c_elmairhuge";}
  482.  
  483. else if(nChoice == 410) {sBlueprint = "c_elmfire";}
  484. else if(nChoice == 411) {sBlueprint = "c_elmfirehuge";}
  485.  
  486. else if(nChoice == 420) {sBlueprint = "c_elmwater";}
  487. else if(nChoice == 421) {sBlueprint = "c_elmwaterhuge";}
  488.  
  489. else if(nChoice == 430) {sBlueprint = "c_elmearth";}
  490. else if(nChoice == 431) {sBlueprint = "c_elmearthhuge";}
  491. }
  492. }
  493.  
  494. else if(iID == 180 || iID == 181 ||
  495. iID == 182 || iID == 178 ) //summon creature VI to IX
  496. {
  497. object oMaster = GetLocalObject(oNode, "caster");
  498. int nChoice = GetLocalInt(oMaster, "BGC_"+IntToString(iID));
  499.  
  500. if(nChoice > 0)
  501. {
  502. //elemental
  503. if(nChoice == 400) {sBlueprint = "c_elmair";}
  504. else if(nChoice == 401) {sBlueprint = "c_elmairhuge";}
  505. else if(nChoice == 402) {sBlueprint = "c_elmairgreater";}
  506. else if(nChoice == 403) {sBlueprint = "c_elmairelder";}
  507.  
  508. else if(nChoice == 410) {sBlueprint = "c_elmfire";}
  509. else if(nChoice == 411) {sBlueprint = "c_elmfirehuge";}
  510. else if(nChoice == 412) {sBlueprint = "c_elmfiregreater";}
  511. else if(nChoice == 413) {sBlueprint = "c_elmfireelder";}
  512.  
  513. else if(nChoice == 420) {sBlueprint = "c_elmwater";}
  514. else if(nChoice == 421) {sBlueprint = "c_elmwaterhuge";}
  515. else if(nChoice == 422) {sBlueprint = "c_elmwatergreater";}
  516. else if(nChoice == 423) {sBlueprint = "c_elmwaterelder";}
  517.  
  518. else if(nChoice == 430) {sBlueprint = "c_elmearth";}
  519. else if(nChoice == 431) {sBlueprint = "c_elmearthhuge";}
  520. else if(nChoice == 432) {sBlueprint = "c_elmearthgreater";}
  521. else if(nChoice == 433) {sBlueprint = "c_elmearthelder";}
  522. else {sBlueprint = "c_beardire";}
  523. }
  524. }
  525. else if(iID == 29 || iID == 30) //create undead
  526. {
  527. object oMaster = GetLocalObject(oNode, "caster");
  528. int nChoice = GetLocalInt(oMaster, "BGC_"+IntToString(iID));
  529.  
  530. if(nChoice > 0)
  531. {
  532. //normal
  533. if(nChoice == 1) {sBlueprint = "c_s_mummy";}
  534. else if(nChoice == 2) {sBlueprint = "c_s_wraith";}
  535. else if(nChoice == 3) {sBlueprint = "c_s_ghast";}
  536. //greater
  537. else if(nChoice == 4) {sBlueprint = "c_s_vampire_warrior";}
  538. else if(nChoice == 5) {sBlueprint = "c_s_vampire_warlock";}
  539. }
  540. }
  541.  
  542. SetAILevel(oNode, AI_LEVEL_HIGH );
  543. lTarget = CalcSafeLocation(OBJECT_SELF, lTarget, 8.0f, FALSE, FALSE);
  544.  
  545. effect eCopy = EffectSummonCreature(sBlueprint, iVisual, 0.0f);
  546. if(iDuration == DURATION_TYPE_PERMANENT)
  547. fDuration = 0.0f;
  548. else
  549. fDuration = fDuration + 30.0f;
  550.  
  551. ApplyEffectAtLocation(iDuration, eCopy, lTarget, fDuration);
  552.  
  553. DelayCommand(0.5f, Control(oNode, sSpellName, fDuration, sBlueprint, lTarget, iCompetative, iNoSummon, iID));
  554. }
  555.  
  556.  
  557. //This hook function spawns a summon using BGTSCC's replacement summoning code.
  558. //The new creature is summoned via a spellhook and then dominated by the caster, and assigned a new tag.
  559. //existing creatures by that tag are first removed.
  560. void SpawnSummon(object oMaster, string sBlueprint, int iDuration, float fDuration, int iCL, string sSpellName, int iVisual, location lTarget, int iCompetative = FALSE, int iNoSummon = FALSE, int iID = -1)
  561. {
  562. if(GetIsPC(oMaster) != TRUE)
  563. {
  564. effect eSummon = EffectSummonCreature(sBlueprint, iVisual, 1.0f, 0);
  565.  
  566. ApplyEffectAtLocation(iDuration, eSummon, lTarget, fDuration);
  567. return;
  568. }
  569.  
  570. if(iID < 1)
  571. iID = GetSpellId();
  572.  
  573. object oPrevSummon = GetObjectByTag(ObjectToString(oMaster)+sSpellName);
  574.  
  575. if(GetIsObjectValid(oPrevSummon) == TRUE)
  576. RemoveSummon(oPrevSummon);
  577.  
  578. object oNode = CreateObject(OBJECT_TYPE_CREATURE, "c_attachspellnode", lTarget, FALSE, "");
  579.  
  580. SetLocalObject(oNode, "caster", oMaster);
  581. SetLocalInt(oNode, "mislead_casterlevel", iCL);
  582. SetFirstName(oNode, GetName(oMaster));
  583. SetCombatOverrides(oNode, oNode, 0, 0, OVERRIDE_ATTACK_RESULT_MISS, 0, 0, TRUE, TRUE, TRUE, TRUE);
  584.  
  585. SetScriptHidden(oNode, TRUE);
  586.  
  587. DelayCommand(1.0f, AssignCommand(oNode, NodeDoSummon(oNode, sBlueprint, iDuration, fDuration, iVisual, lTarget, sSpellName, iCompetative, iNoSummon, iID)));
  588. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement