Vanilla Placeable Trap Script Errors

It Does What It Says on the Tin: Resolved Issues

Moderators: Moderator, Developer, DM

Post Reply
User avatar
Kitunenotsume
Posts: 631
Joined: Sun May 17, 2020 10:57 pm
Location: UTC -7

Vanilla Placeable Trap Script Errors

Unread post by Kitunenotsume »

Following some testing and discussion, it appears that the scripts for two trap kits (Acid Blob and Holy) have errors in their script that do not align with the same scripts. That same testing reveals that two classes of traps use the wrong script on-triggering: Acid Splash and Frost.

Following confirmation from Valefort that the server is probably using base vanilla scripts for these traps, I have identified the following issues.

Acid Splash Trap
All trap-kit variants are currently placing the associated Negative Energy [nw_t1_neg*c.nss] Trap scripts instead of Acid Splash [nw_t1_splsh*c.nss].

Frost Trap
All trap-kit variants are currently placing the associated Acid Splash [nw_t1_splsh*c.nss] Trap scripts instead of Frost [nw_t1_cold*c.nss].

Acid Blob Trap: Affects nw_t1_acid*c.nss
The code as commented has two effects: one Paralysis effect with a linked fort save, and a damage element.
As implemented, the damage and paralysis check are both delivered on a failed reflex save, but where a comment says "Apply hold" damage is applied instead.
This means that on a failed reflex save, the damage is applied and a further fort save is attempted against paralysis, while on a passed reflex save *full* damage is applied without implementation of Improved Evasion. This further illustrates that there is no Improved Evasion test for this trap.

Unfortunately, the script itself is contradictory: in the opening comment is says the paralysis can be avoided with a reflex save, then applied a fort save to it and includes a comment saying to apply hold on a failed reflex save.
If damage was intended to be applied in either regard, 6 lines could be saved by putting it outside the if-statement entirely.*

These inconsistencies affect all 4 Acid Blob trap kit strengths.

Code:
Hidden: show
nw_t1_acidminoc.NSS wrote:void main()
{
//Declare major variables
object oTarget = GetEnteringObject();
effect eDam = EffectDamage(d6(3), DAMAGE_TYPE_ACID);
int nSaveDC = 15;
effect eHold = EffectParalyze(nSaveDC, SAVING_THROW_FORT);
effect eVis = EffectVisualEffect(VFX_IMP_ACID_S);
effect eDur = EffectVisualEffect(VFX_DUR_PARALYZED);
effect eLink = EffectLinkEffects(eHold, eDur);

int nDamage;

//Make Reflex Save
if(!MySavingThrow(SAVING_THROW_REFLEX, oTarget, nSaveDC, SAVING_THROW_TYPE_TRAP))
{
//Apply Hold and Damage
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, RoundsToSeconds(2));
}
else
{
//Apply Hold
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
}
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
}
My suggested adjustments to align with internal code-commentary would be either the following, or a touch-attack like Holy traps:
Hidden: show
nw_t1_acidminoc.NSS wrote:void main()
{
//Declare major variables
object oTarget = GetEnteringObject();
effect eDam = EffectDamage(d6(3), DAMAGE_TYPE_ACID);
int nSaveDC = 15;
effect eHold = EffectParalyze(nSaveDC, SAVING_THROW_FORT);
effect eVis = EffectVisualEffect(VFX_IMP_ACID_S);
effect eDur = EffectVisualEffect(VFX_DUR_PARALYZED);
effect eLink = EffectLinkEffects(eHold, eDur);

int nDamage;

//Make Reflex Save
if(!MySavingThrow(SAVING_THROW_REFLEX, oTarget, nSaveDC, SAVING_THROW_TYPE_TRAP))
{
//Apply Hold and Damage
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, RoundsToSeconds(2));
}
else
{
//Apply Hold
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, RoundsToSeconds(2));
}
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
}

Holy Trap: Affects nw_t1_holy*c.nss
As scripted, the Holy Trap pulls a target's AC, and then simulates an attack roll. However, as implemented in the script, this Armor-Class is never actually called, and the attack roll is checked to be greater than 0 - which is *always true*. If this was the intended case, the entire check could be removed and the entire code-block simplified, in a similar case to the Acid Blob trap above.

These inconsistencies affect all 4 Holy trap kit strengths.

