
Currently Broken Functions as of patch 1.23:
ActionSit
PC moves two steps towards chair, but not all the way, and does not perform sitting animation on it.
Workaround: KEMOs Chairs non the Vault
SetWeather
Does not work for WEATHER_TYPE_ SNOW or WEATHER_TYPE_LIGHTNING
WorkAround: GUI / Visual Special Effects?
SetEventHandler
Does not work for module or Area Objects
GetEventHandler
Does not work for module or Area Objects
ActionPlayAnimation
Does not loop a looping animation for the full time period specified by fDurationSeconds.
Workaround: Wrap in a self-calling delaycommand loop
SetFirstName
Does not work immediately on Items whose names have already been loaded by the UI (only updates after area
transition the object is moved in inventory)
Workaround: Force move the item in inventory
ActionRest
Ignores bIgnoreNoRest parameter (does not ignore AREA no rest flag, but does ignore nearby hostile creatures)
Workaround: Use ForceRest
SetDescription
Does not immediately effect the Examine window text upon inspection.
Workaround: Force Close and Reopen Examine Window
AddItemProperty
Does not work with ItemPropertyDamageReduction
Workaround: Use EffectDamage Reduction
GetFirstName
Does not return toolset edited FirstName value, will return correct value but only after SetFirstName has been called
Workaround: Assign value as variable, then set in OnSpawn
EffectDisintegrate
Does not appear to do anything
Workaround: Use a custom SEF file?
AddHenchman
Attempting to exit to the main menu while a henchman (not a companion) is added
crashes the client
Workaround: Don’t do it
StringToObject
Does not does properly handle Hex values which include A-F characters, which
is what ObjectToString can generates
Workaround: Use Custom function which correctly handles hex values
GetDescription
Does not retrieve the default description (original toolset defined description) Only retrieves correct value after SetDescription has been called
Workaround: Assign value as variable, then set in OnSpawn
GetclassByPosition
Does not return class_TYPE_INVALID when given OBJECT_INVALID
Workaround: Use wrapper function
DayToNight & NightToDay
Does not work. Displays/removes stars but does not change lighting & skybox
Workaround: Advance the time instead
EffectCutsceneGhost
Does not cause effected creature to ignore collision
Workaround: Use SetCollision
ItemPropertySkillBonus
Does not work with SKILL_ALL_SKILLS constant
Workaround: Add each skill individually
GetResRef
Does not work for waypoints, stores, sounds, or areas
Workaround: Assign value as variable to object in toolset and use Wrapper function to retrieve
EffectDisappearAppear
Creature does not reappear at passed in location
Workaround: Use custom animation instead
EffectDisappear & EffectAppear
Does not perform the animation
Workaround: Use custom animation instead
SetActionMode
Does not turn on or off all modes (or does not update the UI)
SetCutsceneMode
Does not fully disable UI while active, open gui screens can still be manipulated, some feats and modes can still be toggled
Workaround: Close/Hide open GUI screens, and/or open a transparent, full screen gui to intercept all mouse clicks
FadeToBlack
Does not fully disable UI while active, keyboard shortcuts will still execute (hotbar
mode/feat/skill toggles, 'R' for rest, etc)
GetDamageDealtByType
DAMAGE_TYPE_SLASHING/ PIERCING/BLUDGEONING does not work.
ItemPropertyDamageResistance
DAMAGE_TYPE_SLASHING/ PIERCING/BLUDGEONING Do not work (are ignored, UI chat logs indicates absorption, underlying HP values do not)
EffectDamageResistance
DAMAGE_TYPE_SLASHING/ PIERCING/BLUDGEONING Do not work (are ignored, UI chat logs indicates absorption, underlying HP values do not)
SetOwnersControlledCompanion
Does not swap control to a controllable associate (ex: familiar, ASSOCIATE_TYPE_**) when original PC is the currently active character
ForceRest
Does not trigger poison and disease saving throw stages
Workaround: Perform check manually before calling ForceRest, and reapply effects
after if necessary
[Action]JumpToLocation/Object
Does not work if creature is uncommandable, (cannot move, is paralyzed, etc)
Workaround: Use JumpPartyToArea? (comments say uncommandable can be jumped)
SetFog
Does not work (signature and description identical to SetNWN2Fog plus fFarPlaneClipDistance)
Get/SetCampaign**
Does not perform string length checking of the variable name for saving and retrieval
Workaround: Use Better Names or Globals instead
SignalEvent
Does not work for AOE object's user defined events
EffectAreaOfEffect
Does not properly display AOE if creator is the Module or an Area
Workaround: Use a placeable, creature or waypoint instead to create it
CreateObject
Does not work for creatures if the location is not walkable.
Workaround: Combine with GetIsLocationValid and CalcSafeLocation
ActionUseSkill
Does not work for all skills (Taunt, SetTrap)
Workaround: Use Wrapper function and/or ActionUseTalent
ActionStart Conversation
Does not work on DMs after they've possessed an NPC
ActionCastSpellAtObject/Location
Ignores the nMetaMagic parameter and does not set correct caster
level when bCheat = TRUE
ActionMoveToObject/Location
Does not work if target is in another area. Does not continue or log failure if location is blocked
ResistSpell
Causes GetSpellResistance result to reset to zero.
SetDescription and GetDescription
Do not have an identified parameter at all which is needed-see NWN1 version. GetDescription works on NPC's
but not on players.
EffectAbilityIncrease
Has trouble if the effect does not stack, does not give stat increase, but any secondary effects, slots, spells and the like get a boost. So if you get a con boost of 4, have a +4 magic item that gives you 4 con already, and are 1st level, your hit points go to 12 while your max hit points stay at 10. Also affects other stats but they are a lot harder to measure ( for example this can boost your spell slots above normal ). If you are not wearing magic gear it has no effect.
GetHasSpell()
Is broken for the Summon Creature I-IX spells. It always returns the sum of the squares of the sum of identical spells in the wizard and cleric spell level 1 slots. This means that it will return a positive number whether or not you have a Summon Creature spell (even if you can't cast it at all).
--------------------------------------
The following effects have no ID, and are thus unable to be detected, removed, replaced when they are in effect. ( those with ID 0 i specifically applied the effect, then iterated the effects on the target to get the ids that are active, and removed them as i echoed info about the effects. ).
- EffectBABMinimum <- ID 0
- EffectCutsceneDominated<- ID 0
- EffectDarkVision <- ID 0
- EffectKnockdown<-ID 0
- EffectLowLightVision<- ID 0
- EffectModifyAttacks<-ID 0
- EffectNWN2SpecialEffectFile <- ID 0
- EffectSeeInvisible
- EffectSeeTrueHPs
- EffectSetScale
- EffectSummonCopy
- EffectSummonCreature
These are instant effects, no constant needed or possible ( logically )
- EffectHeal
- EffectDeath
- EffectDamage
- EffectAppear<- are these deprecated with EffectAppearDisappear?
- EffectDisappear<- are these deprecated with EffectAppearDisappear?
These seem to cause an error, the first a runtime error, the second does not
leave an effect to remove.
- EffectNWN2ParticleEffect <-- causes an error if you use it???
- EffectNWN2ParticleEffectFile<- no result at all
This are constant has no effect available for it (that i know of)
EFFECT_TYPE_NWN2_DEX_ACMOD_DISABLE
--------------------
The following functions should be deprecated or are otherwise NA to NWN2
OpenInventory (Workaround: use a Custom GUI)
CopyItemAndModify
GetItem
Appearance
Get/SetTile**
Dis/MountObject
RecomputeStatic
Lighting
SetPanel ButtonFlash
GetLastReSpawn ButtonPresser
SetPlaceable
Illumination
EffectTimeStop
--------------------
The following functions were listed as broken but I have not tested them to confirm if they still are.
ActivatePortal
Does not work
GetName
Only returns english names
AddJournalQuest Entry
Ignores bAllParty Members parameter
Adjust Reputation
Does not adjust only a single player w/ respect to NPC faction, adjusts all players. Need to be able to effect only a single player
OnAreaExit
Doesn’t fire for an inter-module transition
OnClientLeave
Doesn't fire for an inter-module transition

Hi,
Very useful list. I know I have come across some of these issues as well, so it's good to know the problem was not just me.

I have also found I can use the SetCommandable function to get around some coding that would normally use SetCutsceneMode.
Lance.

A couple of additional notes here:
- StringToObject/ObjectToString's behaviors are set in stone now as part of the API contract and can't change. Their contract doesn't allow for round-tripping as one operates in base 10 vs base 16.
- CreateObject: Not creating the creature if the location is invalid should be by design.
- ActionMoveToObject/ActionMoveToLocation: Not moving cross-area should be by design.
- Action/JumpToObject: Not queuing the request when the object is not commandable should be by design. (Even functions such as JumpToObject actually do create an action queue entry, just prepended. Turning off the 'commandable' flag disables queuing of action queue entries.)
- ActivatePortal: Portal activation works. Please post details in scenarios where you observe it not working correctly.

Good information to have. Thank you.
Perhaps this should be stickyfied?


Quote
rjshae wrote...
Good information to have. Thank you.
Perhaps this should be stickyfied?
This shouldn't be allowed to get buried - Second the Sticky Motion <_<

please sticky

Und shtickivied eet eess.
dernachteule

AddItemProperty
When used to apply an itemproperty with a permanent duration on a non-equipable item that is already in a PC's inventory (such as might occur with a tag-based script), the new property does not go into effect until the item is moved to another inventory or dropped and re-equipped. A work-around is to duplicate the item using CopyItem, then delete the original item using DeleteItem.
I haven't tested this with a temporary duration or an equipable item.

Quote
rjshae wrote...
AddItemProperty
When used to apply an itemproperty with a permanent duration on a non-equipable item that is already in a PC's inventory (such as might occur with a tag-based script), the new property does not go into effect until the item is moved to another inventory or dropped and re-equipped. A work-around is to duplicate the item using CopyItem, then delete the original item using DeleteItem.
I haven't tested this with a temporary duration or an equipable item.
That is very useful information, thanks rjshae.

This function is unreliable and so I can't use it to check whether certain generated effects are valid. (I've only had it work correctly when used with GetFirstEffect/GetNextEffect.) A work-around is to call GetEffectType for the effect and check whether it returns EFFECT_TYPE_INVALIDEFFECT.

