Author Topic: Underwater script systems  (Read 1045 times)

Legacy_Invisig0th

  • Sr. Member
  • ****
  • Posts: 279
  • Karma: +0/-0
Underwater script systems
« Reply #30 on: June 07, 2011, 12:40:34 pm »


               The underwater system I'm talking about creating in this thread definitely won't use NWNX, because my system is intended for use in singleplayer and multiplayer modules. Using a HAK would be necessary for some of the more advanced features I've discussed (swimming animations and custom VFX, for starters). However, depending on how things go I may consider a HAKless version as well, since most of the actual scripts would be fairly generic.
               
               

               


                     Modifié par Invisig0th, 07 juin 2011 - 12:54 .
                     
                  


            

Legacy_Artistmonk

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
Underwater script systems
« Reply #31 on: June 08, 2011, 12:04:28 am »


               Ok, so yours works as is correct TSM, just add script to module?
               
               

               
            

Legacy_TSMDude

  • Hero Member
  • *****
  • Posts: 1515
  • Karma: +0/-0
Underwater script systems
« Reply #32 on: June 08, 2011, 01:19:00 am »


               

Artistmonk wrote...

Ok, so yours works as is correct TSM, just add script to module?

It is not one script but snippets of several scripts you need to add to a module.

You need to do some Spell Hook stuff.

You need to do some OnArea Enter/Exit work.

You need to know how to set variables on areas and/or creatures you do not want to drown.

But yes there is no extra haks or what not and this is an old system as our new is a bit better but that is because I finally am understanding haks and NWNX and the power it gives you to truly mod NWN to something terrificly terrific.
               
               

               


                     Modifié par TSMDude, 08 juin 2011 - 12:19 .
                     
                  


            

Legacy_Artistmonk

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
Underwater script systems
« Reply #33 on: June 08, 2011, 04:27:30 pm »


               Thanks will give it a look, scripting noob, will google spellhooking.
               
               

               
            

Legacy_ShadowM

  • Hero Member
  • *****
  • Posts: 1373
  • Karma: +0/-0
Underwater script systems
« Reply #34 on: February 11, 2012, 03:31:26 pm »


               I found this interesting, figured I mention how I did my underwater system for HR Base. I made it so freedom of movement does not affect speed reduction effect in full environment like underwater, but swimming skill does. So I set it to decrease the penalty the higher the swimming skill and decrease the attack penalty the more ranks you put into swim skill (this way no spell or item will decrease you attack penalty, making actually putting points into swim is needed and the skill is useful) I also made water breathing a feat, this allows you to put it on a item(bonus feat) and only have to script a GetHasFeat check instead of cycling through all the items. I will add later a custom 2da for environment check that match up with the spell.2da with like 0 or ***** work normal 1 being does not work 2 does something different. Just a thought on the custom 2da
               
               

               
            

Legacy_HUNTER_of_Wisdom

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
Underwater script systems
« Reply #35 on: August 06, 2012, 02:06:15 am »


               

FunkySwerve wrote...

Whups, got distracted and forgot the spellhook. Ours is pretty simple, really, without too much focus on altering individual spells. Here it is:


#include "hg_inc"
#include "x2_inc_switches"

