NWN2 Dimension Door?
Posted: Mon Mar 23, 2009 6:16 pm
AL (et al), do we have existing code for NWN1 Dimension Door?
Any objections to moving it into NWN2?
Any objections to moving it into NWN2?
Code: Select all
////////////////////////////////////////////////////////////////////////////////
//
// System Name : ALFA Core Rules
// Filename : as_s0_dimdoor.nss
// Version : 1.0
// Date : 2006-09-05
// Author : Ronan
//
// Local Variable Prefix =
//
// Dependencies external of nwscript:
//
// Description
// Generic reporting for the casting of spells which DMs need to be notified
// of.
//
// Revision History
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Includes ////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
#include "X0_I0_SPELLS"
#include "x2_inc_spellhook"
#include "em_include"
////////////////////////////////////////////////////////////////////////////////
// Constants ///////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
const float _DELAY = 2.0;
const int VFX_FNF_TELEPORT_IN = 471;
const int VFX_FNF_TELEPORT_OUT = 472;
////////////////////////////////////////////////////////////////////////////////
// Structures //////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Global Variables ////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Function Prototypes /////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// This spell's code.
void main();
////////////////////////////////////////////////////////////////////////////////
// Function Definitions ////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
void main()
{
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run
// this spell.
if (!X2PreSpellCastCode())
{
return;
}
int nCasterLevel = GetCasterLevel(OBJECT_SELF);
int nMetaMagic = GetMetaMagicFeat();
location lTarget = GetSpellTargetLocation();
int maxCreatures = nCasterLevel / 3;
if(nMetaMagic == METAMAGIC_EMPOWER)
maxCreatures = 2 * maxCreatures;
effect eVis1 = EffectVisualEffect(VFX_FNF_TELEPORT_OUT);
effect eVis2 = EffectVisualEffect(VFX_FNF_TELEPORT_IN);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis1, GetLocation(OBJECT_SELF));
DelayCommand(_DELAY, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis2, lTarget));
DelayCommand(_DELAY, AssignCommand(OBJECT_SELF, ActionJumpToLocation(lTarget)));
object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_MEDIUM, GetLocation(OBJECT_SELF));
while(maxCreatures > 0 && GetIsObjectValid(oTarget)) {
if(oTarget != OBJECT_SELF && ( GetFactionEqual(oTarget)) ) {
int size = GetCreatureSize(oTarget);
int creatureCost = 1;
if(size == CREATURE_SIZE_LARGE)
creatureCost = 2;
else if(size == CREATURE_SIZE_HUGE)
creatureCost = 4;
if(GetIsFriend(oTarget) && creatureCost <= maxCreatures) {
maxCreatures = maxCreatures - creatureCost;
DelayCommand(_DELAY, AssignCommand(oTarget, ActionJumpToLocation(lTarget)));
}
}
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_SMALL, GetLocation(OBJECT_SELF));
}
}
I did mention that I wasn't talking about the PnP version. But if we do want to give capacity to DD into invalid locations (which would come with allowing targeting without line of sight), we're lookin' at some significant server load for calculating a nearby valid location (tricky business), putting the PC there (not so tricky), putting damage in place (also not tricky), and figuring out how this would be worked into a combat situation (tricky business). Or making the spell pretty significantly more powerful than it's pen and paper version of itself -- which I would say consequenceless failure of the spell would be. Half of the reason to not DD without LoS is the risk of popping into a den of bad guys after having lost 14 of your dwindling wizardly hit points.Zelknolf wrote:really can't use DD for all of the stuff you would use it for in PnP
That seems like a fairly solid argument against implementing the PnP version of the spell. More server load is not something we need.Zelknolf wrote:we're lookin' at some significant server load for calculating a nearby valid location
No harm in proposing it. I might argue to leave it fourth level and add simpler functionality that lacks the complications that the spell's full PnP-like power would cause -- like "Target a door to DD to the other side of the door." and/or "Target an AT to go through the AT" -- add the standard RP item clause (( "DMs may choose to use this as if it were PnP, but are not obligated to. As long as they play fair -- NPCs with PnP DD shouldn't be about unless PCs can do the same." )), and say that we're covering most of the bases. At least we're covering the bases that don't require us to call GetDistanceBetweenLocations, and that one is a pure rotten bastard for some unknown reason.mogonk wrote:That seems like a fairly solid argument against implementing the PnP version of the spell. More server load is not something we need.
A version of DD requiring LOS would still have uses. Maybe make it a 3rd lvl spell instead of 4th to reflect the reduced functionality?
Makes a lot of sense. Good call.Zelknolf wrote: I might argue to leave it fourth level and add simpler functionality that lacks the complications that the spell's full PnP-like power would cause -- like "Target a door to DD to the other side of the door." and/or "Target an AT to go through the AT"
this sounds like a pretty elegant way of handling the spell, I like it."Target a door to DD to the other side of the door." and/or "Target an AT to go through the AT"
Targeting a door to appear on the other side of it seems more than reasonable to me, and requiring line of sight for non-DM use would be fine too.Dimension Door
Conjuration (Teleportation)
Level: Brd 4, Sor/Wiz 4, Travel 4
Components: V
Casting Time: 1 standard action
Range: Long (400 ft. + 40 ft./level)
Target: You and touched objects or other touched willing creatures
Duration: Instantaneous
Saving Throw: None and Will negates (object)
Spell Resistance: No and Yes (object)
You instantly transfer yourself from your current location to any other spot within range. You always arrive at exactly the spot desired—whether by simply visualizing the area or by stating direction. After using this spell, you can’t take any other actions until your next turn. You can bring along objects as long as their weight doesn’t exceed your maximum load. You may also bring one additional willing Medium or smaller creature (carrying gear or objects up to its maximum load) or its equivalent per three caster levels. A Large creature counts as two Medium creatures, a Huge creature counts as two Large creatures, and so forth. All creatures to be transported must be in contact with one another, and at least one of those creatures must be in contact with you.
If you arrive in a place that is already occupied by a solid body, you and each creature traveling with you take 1d6 points of damage and are shunted to a random open space on a suitable surface within 100 feet of the intended location.
If there is no free space within 100 feet, you and each creature traveling with you take an additional 2d6 points of damage and are shunted to a free space within 1,000 feet. If there is no free space within 1,000 feet, you and each creature travelling with you take an additional 4d6 points of damage and the spell simply fails.