2025/05/23 Update
Removed Ambidexterity from Bladesinger Bonus feats. Added loadhints.2da. Set Lasher debug messages to DEBUG. Enlarge & Reduce person applies a Visual Transform to the target now. Added HP Power Attack chat script to user notes.
This commit is contained in:
115
nwn/nwnprc/trunk/users/jaysyn/ha_pa_events.nss
Normal file
115
nwn/nwnprc/trunk/users/jaysyn/ha_pa_events.nss
Normal file
@@ -0,0 +1,115 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Power Attack Events
|
||||
//:: hp_pa_events
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
The NUI events for the Power Attack NUI Window
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Rakiov
|
||||
//:: Created On: 22.05.2005
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
#include "nw_inc_nui"
|
||||
#include "hp_pa_view"
|
||||
|
||||
//
|
||||
// SetWindowGeometry
|
||||
// Sets the window geometry for the Power Attack NUI to the player
|
||||
// so it can be remembered when opened next time
|
||||
//
|
||||
// Arguments:
|
||||
// oPlayer object the player that owns the window
|
||||
// nToken int the windowId
|
||||
//
|
||||
void SetWindowGeometry(object oPlayer, int nToken);
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPlayer = NuiGetEventPlayer();
|
||||
int nToken = NuiGetEventWindow();
|
||||
string sEvent = NuiGetEventType();
|
||||
string sElement = NuiGetEventElement();
|
||||
int nIndex = NuiGetEventArrayIndex();
|
||||
string sWindowId = NuiGetWindowId(oPlayer, nToken);
|
||||
|
||||
//HandleWindowInspectorEvent(); // used to debug
|
||||
|
||||
if(sWindowId != NUI_PRC_POWER_ATTACK_WINDOW)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the current Power Attack value for player
|
||||
int currentPAAmount = GetLocalInt(oPlayer, "PRC_PowerAttack_Level");
|
||||
|
||||
// if the window is closed, save the geometry
|
||||
if (sEvent == "close")
|
||||
{
|
||||
SetWindowGeometry(oPlayer, nToken);
|
||||
return;
|
||||
}
|
||||
|
||||
// Not a mouseup event, nothing to do.
|
||||
if (sEvent != "mouseup")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int currentBAB = GetBaseAttackBonus(oPlayer);
|
||||
|
||||
if (sElement == NUI_PRC_PA_LEFT_BUTTON_EVENT)
|
||||
{
|
||||
// if the decreased power attack doesn't go below 0 then perform PA decrease
|
||||
if(currentPAAmount-1 >= 0)
|
||||
{
|
||||
SetLocalInt(oPlayer, "PRC_PowerAttack_Level", currentPAAmount-1);
|
||||
ExecuteScript("hp_pa_script", oPlayer);
|
||||
// if decreased pwoer attack is lower than the current BAB then allow
|
||||
// the incrase button
|
||||
if(currentPAAmount-1 <= currentBAB)
|
||||
{
|
||||
NuiSetBind(oPlayer, nToken, NUI_PRC_PA_RIGHT_BUTTON_ENABLED_BIND, JsonBool(TRUE));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise we have hit the limit and disable the left button
|
||||
NuiSetBind(oPlayer, nToken, NUI_PRC_PA_LEFT_BUTTON_ENABLED_BIND, JsonBool(FALSE));
|
||||
}
|
||||
}
|
||||
|
||||
if (sElement == NUI_PRC_PA_RIGHT_BUTTON_EVENT)
|
||||
{
|
||||
//if the incrased power attack amount is less than or equal to the BAB
|
||||
// then perform the PA increase
|
||||
if(currentPAAmount+1 <= currentBAB)
|
||||
{
|
||||
SetLocalInt(oPlayer, "PRC_PowerAttack_Level", currentPAAmount+1);
|
||||
ExecuteScript("hp_pa_script", oPlayer);
|
||||
// if the increased power attack amount is greater than 0 then enable
|
||||
// the decrease button
|
||||
if (currentPAAmount+1 > 0)
|
||||
{
|
||||
NuiSetBind(oPlayer, nToken, NUI_PRC_PA_LEFT_BUTTON_ENABLED_BIND, JsonBool(TRUE));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise we have hit the limit and disable the right button
|
||||
NuiSetBind(oPlayer, nToken, NUI_PRC_PA_RIGHT_BUTTON_ENABLED_BIND, JsonBool(FALSE));
|
||||
}
|
||||
}
|
||||
|
||||
currentPAAmount = GetLocalInt(oPlayer, "PRC_PowerAttack_Level");
|
||||
|
||||
// set the geometry to the player since we only get mouseup events on button presses :(
|
||||
NuiSetBind(oPlayer, nToken, NUI_PRC_PA_TEXT_BIND, JsonString(IntToString(currentPAAmount)));
|
||||
SetWindowGeometry(oPlayer, nToken);
|
||||
}
|
||||
|
||||
void SetWindowGeometry(object oPlayer, int nToken)
|
||||
{
|
||||
json dimensions = NuiGetBind(oPlayer, nToken, "geometry");
|
||||
SetLocalJson(oPlayer, NUI_PRC_PA_GEOMETRY_VAR, dimensions);
|
||||
}
|
63
nwn/nwnprc/trunk/users/jaysyn/hp_pa_chatscript.nss
Normal file
63
nwn/nwnprc/trunk/users/jaysyn/hp_pa_chatscript.nss
Normal file
@@ -0,0 +1,63 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Power Attack NUI
|
||||
//:: hp_pa_chatscript
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
A OnChat script that parses what is said and opens the power attack NUI
|
||||
if provided /pa. Otherwise if /pa x is provided run the command directly
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Rakiov
|
||||
//:: Created On: 22.05.2005
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
#include "nw_inc_nui"
|
||||
#include "hp_pa_view"
|
||||
#include "hp_string_util"
|
||||
|
||||
void main()
|
||||
{
|
||||
// Get current player
|
||||
object oPlayer = GetPCChatSpeaker();
|
||||
if (!GetIsPC(oPlayer))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// get current player message and split it up into a list
|
||||
string sCommand = GetPCChatMessage();
|
||||
json sCommandSplit = StringSplit(sCommand);
|
||||
|
||||
if(JsonGetLength(sCommandSplit) > 0)
|
||||
{
|
||||
string firstWord = JsonGetString(JsonArrayGet(sCommandSplit, 0));
|
||||
|
||||
// if first word is /pa we are using the power attack interface
|
||||
if(firstWord == "/pa")
|
||||
{
|
||||
if(JsonGetLength(sCommandSplit) >= 2)
|
||||
{
|
||||
//if a parameter is given then run the power attack command directly.
|
||||
string param1 = JsonGetString(JsonArrayGet(sCommandSplit, 1));
|
||||
int paAmount = StringToInt(param1);
|
||||
SetLocalInt(oPlayer, "PRC_PowerAttack_Level", paAmount);
|
||||
ExecuteScript("hp_pa_script", oPlayer);
|
||||
|
||||
// update the NUI so it is in sync
|
||||
int nToken = NuiFindWindow(oPlayer, NUI_PRC_POWER_ATTACK_WINDOW);
|
||||
if (nToken != 0)
|
||||
{
|
||||
NuiSetBind(oPlayer, nToken, NUI_PRC_PA_TEXT_BIND, JsonString(IntToString(paAmount)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if no param is given then open the NUI
|
||||
NuiPRCPowerAttackView(oPlayer);
|
||||
}
|
||||
|
||||
// clear message from chat
|
||||
SetPCChatMessage();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Power Attack Script
|
||||
//:: prc_powatk_chs
|
||||
//:: hp_pa_script
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
A script that sets the power attack on a player based on the amount
|
||||
@@ -13,63 +13,80 @@
|
||||
|
||||
#include "prc_spell_const"
|
||||
|
||||
void SetPowerAttack();
|
||||
|
||||
//
|
||||
// SetPowerAttack
|
||||
// Sets the power attack for a player, if the amount is less than or equal to
|
||||
// the players BAB it will apply the power attack, otherwise it will tell
|
||||
// the player it can't.
|
||||
// Sets the power attack for a player, if the player has power attack and the
|
||||
// amount is less than or equal to the players BAB it will apply the
|
||||
// power attack and set the current power attack to the player at variable
|
||||
// 'prcPaScriptPaVariable', otherwise it will tell the player it can't.
|
||||
//
|
||||
// Arguments:
|
||||
// amount int the amount of power attack you want
|
||||
// oPlayer object the player to apply the power attack to
|
||||
// amount int the amount of power attack you want
|
||||
// oPlayer object the player to apply the power attack to
|
||||
//
|
||||
//
|
||||
void SetPowerAttack(int amount, object oPlayer);
|
||||
|
||||
void SetPowerAttack(int amount, object oPlayer)
|
||||
void main()
|
||||
{
|
||||
//You need the power attack feat to use this
|
||||
if (GetHasFeat(FEAT_POWER_ATTACK, oPlayer))
|
||||
int amount = GetLocalInt(OBJECT_SELF, "PRC_PowerAttack_Level");
|
||||
int prevPowerAttack5 = GetLocalInt(OBJECT_SELF, "prevPowerAttack5");
|
||||
int prevPowerAttack1 = GetLocalInt(OBJECT_SELF, "prevPowerAttack1");
|
||||
int powerAttack5Amount = amount / 5;
|
||||
int powerAttack1Amount = amount % 5;
|
||||
|
||||
// Current actions can cause this to not run right away, so clear the queue
|
||||
// and force this to happen.
|
||||
ClearAllActions();
|
||||
|
||||
|
||||
//sets the 5 values for Power attack ranging from 0,5,10,15,20 respectivly
|
||||
if (prevPowerAttack5 != powerAttack5Amount)
|
||||
{
|
||||
// It won't work if your BAB is lower than your PA Value
|
||||
if(GetBaseAttackBonus(oPlayer) <= amount)
|
||||
if (powerAttack5Amount == 0) // Power Attack 0
|
||||
{
|
||||
int powerAttack5Amount = amount / 5;
|
||||
int powerAttack1Amount = amount % 5;
|
||||
|
||||
switch (powerAttack1Amount)
|
||||
{
|
||||
//sets the 1 values for Power attack ranging from 0,1,2,3,4 respectivly
|
||||
case 0: // Power Attack 0
|
||||
ActionCastSpellAtObject(SPELL_POWER_ATTACK1, oPlayer, TRUE);
|
||||
case 1: // Power Attack 1
|
||||
ActionCastSpellAtObject(SPELL_POWER_ATTACK2, oPlayer, TRUE);
|
||||
case 2: // Power Attack 2
|
||||
ActionCastSpellAtObject(SPELL_POWER_ATTACK3, oPlayer, TRUE);
|
||||
case 3: // Power Attack 3
|
||||
ActionCastSpellAtObject(SPELL_POWER_ATTACK4, oPlayer, TRUE);
|
||||
case 4: // Power Attack 4
|
||||
ActionCastSpellAtObject(SPELL_POWER_ATTACK5, oPlayer, TRUE);
|
||||
}
|
||||
switch (powerAttack5Amount)
|
||||
{
|
||||
case 0: // Power Attack 0
|
||||
ActionCastSpellAtObject(SPELL_POWER_ATTACK6, oPlayer, TRUE);
|
||||
case 1: // Power Attack 5
|
||||
ActionCastSpellAtObject(SPELL_POWER_ATTACK7, oPlayer, TRUE);
|
||||
case 2: // Power Attack 10
|
||||
ActionCastSpellAtObject(SPELL_POWER_ATTACK8, oPlayer, TRUE);
|
||||
case 3: // Power Attack 15
|
||||
ActionCastSpellAtObject(SPELL_POWER_ATTACK9, oPlayer, TRUE);
|
||||
case 4: // Power Attack 20
|
||||
ActionCastSpellAtObject(SPELL_POWER_ATTACK10, oPlayer, TRUE);
|
||||
}
|
||||
} else {
|
||||
FloatingTextStringOnCreature("Power Attack Higher Than BAB", oPlayer);
|
||||
ActionDoCommand(ActionCastSpellAtObject(SPELL_POWER_ATTACK6, OBJECT_SELF, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
|
||||
}
|
||||
} else {
|
||||
FloatingTextStringOnCreature("Need Power Attack To Use", oPlayer);
|
||||
if (powerAttack5Amount == 1) // Power Attack 5
|
||||
{
|
||||
ActionDoCommand(ActionCastSpellAtObject(SPELL_POWER_ATTACK7, OBJECT_SELF, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
|
||||
}
|
||||
if (powerAttack5Amount == 2) // Power Attack 10
|
||||
{
|
||||
ActionCastSpellAtObject(SPELL_POWER_ATTACK8, OBJECT_SELF, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE);
|
||||
}
|
||||
if (powerAttack5Amount == 3) // Power Attack 15
|
||||
{
|
||||
ActionCastSpellAtObject(SPELL_POWER_ATTACK9, OBJECT_SELF, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE);
|
||||
}
|
||||
if (powerAttack5Amount == 4) // Power Attack 20
|
||||
{
|
||||
ActionCastSpellAtObject(SPELL_POWER_ATTACK10, OBJECT_SELF, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE);
|
||||
}
|
||||
SetLocalInt(OBJECT_SELF, "prevPowerAttack5", powerAttack5Amount);
|
||||
}
|
||||
}
|
||||
|
||||
//:: void main (){}
|
||||
if (prevPowerAttack1 != powerAttack1Amount)
|
||||
{
|
||||
//sets the 1 values for Power attack ranging from 0,1,2,3,4 respectivly
|
||||
if (powerAttack1Amount == 0) // Power Attack 0
|
||||
{
|
||||
ActionDoCommand(ActionCastSpellAtObject(SPELL_POWER_ATTACK1, OBJECT_SELF, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
|
||||
}
|
||||
if (powerAttack1Amount == 1) // Power Attack 1
|
||||
{
|
||||
ActionDoCommand(ActionCastSpellAtObject(SPELL_POWER_ATTACK2, OBJECT_SELF, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
|
||||
}
|
||||
if (powerAttack1Amount == 2) // Power Attack 2
|
||||
{
|
||||
ActionCastSpellAtObject(SPELL_POWER_ATTACK3, OBJECT_SELF, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE);
|
||||
}
|
||||
if (powerAttack1Amount == 3) // Power Attack 3
|
||||
{
|
||||
ActionCastSpellAtObject(SPELL_POWER_ATTACK4, OBJECT_SELF, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE);
|
||||
}
|
||||
if (powerAttack1Amount == 4) // Power Attack 4
|
||||
{
|
||||
ActionCastSpellAtObject(SPELL_POWER_ATTACK5, OBJECT_SELF, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE);
|
||||
}
|
||||
SetLocalInt(OBJECT_SELF, "prevPowerAttack1", powerAttack1Amount);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user