Code:
Hidden: show
nw_t1_holyminoc.NSS wrote:void main()
{
//Declare major variables
object oTarget = GetEnteringObject();
int nAC = GetAC(oTarget);
//Make attack roll
int nRoll = d20(1) + 10 + 2;
effect eDam = EffectDamage(d10(4), DAMAGE_TYPE_DIVINE);
effect eVis = EffectVisualEffect(VFX_IMP_SUNSTRIKE);
if (nRoll > 0)
{
if (GetRacialType(oTarget) == RACIAL_TYPE_UNDEAD)
{
//Apply Holy Damage and VFX impact
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
}
else
{
eDam = EffectDamage(d4(2), DAMAGE_TYPE_DIVINE);
//Apply Holy Damage and VFX impact
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
}
}
}
As an attack should be against a target's AC (As already pulled by the script) or Touch AC (if it can be pulled) rather than 0, the following would be more correct:
Hidden: show
nw_t1_holyminoc.NSS wrote:void main()
{
//Declare major variables
object oTarget = GetEnteringObject();
int nAC = GetAC(oTarget); //If possible check Touch AC instead of full AC
//Make attack roll
int nRoll = d20(1) + 10 + 2;
effect eDam = EffectDamage(d10(4), DAMAGE_TYPE_DIVINE);
effect eVis = EffectVisualEffect(VFX_IMP_SUNSTRIKE);
if (nRoll > nAC )
{
if (GetRacialType(oTarget) == RACIAL_TYPE_UNDEAD)
{
//Apply Holy Damage and VFX impact
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
}
else
{
eDam = EffectDamage(d4(2), DAMAGE_TYPE_DIVINE);
//Apply Holy Damage and VFX impact
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
}
}
}
* : It may of course be a deliberate design decision that only 4 out of 11 player-placeable traps require a save of any kind to reduce or avoid damage (as opposed to the non-damage effect), in which case the script adjustments can be safely ignored. The first two with the incorrect scripts should still be looked in to, even in such an eventuality.
I play a baker. Sometimes she provides counseling or treatment.
Ask about our Breadflower daily special to save five coppers off a purchase of five pastries.
She seems unusually interested in cursed items.
She has also been seeking a variety of gems and stones.
User avatar
Blackman D
Retired Staff
Posts: 4818
Joined: Sat Sep 12, 2009 5:43 am
Location: IL

Re: Vanilla Placeable Trap Script Errors

Unread post by Blackman D »

i would remove the check from holy... if you ran into the trap its safe to say it hit you

for frost and acid blob, the paralysis is a one time save right?
everyone is evil till proven otherwise
User avatar
Kitunenotsume
Posts: 631
Joined: Sun May 17, 2020 10:57 pm
Location: UTC -7

Re: Vanilla Placeable Trap Script Errors

Unread post by Kitunenotsume »

Blackman D wrote: Mon Jun 08, 2020 2:38 am i would remove the check from holy... if you ran into the trap its safe to say it hit you
I suspect that the intention of the design of the script has been to emulate the class of traps that uses an attack roll. Per tabletop rules, a trap is either classified as making an attack roll, providing a save, or a "Never-miss" such as a flooding room. (The 3.5 SRD has a large collection of potential inspirations for all three varieties.)

Blackman D wrote: Mon Jun 08, 2020 2:38 am for frost and acid blob, the paralysis is a one time save right?
No, it is a save every round, at the listed DC.

[Edit]: Frost traps currently do not work as noted above, so my comment is based on what the script says they should do.
I play a baker. Sometimes she provides counseling or treatment.
Ask about our Breadflower daily special to save five coppers off a purchase of five pastries.
She seems unusually interested in cursed items.
She has also been seeking a variety of gems and stones.
User avatar
Blackman D
Retired Staff
Posts: 4818
Joined: Sat Sep 12, 2009 5:43 am
Location: IL

Re: Vanilla Placeable Trap Script Errors

Unread post by Blackman D »

shouldnt they be one time saves then? its not as if the durations are long, 1-4 rounds
everyone is evil till proven otherwise
User avatar
Kitunenotsume
Posts: 631
Joined: Sun May 17, 2020 10:57 pm
Location: UTC -7

Re: Vanilla Placeable Trap Script Errors

Unread post by Kitunenotsume »

Blackman D wrote: Mon Jun 08, 2020 3:28 am shouldnt they be one time saves then? its not as if the durations are long, 1-4 rounds
Perhaps, but that is outside the scope of the bug as listed.
I cannot interpret how the implementation of EffectParalyze was intended based on the code comments or layout. That would be a question for a developer.
I play a baker. Sometimes she provides counseling or treatment.
Ask about our Breadflower daily special to save five coppers off a purchase of five pastries.
She seems unusually interested in cursed items.
She has also been seeking a variety of gems and stones.
User avatar
Valefort
Retired Admin
Posts: 9779
Joined: Thu Apr 28, 2011 5:07 pm
Location: France, GMT +2

Re: Vanilla Placeable Trap Script Errors

Unread post by Valefort »

Fixed the relevant 2da file after much misunderstanding, trap kits of all kinds should now allow to lay the corresponding traps.

Regarding acid blob trap script while the apply damage part could have been set before the reflex save the hold is avoidable if you pass the reflex save so it is consistent with the description.

Holy trap, clear nonsense, however the damage is so ridiculously low that it doesn't really matter. If damage is changed then an actual attack roll could be added.
Mealir Ostirel - Incorrigible swashbuckler
User avatar
Kitunenotsume
Posts: 631
Joined: Sun May 17, 2020 10:57 pm
Location: UTC -7

Re: Vanilla Placeable Trap Script Errors

Unread post by Kitunenotsume »

Valefort wrote: Sun Sep 06, 2020 6:58 pm Fixed the relevant 2da file after much misunderstanding, trap kits of all kinds should now allow to lay the corresponding traps.
Thank you! I'll probably end up testing them soon.
I play a baker. Sometimes she provides counseling or treatment.
Ask about our Breadflower daily special to save five coppers off a purchase of five pastries.
She seems unusually interested in cursed items.
She has also been seeking a variety of gems and stones.
Post Reply

Return to “Solved Problems”