void main () {
    /* Underwater effects on spells, by FunkySwerve */
    int nSpellId = GetSpellId();
    object oParty = GetFirstFactionMember(OBJECT_SELF, TRUE);

    switch (nSpellId) {
        case SPELL_BALL_LIGHTNING:
        case SPELL_CALL_LIGHTNING:
        case SPELL_CHAIN_LIGHTNING:
        case SPELL_ELECTRIC_JOLT:
        case SPELL_GEDLEES_ELECTRIC_LOOP:
        case SPELL_LIGHTNING_BOLT:
        case SPELL_SCINTILLATING_SPHERE:
        case HGSPELL_GREATER_ORB_OF_ELECTRICITY:
        case HGSPELL_LESSER_ORB_OF_ELECTRICITY:
        case HGSPELL_ORB_OF_ELECTRICITY: {
            /* electrical spells damage everyone in the casters party in the same
             * area, for 6 points dmg /casterlevel, and then the spell casts normally */

            int nDamage;
            float fDist, fDamage;
            effect eEffect, eVis;
            object oArea = GetArea(OBJECT_SELF);

            int nAmount = GetCasterLevel(OBJECT_SELF) * 6;

            while (GetIsObjectValid(oParty)) {
                if (GetArea(oParty) == oArea) {
                    fDist = GetDistanceBetween(OBJECT_SELF, oParty);
                    fDamage = (IntToFloat(nAmount) - fDist);
                    nDamage = FloatToInt(fDamage);
                    eEffect = EffectDamage(nDamage, DAMAGE_TYPE_ELECTRICAL);
                    fDist = fDist / 100;
                    DelayCommand(fDist, ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oParty));
                    DelayCommand(fDist + 0.1, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oParty));
                }

                oParty = GetNextFactionMember(OBJECT_SELF, TRUE);
            }

            FloatingTextStringOnCreature("The electricity arcs through the water, damaging your party.", OBJECT_SELF);
            break;
        }

        case SPELL_BURNING_HANDS:
        case SPELL_COMBUST:
        case SPELL_CONTINUAL_FLAME:
        case SPELL_DARKFIRE:
        case SPELL_DELAYED_BLAST_FIREBALL:
        case SPELL_ELEMENTAL_SHIELD:
        case SPELL_FIRE_STORM:
        case SPELL_FIREBALL:
        case SPELL_FIREBRAND:
        case SPELL_FLAME_ARROW:
        case SPELL_FLAME_LASH:
        case SPELL_FLAME_STRIKE:
        case SPELL_FLAME_WEAPON:
        case SPELL_FLARE:
        case SPELL_INCENDIARY_CLOUD:
        case SPELL_INFERNO:
        case SPELL_SHADES_FIREBALL:
        case HGSPELL_FIREBURST:
        case HGSPELL_GREATER_ORB_OF_FIRE:
        case HGSPELL_LESSER_ORB_OF_FIRE:
        case HGSPELL_ORB_OF_FIRE:
            FloatingTextStringOnCreature("The water quenches the flames of your spell.", OBJECT_SELF, FALSE);
            SetModuleOverrideSpellScriptFinished();
            break;

        case SPELL_DROWN:
        case SPELL_GUST_OF_WIND:
        case HGSPELL_DESERT_SIROCCO:
            FloatingTextStringOnCreature("This spell doesn't work underwater.", OBJECT_SELF, FALSE);
            SetModuleOverrideSpellScriptFinished();
            break;
    }
}

Some spells and abilities are handled in the individual scripts. Our Wall of Fire spell, for example, has a different effect above level 20, so is handled in the spellscript proper. Other scripts to check include shifter scripts (dragon breath, for example), and summons (fire elementals, and presumably water elementals), which are handled separately for various reasons, some of which may or may not apply to your situation :


hgs_gen_shifter (98):         if (GetLocalString(GetArea(si.caster), "Area_SpellHook") == "zwund_spellhook") {
hgs_gen_shifter (149):         if (GetLocalString(GetArea(si.caster), "Area_SpellHook") == "zwund_spellhook") {
hgs_gen_shifter (588):     if (GetLocalString(GetArea(si.caster), "Area_SpellHook") == "zwund_spellhook") {
nw_s0_newsummon (103):     if (GetStringLeft(GetTag(GetArea(si.caster)), 5) == "zwund")
nw_s0_wallfire (59):     if (si.clevel < 20 && GetLocalString(oArea, "Area_SpellHook") == "zwund_spellhook") {
x2_s2_discbreath (110):         GetLocalString(GetArea(OBJECT_SELF), "Area_SpellHook") == "zwund_spellhook") {

Area-specific spellhooks like this underwater one are checked for at the end of the spellhook proper, with this bit of code:


    string sScript = GetLocalString(oArea, "Area_SpellHook");
    if (sScript != "")
        ExecuteScript(sScript, oCaster);

They follow checks for dead magic zones, amnesia, artifacts, an autocaster, and the like.

Funky





I like this, FUNK, But where I find the "hg_inc", "hg_area_inc","hg_antiex_inc", "fky_environ_inc" and "ac_qstatus_inc"  ???? ':crying:'
               
               

               
            

Legacy_Squatting Monk

  • Hero Member
  • *****
  • Posts: 776
  • Karma: +0/-0
Underwater script systems
« Reply #36 on: August 08, 2012, 12:32:52 am »


               Holy thread necromancy, Batman!

Those are scripts specific to Higher Ground. Funky may be willing to share (nudge, nudge), but HG likes to save the best of the best for themselves and make the rest of us drool. '<img'>
               
               

               
            

Legacy_HUNTER_of_Wisdom

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
Underwater script systems
« Reply #37 on: August 12, 2012, 04:45:42 am »


               I understood ...
Well, do not cost  to try.

Thanks for your help.