Jump to content

Home

Change dbLightsaber with Lightsaber and reverse in combat


oldflash

Recommended Posts

Some time ago I have started a thread on Modding requests about spliting doublesaber in 2 sabers during combat. I have deleted now because I have found a method to do that.

Here is the code:

//:: k_hen_attacked01
/*
   Default On Attacked Script
*/
//:: Created By: Preston Watamaniuk
//:: Copyright (c) 2002 Bioware Corp.

#include "k_inc_switch"
#include "k_inc_debug"

void main()
{
     object oTarget = GetFirstPC();
     object oOlditem4 = GetItemInSlot(4,oTarget);
if (((GetLastCombatFeatUsed(oTarget) == 8) || (GetLastCombatFeatUsed(oTarget)==19) || (GetLastCombatFeatUsed(oTarget)==81)) && ((GetStringUpperCase(GetTag(GetItemInSlot(4,oTarget)))=="G_W_LGHTSBR01") || (GetStringUpperCase(GetTag(GetItemInSlot(4,oTarget)))=="G_W_DBLSBR001")))
     {
ClearAllActions();
CancelCombat(GetFirstPC());
        if ((GetStringUpperCase(GetTag(GetItemInSlot(4,oTarget)))=="G_W_DBLSBR001"))
        {
         object oNew= CreateItemOnObject("g_w_lghtsbr01",oTarget,1,0);
         SetItemStackSize( oNew, 1);
         AssignCommand(oTarget,ActionUnequipItem(oOlditem4));
DestroyObject(oOlditem4); 
         AssignCommand(oTarget,ActionEquipItem(oNew,4,TRUE));
        }
        else 
        {
        object oNew= CreateItemOnObject("g_w_dblsbr001",oTarget,1,0);
        SetItemStackSize( oNew, 1);
        AssignCommand(oTarget,ActionUnequipItem(oOlditem4)); 
DestroyObject(oOlditem4);
        AssignCommand(oTarget,ActionEquipItem(oNew,4,TRUE));
         }
ActionAttack(GetLastAttacker(oTarget),TRUE);
return;
     }
   ExecuteScript("k_ai_master", OBJECT_SELF, KOTOR_HENCH_EVENT_ON_ATTACKED);
}

 

For this momment only one lightsaber instead of 2. For test I have use dbllightsaber/lightsaber blue. Changing weapon is called with critical strike. This call is executed and in next attack saber will be replaced.

Sometime I get confirmations message like "Item(s) lost.."

I have one question. Is any command to set ingame messages off like ("@echo off" from autoexec.bat)?

Some comments will be great. Also, compiled script is here: q-net.netfirms.com/script.zip (source included).

 

Special thanks to Darth333 and Fred Tetra who's make this possible.

 

p.s. I'm really proud about first "if" :D

Link to comment
Share on other sites

Way to go oldflash,

You're a lightsaber moddin' maniac here aren't ya? ;)

 

I bet this info will be helpful to many people indeed :D

 

Coud be, since is executed everytime on attack. In this way is possible to double enemy's hp (just to make battles more interesting) or even to make forcejump with melee weapon or blasters. Ok ignore last one. But is good to add many lightsabers class. I will use this script with one custom doublelightsaber to fake power off for one blade (like battle betwen maul and q-gon - sw ep1).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...