Author Topic: REQUEST FOR NEW IDEAS TO SCRIPT  (Read 2612 times)

Legacy_hexmendacious

  • Newbie
  • *
  • Posts: 19
  • Karma: +0/-0
REQUEST FOR NEW IDEAS TO SCRIPT
« Reply #60 on: December 08, 2010, 06:23:27 pm »


               I have one... how about a "Destroyable Buildings" set of scripts.  I've been tinkering with the idea for days and getting nowhere (but learning more scripting, at least).  Here's how I see such a thing:

Areas where Destroyable Buildings are available are small(ish).  Builder places a number of invisible "Attack Points" or "Foundation Stones" around the buildings.  Rather than being able to destroy just one building, the idea would be for attackers to destroy a number of buildings in an area before the destroyed version kicks in, just for practical considerations.  Builder creates copy of area  remade to be destroyed (using tileset editor and placeables). When all the attack points have been destroyed, all players in the area are transitioned to the destroyed version of the area, and a variable is set so that all area transitions TO the area now go to the Destroyed version.

All areas inside buildings that are connected to a Destroyable Area have an invisible object placed in them, too, linking them to the area that can be destroyed.  When someone attacks one of the attack points and does significant damage, players inside the buildings have their screen shake and crumbling sound play, and receive a warning that the area they are in is under attack.  If they don't get out before all the attack points have been destroyed for the linked outside area, they must make a saving throw or die (or be reduced to 1hp, or whatever). Either way (living or dead), they are then transitioned to the destroyed version of the area (outside of the building), representing their narrow escape or corpse being flung from the ruins. The Destroyed area obviously has no area transitions into the now destroyed buildings, making those areas inaccessable.  Similarly, if someone logs into a buidling that has been destroyed, a script transports them to the outside destroyed area.

Something like this would address one of the biggest problems I see with PWs - the static nature of the tilesets.  Sure it would make building more work, but I think it would be really cool.

I was playing around with the onDamaged and onDeath events of the "attack points" and the area heartbeat script to try and make it work.  Obviously, the data about what is destroyed would need to be stored in a DB so that it would remain persistant over reset.  Finally, some kind of system of 'rebuilding' could be made, so that players could restore Destroyed Areas.

Does such a thing even sound workable for multi-player, or am I just dreaming again? '=]'  Does anything like this already exist??
               
               

               
            

Legacy_ehye_khandee

  • Hero Member
  • *****
  • Posts: 1415
  • Karma: +0/-0
REQUEST FOR NEW IDEAS TO SCRIPT
« Reply #61 on: December 08, 2010, 07:28:03 pm »


               *nods* Yeah we got that too - not sure how extractable-from-the-mod it will be but I'll look.



               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
REQUEST FOR NEW IDEAS TO SCRIPT
« Reply #62 on: December 08, 2010, 10:58:42 pm »


               I don't think destroyable buildings exist anywhere, and I can't really think of a good way to do them convincingly with tiles as opposed to placeables (I have in mind your remark about addressing the static nature of tilesets, above). We did do something similar to this, however, in a forested area, where the players were complaining about trees obstructing their view. We set the trees to be destroyable via fire spells through an area-specific spellhook.Several scorch marks and fires are spawned in randomly around the spot where the tree was. Pyromania is all in good fun, after all. '<img'> Here's the code for the spell hook, I imagine you could do much the same with building/ruined building places and rubble:


#include "hg_inc"
#include "x2_inc_switches"

void DestroyFire (object oFire) {
    SetPlotFlag(oFire, FALSE);
    DestroyObject(oFire);
}

void DestroyTree (object oTree) {
    SetPlotFlag(oTree, FALSE);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, SupernaturalEffect(EffectDeath()), oTree);
    DestroyObject(oTree, 0.5);
}

void SpawnFire (location lLoc) {
    object oObj;

    switch (Random(4)) {
        case 0: oObj = CreateObject(OBJECT_TYPE_PLACEABLE, "ph_burningcanopy", lLoc); break;
        case 1: oObj = CreateObject(OBJECT_TYPE_PLACEABLE, "ph_burningcanop2", lLoc); break;
        case 2: oObj = CreateObject(OBJECT_TYPE_PLACEABLE, "ph_burningcanop3", lLoc); break;
        case 3: oObj = CreateObject(OBJECT_TYPE_PLACEABLE, "ph_burningcanop4", lLoc); break;
    }

    DelayCommand(IntToFloat(10 + Random(20)), DestroyFire(oObj));
}