There doesn't appear to be a convenient work-around that I could find. About the best I could do was to use one of the other "On Hit" properties as a marker on the target to show that a hit occurred, then search the target creature effects to see if that effect was functional. If found, I remove that effect and add my own. Pretty ugly really. If anybody has a better fix, I'd be grateful to hear about it. Thank you.

Quote
0100010 wrote...
Currently Broken Functions as of patch 1.23:
ActionPlayAnimation
Does not loop a looping animation for the full time period specified by fDurationSeconds.
Workaround: Wrap in a self-calling delaycommand loop
Hello, could you please be more specific on how to avoid problems with this function?
I can't understand what "Wrap in a self-calling delaycommand loop" means.
Thanks in advance.

Quote
popcorn_eater wrote...
Hello, could you please be more specific on how to avoid problems with this function?
I can't understand what "Wrap in a self-calling delaycommand loop" means.
Thanks in advance.
make a function
void MyNewFunction(input parameters same as the function you are wrapping, possibly additional parameters)
{
some function I am wrapping in here(it's parameters)
}
now you can do more stuff with the original function like have it run say 3 times instead of once with some delay commands etc...

void SetTime( int nHour, int nMinute, int nSecond, int nMillisecond )
The documentation for this command says that valid values for the nMinute parameter are 0 to 59. Unfortunately, the game engine clock actually uses 2 minutes of game time equals one hour. Hence, for example, if you pass a value of 5 for nHour and 45 for nMinute, it will convert this into 5 + int(45 / 2) = 27 hours and (45 % 2) = 1 minute, for an actual clock setting of 3 hours and 1 minute. Instead, to get the desired result, multiply 2 minutes by the fraction of the hour represented by nMinute. In this example: 2 minutes * (45/60) = 1 minute, 30 seconds. Hence: SetTime( 5, 1, 30 ); This conversion can be readily implemented through a custom function.

Minutes per game hour can be set in the module properties tab. 2 minutes per hour is the default setting.

Quote
Lugaid of the Red Stripes wrote...
Minutes per game hour can be set in the module properties tab. 2 minutes per hour is the default setting.
Thanks, I'll make mention of that in my notes.

The following constants are flip flopped, the 2da is not matching. 1089 is darkness, and 1088 is resistance in the 2da.
int FEAT_TIEFLING_DARKNESS = 1088;int FEAT_TIEFLING_RESISTANCE = 1089;
My solution is to just flip flop the rows in the 2da, since i cannot change nwscript.nss without causing major compatibility problems.
Note that both of these are handed out at the same time, so doubt it can cause any issues, but I'm looking at feats for an AI function and don't want to use the darkness constant when i am really after is resistance to damage, and doing this is pretty low risk for issues and reduces future confusion.

Line 83
kinc_trade_system.NSS ( campaign script for SOZ )
int ProcessCompanyIncome();
should be
void ProcessCompanyIncome();
Prototype does not match implementation...

Quote
DannJ wrote...
I've run into some trouble with ActionEquipItem(). It seems to refuse to equip a two-handed weapon into INVENTORY_SLOT_RIGHTHAND (I also tried _LEFTHAND) unless the creature has the 'Monkey Grip' feat - in which case, it equips it as a one-handed weapon even though the off-hand is empty.
The creature is question had the correct weapon feats, and wasn't a small creature, so it could use the weapon (in this case it was a quaterstaff). The script also identified the weapon prior to equipping it. However the creature also had creature weapons equipped, which might be confusing the function.
Please start a new thread for that. This is for functions that just plain broken and for posting the actual confirmed bug and how it is reproduced. I usually use the dm client to test things, possess the creature and try equipping the item and you probably will get the same issue. Please post response in new thread as the discussion will have to cover a lot of topics.

I thought I was going crazy or I somehow bugged my module. I'm glad to see that neither is true but disappointed that there are so many broken functions.
Thank you for this list and for the workaround ideas.

// Get an integer between 0 and 100 (inclusive) that represents how oSource // feels about oTarget. // -> 0-10 means oSource is hostile to oTarget // -> 11-89 means oSource is neutral to oTarget // -> 90-100 means oSource is friendly to oTarget // * Returns -1 if oSource or oTarget does not identify a valid object int GetReputation(object oSource, object oTarget);
oSource and oTarget seem to be inverted. cf, nwnLexicon
Quote
Parameters
oSource
The creature (or object) is the subject of oTarget's feelings.
oTarget
The creature (or object) whose feelings we wish to know.

void SetIsTemporaryEnemy(object oTarget, object oSource=OBJECT_SELF, int bDecays=FALSE, float fDurationInSeconds=180.0f);
ditto. The description reads, "Make oSource into a temporary enemy of oTarget using personal reputation." It actually makes oTarget into a temporary enemy of oSource, as in
SetIsTemporaryEnemy(oPC, oSource);
nb. SetIsTemporaryFriend/Neutral are likely the same.

Hi,
I have been meaning to add a link to this here for a while ....
AddHenchman game crash fix.
Cheers,
Lance.
GetIsFriend/Enemy/Neutral *cough* see above.
(yep, still doing faction tribulations)
so ... *apparently* ( and i say apparently because so far there's no indication i'm not psychotic )
Apparently, the engine takes how x feels about y then adds n to how y feels about x ...
Note that when dealing with PC-faction these issues do not show up. That's because the engine happily transposes NPC-faction reps to PC-faction reps, so when using faction functions the order of (oPC, oNPC) does not seem to matter,
it ought come into play only when dealing with reputations between nonPC factions.
This isn't so much a problem with a broken function as an issue with the AI; but I might as well record it here for posterity.
In the 'hench_i0_ai' script there's an 'InitializeItemSpells' function that, among other things, determines whether to exclude item "talents". Down about 45 lines from the start of the function, there is an 'if' statement that first checks if the creature is polymorphed, then looks to see if the first item in its inventory is valid. This code looks like the following (without the line wrapping):
The issue here is that the 'GetFirstItemInInventory' call only checks the items in the unequipped inventory; it does not check the equipped items. This means if a creature has an equipped item with a usable property (like a staff or wand), it may not get used unless there is also an unequipped item in its inventory.

There are several fixes for this:
The following subroutine can be used in the 'hench_i0_ai' script to apply the second option:
It is called with a line like the following:
putations seem to be broken (yes, I activated them in the campaign settings). Workaround: Change to STANDARD_FACTION_HOSTILE, or adjust the faction reputation. You might readjust the faction reputation in the onExit script of the area (seehttp://social.biowar...13272578-1.html).
Set/GetFactionLeader: I couldn't get it to work for NPCs, GetFactionLeader always returned OBJECT_INVALID. Workaround: use a fixed set of faction leaders, and write your own GetFactionLeader function like this:
[nwscript]
object myGetFactionLeader(object oNPC)
{
object leader;
leader = GetObjectByTag("Leader_Faction1");
if (GetFactionEqual(oNPC, leader))
return leader;
leader = GetObjectByTag("Leader_Faction2");
if (GetFactionEqual(oNPC, leader))
return leader;
...
}
[/nwscript]
Quote
GetFactionLeader is not initialized. You have to intialize it yourself.
social.bioware.com/%20http:/social.bioware.com/forum/1/topic/164/index/8906305#13260454
SetFactionLeader is supposed to make the npc it runs on the leader.
Quote
I initialized the faction leader on client enter, but GetFactionLeader still returned OBJECT_INVALID. Has somebody successfully used these functions?
script 'gc_alignment'
( conversation check for Alignment )
line 55, change nCheck to nAlignCheck
Quote
This must have been fixed in a patch at some point, because it works now. My return-on-hit throwing weapon scripts utilise it.
couldn't get it to work. It kept returning "-1"
So i'd beware this one too:
@KevL: Did you pass the animal or the owner as oCreature?
both ...
tried both, and with the summons up and without ...
If you or someone can get it to work that be cool,
[edit] maybe, hold on .......
well, I got it to spit out #255, ANIMAL_COMPANION_CREATURE_TYPE_NONE
when passing in my Badger (although the badger companion has Badger as its AC type in its properties). I thought for a moment that it was returning -1 because I was testing on one of Cyphre's extended companions #28 the Smilodon ... but the AnimalCompanionType is stored in the .Bic/.Ifo simply as an integer and that should not be a problem : just return the integer from character properties. But even when I swapped the Smilodon (#28) for a Badger (#0) it still gave me -1
when i passed in the Master, whether the companion was summoned or not; but when I passed in the companion, the Smilodon returned -1 as it has no AnimalCompanionType set in its blueprint, the Badger returned 255 as noted above ( probably because it doesn't have the Animal Companion feat )
But I really want to just grab the ACType straight from the PC properties GFF file 'cause it's right there in front of my eyes, listed "CompanionType" as an Int. ah well, more workarounds ...
still broken.
crash to desktop.
Use
nwscript constants:
DAMAGE_TYPE_ALL <--> DAMAGE_TYPE_BLUDGEONING
loL,
- a comment in 'nx_s0_glass_doppel_buff'
Quote
Confirmed in test. Plus, DT_Bludgeoning seems to be DT_All (vice versa). This is when used in EffectDamageReduction(), although i imagine that as an nwscript constant it might foobar be global ...
I looked at the Wiki this morning and saw you've been busy. Do you have any thoughts on True Sight?
(By the way, what did you change on Mass Deathward? I couldn't tell what was different.)
hey _Raps
just added Druid 9 to the castersList on MassDW (MotB addition). True Sight? I'm not sure, a couple years ago i had the same thoughts as others recently: does this work. Ark's right in that it shouldn't see through Stealth, but the only creature I've (not even) tested with is ... Dragons. They all have True Sight on their carapices -- which means it's an itemproperty like an amulet is. Spell Resistance taught us to be leary of itemproperties (though the vast majority work great). I'm thinking that, like SR, if a modder wants to be sure® of TS then apply it like an effect ( EffectTrueSeeing() )
all i can say without specific testing is that my playful dragons didn't let anything by ( w/ TS as itemproperty on their carapice ), although i also like to have their Spot & Listen up very high.
Thanks ... i think i might make that change for Dragons in the OC (True Seeing as effect, take it off the hide), or first do some tests vs. Greater Invis. if/when I get my head out from a score of discombobulated spellscripts .. & Factions still trouble me though i'm using scripts now that seem to make faction-decisions tighter and i got so upset with STANDARD_HOSTILE spellTargetting that i changed it to mean "start a riot" (hit everything, friend or foe! * ), which could well lead me back into more efforts on factions .....
* but not Plot
[ edit ] looks like Dann has TS covered in General
not a bug, a Feature ( untested )
Quote
eg:
The second "3" represents the addition of nwscript constants
( Also, not sure how this relates to Type_All/Type_Bludgeoning, noted above. )
I_Raps, on 07 Apr 2013 - 3:19 PM, said:
From the point of view of being able to attack when blinded, true sight as an item property certainly works. I have a permanently blind companion in a module I'm working on who can only initiate attacks when wearing a circlet with the true sight item property. The downside is that the companion also reacts to hostile creatures with an ethereal effect on them, but can't actually attack them, so they tend to run back and forth near the target in confusion.
My D&D Games: BG:TotSC, BG2:SoA, BG2:ToB, IWD, IWD2, NWN, NWN:SoU, NWN2, NWN2:MotB, NWN2:SoZ
Gothic Series: Gothic 2, Gothic 3, Gothic 3:FG, Arcania (Gothic 4)
Favourite Game: Soulbringer
GetLastSpell()
as used in the OnSpellCastAt event, ignores the SpellID that was passed in w/
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, iSpellID));
and uses a value like GetSpellId() instead.
For example, a spell's Child ID will be referenced, if trying to trigger a particular OnSpellCastAt event with its Master ID.
Workaround: kill it with fire (that wasn't very helpful)
- handle the direct SpellID somehow. Set/Get a local_var or if possible map the child to its parent to trigger the action you want in the SpellCastAt script itself ...,,
/ carry on.
Be all you can be! Personal Impossibility Adjustment : ver.2.7.3
Dragons in the OC : git yer Dragon steaks ( ver.2.1 ) !
ver.beta.95 : MetaPrepa Alla-ka-Zahm!! auto-buffs
GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_*)
returns a creature that feels reputation_type vs OBJECT_SELF instead of as seemingly advertised; how OBJECT_SELF feels about creature.
cf. my previous comments about Reputation I've come to the conclusion that everything works fine if the Faction_Table is reversed, except for the PC column (which doesn't matter because it returns the same value either way)
here is the testscript
Be all you can be! Personal Impossibility Adjustment : ver.2.7.3
Dragons in the OC : git yer Dragon steaks ( ver.2.1 ) !
ver.beta.95 : MetaPrepa Alla-ka-Zahm!! auto-buffs
kevL, on 04 May 2014 - 06:47 AM, said:
Hi KevL,
Yes, I have noticed "errors" with "GetNearestCreature" too. I wrote a function called GetNearestNPC, which says this: "GetNearestNPC will return any living NPC either friend or enemy. This replaces GetNearestCreature which can return a companion not currently controlled by a player even if NOT_PC is specified." The function is too home-brew with references to other functions to include here I'm afraid.
I have a couple more home brew functions around this topic, including this one too:-
Visit my World of Althéa Campaign at ..... http://worldofalthea.blogspot.co
m
constant IP_CONST_FEAT_* mismatch
iprp_feats.2da - note that rows 22(WeaponProfMartial) and 23(WeaponProfSim) do not jive with nwscript constants
IP_CONST_FEAT_WEAPON_PROF_SIMPLE = 22
IP_CONST_FEAT_WEAPON_PROF_MARTIAL = 23
workaround: when scripting, use the numeric constants. Ie,
22 = Martial Proficiency ip
23 = Simple Proficiency ip
they are used only in the function, ItemPropertyBonusFeat()
afaiaa
Be all you can be! Personal Impossibility Adjustment : ver.2.7.3
Dragons in the OC : git yer Dragon steaks ( ver.2.1 ) !
ver.beta.95 : MetaPrepa Alla-ka-Zahm!! auto-buffs
nwscript.nss constants
int FEAT_FAVORED_POWER_ATTACK_GNOME = 1223;
int FEAT_FAVORED_POWER_ATTACK_ELF = 1224;
are inconsistent w/
Feat.2da
1223 - FEAT_FAVORED_POWER_ATTACK_ELF
1224 - FEAT_FAVORED_POWER_ATTACK_GNOME
workaround: rewrite the game engine.
Im not sure how in NWN2, but in NWN1 you can modify nwscript.nss file. The only problem is that this file must not be in module - as then toolset compiler fails to compile scripts. But if this file is in hak (which is awful place too however) it works. If there is a way for NWN2 to put it into lowest priority file source (in NWN1 its .bif) that would be a best way. So the only thing you need to do is to swap the constant namess in nwscript.nss.
hey Shadooow
i've fooled w/ nwscript.nss (in Nwn2) before, specifically constants. was a long time ago and I forget the details, but eventually it led to a really obscure bug that took days to track down. it was really wtf.
finally by chance I figured it might be due to editing nwscript.nss ... when i reverted the bug disappeared and since then i don't touch it.
GetLastWeaponUsed()
when dual wielding:
multiple attacks can happen nearly simultaneously, whether two from the onhand or one from the onhand and another from the offhand. The OnPhysicallyAttacked events will fire for both of them before either fires its OnDamaged event. What this seems to mean is that the item stored for GetLastWeaponUsed() doesn't get updated fast enough for robust usage in the OnDamaged events; so if it was dual-wield attacks that happened nearly simultaneously, the same item gets returned for both OnDamaged events even though the weapons used for each was different.
This only affects the object returned from GetLastWeaponUsed() ... internally the combat engine realizes that the weapons are different (and so calculates damage for each appropriately).
workaround: store the weapons as local_objects in the OnPhysicallyAttacked event (append "1" and "2" to their varnames) and get those in the respective OnDamaged events.*
It might be a good idea to force-clear them after a 1sec delay instead of in their OnDamaged events, in case the attacks miss.**
Edits -
* not so simple. The OnPhysAttacked and OnDamaged events for the respective weapons can fire in the same order or the opposite order (haven't found a pattern yet..)
** 1.25 sec is the optimal time I'm noticing for erasing/deleting information from the OnPhysAttacked events (not robust..)
in 'x0_i0_stringlib'
function:
string RemoveListElement(string sString, string sSubString, string sDelimiter=",");
a partial substring will remove an entire token; eg,
removing "alp" from list "alpha,beta,gamma"
returns "beta,gamma" [*]
fix: rewrite using the string-tokenizer struct (which ensures that the substring and the token are an exact match)
[*] actually the return (in that case) is more like "a,beta,gamma" but you get the idea ... your list gets borked.