Author Topic: Wall of Stone script  (Read 396 times)

Legacy_Calgacus

  • Full Member
  • ***
  • Posts: 195
  • Karma: +0/-0
Wall of Stone script
« on: August 14, 2011, 01:07:27 am »


               Hi,
Was thinking of doing a wall of stone spell,  but odds are someone already did.  Anyone know of such a script?  I was lookin at the blade barrier and wall of fire scripts but there is nothing in there about how to orient the AOE. It would be nice if the script allowed the player to choose an orientation.
               
               

               
            

Legacy_Sethan_1

  • Jr. Member
  • **
  • Posts: 50
  • Karma: +0/-0
Wall of Stone script
« Reply #1 on: August 14, 2011, 01:44:16 am »


               Not sure how you'd go about allowing a player to choose orientation in combat.

The simplest way to deal with it is probably to make the long axis perpendicular to the PC's facing.

Project Q included some nice placeable walls in 1.4,
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Wall of Stone script
« Reply #2 on: August 14, 2011, 02:10:38 am »


               AOE is a sphere. Not sure how you would use an AOE to create a stone wall effect. Did you want the spell to literally create a wall object that that perhaps lasts a certain amount of time or that just needs to be destroyed? You could make it so that it is ground targeted and then just spawn a wall at that location that has the same orientation as the caster like Sethan suggested. You could do other things like set the hardness of the wall based on the casters level or what not. And then of course some placeables have different orientations so you'd have to figure out the facing based on which wall object you were going to use.
               
               

               


                     Modifié par GhostOfGod, 14 août 2011 - 01:11 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Wall of Stone script
« Reply #3 on: August 14, 2011, 02:17:48 am »


               We modded wall of fire to create a wall of stone using cep wall places, way back when in 2005 or so, for casters over a certain level. You just spawn in a wall, and the default orientation is as Sethan describes. You could, I suppose, add alternate orientations to subradial spells, but that seems like a lot of effort for little gain. Here's the spellscript:


//::///////////////////////////////////////////////
//:: Wall of Fire
//:: NW_S0_WallFire.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Creates a wall of fire that burns any creature
    entering the area around the wall.  Those moving
    through the AOE are burned for 4d6 fire damage
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: July 17, 2001
//:://////////////////////////////////////////////

#include "hg_inc"

#include "ac_spell_inc"

void DestroyWall(object oWall) {
    if (GetIsObjectValid(oWall)) {
        DestroyObject(oWall);
    }
}