void SpawnBlaze (vector vVec) {
    object oArea = GetArea(OBJECT_SELF);
    vector vVecNew;
    location lLoc;
    int i, nFires = 2 + d4();

    for (i = 0; i < nFires; i++) {
        vVecNew = Vector(vVec.x + (Random(11) - 5), vVec.y + (Random(11) - 5), vVec.z + ((Random(11) - 5) / 10.0));
        lLoc    = Location(oArea, vVecNew, 0.0);
        SpawnFire(lLoc);
    }
}

void main() {
    int nSpellId = GetSpellId();
    float fRadius;

    switch (nSpellId) {
        case SPELL_FIREBALL:     fRadius = 20.0; break;
        case SPELL_FIRE_STORM:   fRadius = 30.0; break;
        case SPELL_FLAME_STRIKE: fRadius = 15.0; break;
        default: return;
    }

    object oTarget = GetSpellTargetObject();
    location lTarget = GetSpellTargetLocation();

    if (GetIsObjectValid(oTarget))
        lTarget = GetLocation(oTarget);

    float fDelay, fMaxDist = fRadius / 2.0;
    vector vTarget, vSpell = GetPositionFromLocation(lTarget);

    for (oTarget = GetFirstObjectInShape(SHAPE_SPHERE, fRadius, lTarget, FALSE, OBJECT_TYPE_PLACEABLE);
         GetIsObjectValid(oTarget);
         oTarget = GetNextObjectInShape(SHAPE_SPHERE, fRadius, lTarget, FALSE, OBJECT_TYPE_PLACEABLE)) {

        if (!GetPlotFlag(oTarget) || GetFortitudeSavingThrow(oTarget) < 80)
            continue;

        vTarget = GetPosition(oTarget);

        if (fabs(vTarget.x - vSpell.x) > fMaxDist || fabs(vTarget.y - vSpell.y) > fMaxDist)
            continue;

        fDelay = 1.0 + (Random(20) / 10.0);
        DelayCommand(fDelay, ApplyVisualAtLocation(VFX_FNF_FIREBALL, GetLocation(oTarget)));
        DelayCommand(fDelay + 0.2, SpawnBlaze(vTarget));

        DelayCommand(fDelay + 0.1, DestroyTree(oTarget));
    }
}


Funky
               
               

               
            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
REQUEST FOR NEW IDEAS TO SCRIPT
« Reply #63 on: December 10, 2010, 07:23:41 pm »


               Here is some ideas i would like;

1/A set spear attack for fighters vs charging horses.

2/A way for fighters to run and charge with a weapon.

3/A way for those who shoot with thier ranged weapons into a melee have a chance to hit thier friends. (like a Area of Effect)

4/A way to make item descriptions lie.
                i.e. Cursed items
               
               

               
            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
REQUEST FOR NEW IDEAS TO SCRIPT
« Reply #64 on: December 10, 2010, 07:26:18 pm »


               And on the destroyable, you can make any placeable flammable in our mod and we got that from the vault if I remember. We mprove don it a bit but just by adding a variable to ANY placeable you can set it on fire/destroy it with the proper spells or fire or what not.



Just do a search for flammable I think it was.
               
               

               
            

Legacy_Frith5

  • Hero Member
  • *****
  • Posts: 595
  • Karma: +0/-0
REQUEST FOR NEW IDEAS TO SCRIPT
« Reply #65 on: December 10, 2010, 07:57:07 pm »


               My flint and steel scripts do that, but so do a bunch of others, and probably better. '<img'>

Something else I'd like, that I haven't tried to do myself:

1. The ability to interact with the nearest object specified by a chat command. ie PC walks up to a door, chats !open door, and then opens the door she's facing. I hate taking my hands off the keyboard.
This would be useful for targeting many things besides doors, of course. Such as !open chest, or !bash door, or !knock door, etc. Could use it to attack too. !kill Frith would target the object named Frith, if it exists and is in perception range, or in the area found to be right 'in front' of the calling object.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
REQUEST FOR NEW IDEAS TO SCRIPT
« Reply #66 on: December 11, 2010, 05:11:51 am »


               

Frith5 wrote...

1. The ability to interact with the nearest object specified by a chat command. ie PC walks up to a door, chats !open door, and then opens the door she's facing. I hate taking my hands off the keyboard.
This would be useful for targeting many things besides doors, of course. Such as !open chest, or !bash door, or !knock door, etc. Could use it to attack too. !kill Frith would target the object named Frith, if it exists and is in perception range, or in the area found to be right 'in front' of the calling object.

You got one hand amputated?:innocent:
               
               

               
            

Legacy_Frith5

  • Hero Member
  • *****
  • Posts: 595
  • Karma: +0/-0
REQUEST FOR NEW IDEAS TO SCRIPT
« Reply #67 on: December 11, 2010, 02:34:01 pm »


               No, thank God.

I find it distracting to take my hands from the keyboard, to click a mouse. It'd be a lot faster for me to simply keep my hands on the keys and chat some commands to take the place of grabbing the mouse, targeting the door, and clicking.

My usual manner is left hand for moving about with WASDZ, my right using the arrow keys to control the camera. Thus, the desire to avoid the mouse for interacting with things, especially during RP, where the chat bar is so important to me.

Meh. Maybe I'm just so used to MUDs that I want to replicate that system here? '<img'>

JFK
               
               

               
            

Legacy_hexmendacious

  • Newbie
  • *
  • Posts: 19
  • Karma: +0/-0
REQUEST FOR NEW IDEAS TO SCRIPT
« Reply #68 on: December 12, 2010, 12:52:21 am »


               Thanks for the code Funky, I could use that.  As for making reasonable destroyed versions - well, I'm just doing the best I can with the destroyed building City tileset options, and the many CEP NWN2 ruined buildings placeables.
               
               

               
            

Legacy_Bubba McThudd

  • Sr. Member
  • ****
  • Posts: 254
  • Karma: +0/-0
REQUEST FOR NEW IDEAS TO SCRIPT
« Reply #69 on: December 13, 2010, 07:24:40 pm »


               How about a potion of "Full Manna" for mages that gives the effect of a full night's rest.
               
               

               
            

Legacy_Mac-Biodiesel

  • Newbie
  • *
  • Posts: 19
  • Karma: +0/-0
REQUEST FOR NEW IDEAS TO SCRIPT
« Reply #70 on: December 13, 2010, 10:28:14 pm »


               

Bubba McThudd wrote...

How about a potion of "Full Manna" for mages that gives the effect of a full night's rest.


...and it should cost 100k gold to buy one and 5,000 XP to use it.  '<img'>
               
               

               
            

Legacy_Bubba McThudd

  • Sr. Member
  • ****
  • Posts: 254
  • Karma: +0/-0
REQUEST FOR NEW IDEAS TO SCRIPT
« Reply #71 on: December 13, 2010, 11:15:37 pm »


               Actually I was envisioning some sort of constitution penalty with a chance of permanent lowering, but yeah...
               
               

               
            

Legacy_jmlzemaggo

  • Hero Member
  • *****
  • Posts: 1869
  • Karma: +0/-0
REQUEST FOR NEW IDEAS TO SCRIPT
« Reply #72 on: December 14, 2010, 12:04:26 am »


               Massage in a bottle! For any caster actually, clerics, bards... also... ;-)
That is possible, I saw it twice already in modules.
A "Fountain of recuperation" I think it's called.
               
               

               


                     Modifié par jmlzemaggo, 14 décembre 2010 - 12:08 .
                     
                  


            

Legacy_eeriegeek

  • Jr. Member
  • **
  • Posts: 75
  • Karma: +0/-0
REQUEST FOR NEW IDEAS TO SCRIPT
« Reply #73 on: December 14, 2010, 12:15:19 am »


               Bubba, turn on tag based scripting in your module, create a new potion item and put the following in a script. Save the script with the same name as the tag of your new potion.

#include "x2_inc_switches"

void main() {

 SetExecutedScriptReturnValue(X2_EXECUTE_SCRIPT_END);

 if (GetUserDefinedItemEventNumber()==X2_ITEM_EVENT_ACTIVATE) {
  ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_IMP_HEAD_MIND),GetItemActivator());

  ForceRest(GetItemActivator());

 }

}

[Edit: oops, forgot... you also have to put the "Cast Spell: Activate Item" property on your new potion!]
               
               

               


                     Modifié par eeriegeek, 14 décembre 2010 - 12:18 .
                     
                  


            

Legacy_jmlzemaggo

  • Hero Member
  • *****
  • Posts: 1869
  • Karma: +0/-0
REQUEST FOR NEW IDEAS TO SCRIPT
« Reply #74 on: December 14, 2010, 06:05:51 am »


               Et voilà. Nothing is NWN impossible.

The rule.



(Funny, I see I still dream about modulling again... It's like a curse. Once you got infected...)