void main() {
    struct SpellInfo si = GetSpellInfo();
    if (si.id < 0)
        return;

    /* Get the location where the wall is to be placed. */
    object oDoor = GetNearestObjectToLocation(OBJECT_TYPE_DOOR, si.loc);
    location lDoor = GetLocation(oDoor);
    float fDist = GetDistanceBetweenLocations(si.loc, lDoor);
    int nDoor = ((fDist < 2.0) && (GetIsObjectValid(oDoor)) && (!GetIsOpen(oDoor)));

    /* check for Hell energy barriers */
    if (!nDoor) {
        object oCheck = GetFirstObjectInShape(SHAPE_SPHERE, 2.0, si.loc, FALSE, OBJECT_TYPE_PLACEABLE);

        while (GetIsObjectValid(oCheck)) {
            if ((GetTag(oCheck) == "helldoor") && (!GetLocalInt(oCheck, "Open")))
                nDoor = TRUE;
            oCheck = GetNextObjectInShape(SHAPE_SPHERE, 2.0, si.loc, FALSE, OBJECT_TYPE_PLACEABLE);
        }
    }

    object oPush = GetNearestCreatureToLocation(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, si.loc);

    if (si.clevel >= 20 && GetIsObjectValid(oPush) && GetDistanceBetweenLocations(si.loc, GetLocation(oPush)) < 3.0) {
        FloatingTextStringOnCreature("Wall of Stone cannot be cast near a player.", si.caster, FALSE);
        return;
    }


    object oArea = GetArea(si.caster);
    object oTest = GetNearestObjectByTag("wizwallostone");

    if (si.clevel < 20 && GetLocalString(oArea, "Area_SpellHook") == "zwund_spellhook") {
        FloatingTextStringOnCreature("The water quenches the flames of your spell.", si.caster, FALSE);
        return;
    }

    if (si.clevel >= 20 && GetLocalInt(oArea, "NO_PVP")) {
        int bAllow = FALSE;

        /* allow people to push up to the bench in town */
        if (GetResRef(oArea) == "townofascension") {
            vector vPos = GetPosition(si.caster);

            if (vPos.x >= 0.0 && vPos.x <= 10.0 && vPos.y >= 40.0 && vPos.y <= 50.0)
                bAllow = TRUE;
        }

        if (!bAllow) {
            FloatingTextStringOnCreature("Wall of Stone cannot be cast in No PVP areas.", si.caster, FALSE);
            return;
        }
    }


    if (GetIsObjectValid(oTest)) {
        DestroyObject(oTest);
        FloatingTextStringOnCreature("Only one wall of stone may exist in an area at the same time.", si.caster, FALSE);
    }


    float fDur = MetaDuration(si, si.clevel / 2, DURATION_IN_ROUNDS);
    object oWall;

    effect eAOE = EffectAreaOfEffect(AOE_PER_WALLFIRE);


    if (!GetIsPC(si.caster)) {
        ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eAOE, si.loc, fDur);
    } else if (si.clevel >= 40) {
        if (!nDoor) {
            oWall = CreateObject(OBJECT_TYPE_PLACEABLE, "wallofstone40", si.loc);
            AssignCommand(oArea, DelayCommand(RoundsToSeconds(40), DestroyWall(oWall)));
        } else
            FloatingTextStringOnCreature("Wall of stone may not be cast so close to a closed door.", si.caster, FALSE);
    } else if (si.clevel >= 35) {
        if (!nDoor) {
            oWall = CreateObject(OBJECT_TYPE_PLACEABLE, "wallofstone35", si.loc);
            AssignCommand(oArea, DelayCommand(fDur, DestroyWall(oWall)));
        } else
            FloatingTextStringOnCreature("Wall of stone may not be cast so close to a closed door.", si.caster, FALSE);
    } else if (si.clevel >= 30) {
        if (!nDoor) {
            oWall = CreateObject(OBJECT_TYPE_PLACEABLE, "wallofstone30", si.loc);
            AssignCommand(oArea, DelayCommand(fDur, DestroyWall(oWall)));
        } else
            FloatingTextStringOnCreature("Wall of stone may not be cast so close to a closed door.", si.caster, FALSE);
    } else if (si.clevel >= 25) {
        if (!nDoor) {
            oWall = CreateObject(OBJECT_TYPE_PLACEABLE, "wallofstone25", si.loc);
            AssignCommand(oArea, DelayCommand(fDur, DestroyWall(oWall)));
        } else
            FloatingTextStringOnCreature("Wall of stone may not be cast so close to a closed door.", si.caster, FALSE);
    } else if (si.clevel >= 20) {
        if (!nDoor) {
            oWall = CreateObject(OBJECT_TYPE_PLACEABLE, "wallofstone20", si.loc);
            AssignCommand(oArea, DelayCommand(fDur, DestroyWall(oWall)));
        } else
            FloatingTextStringOnCreature("Wall of stone may not be cast so close to a closed door.", si.caster, FALSE);
    } else {
        ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eAOE, si.loc, fDur);
    }

}

It's fairly primitive - really, it should just spawn one place and add temp hit point, resist, and immune effects based on level. It does, however, have fairly advanced antiexploits, which are necessary if you don't want players abusing it to 'push' through tile/door obstacles.


Funky
               
               

               
            

Legacy_Calgacus

  • Full Member
  • ***
  • Posts: 195
  • Karma: +0/-0
Wall of Stone script
« Reply #4 on: August 14, 2011, 04:12:59 am »


               

FunkySwerve wrote...
...

It's fairly primitive - really, it should just spawn one place and add temp hit point, resist, and immune effects based on level. It does, however, have fairly advanced antiexploits, which are necessary if you don't want players abusing it to 'push' through tile/door obstacles.


Funky


what do you mean by *players abusing it to 'push' through tile/door obstacles.*

Thanksfor ythe script, probly just what i need.   How did it work out in practise?  did the players use it much in combat to good effect - or even to too good effect?
If the object is bashable will monsters be smart enough to bash it down?  is so will they attack it instead of players if given the choice?

Not sure if I want it to be a temp wall that is neutral or a bashable wall that monsters will attack.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Wall of Stone script
« Reply #5 on: August 14, 2011, 05:10:49 am »


               If you allow it to spawn too close to pcs, they can use it to push themselves up raises and through locked doors.

It works fine in practice, but be aware that it will generate a great deal of pathing lag. Monsters will NOT target it, unless you alter their ai to, which is probably beyond what you want to get into.

Funky
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Wall of Stone script
« Reply #6 on: August 14, 2011, 06:59:40 am »


               I did wall of stone, ice, force, iron, and thorns for my little mod.  I'm not home right now, so I can't post the scripts until monday, but what FunkySwerve said about pathfinding is correct.  They also don't break LOS for spellcasting, and you can attack an object on the other side of it if you're both close to it.
 There's unfortunately far more hassles with them than benefits, at least in my observations, though as a gimmick spell they are still fun, in small controlled doses.
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Wall of Stone script
« Reply #7 on: August 14, 2011, 08:33:10 pm »


               They have a wall of ice in Argentum Regio.  It's pretty cool.