Aller au contenu

Photo

Underwater script systems


  • Veuillez vous connecter pour répondre
37 réponses à ce sujet

#26
Invisig0th

Invisig0th
  • Members
  • 170 messages
Thanks very much, TMSDude. Much appreciated.

#27
Artistmonk

Artistmonk
  • Members
  • 30 messages
TMSdude, yours is hack free but doesn't affect spells correct?

Funky, your code affects spells, does it require anything outside of the NWN engine and script functions?

#28
TSMDude

TSMDude
  • Members
  • 865 messages
It does effect spells. hence the spell hook.

And funkys requires nwnx i would suspect at the least.

#29
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages
Ours does indeed require nwnx, and linux-only plugin nwnx_structs, but only trivially, not for the core functionality. The bubbles, for example, we set a unique effect id on, to check for it and only apply if not present already (and to strip when leaving watewr). You don't really need the bubble vfx at all - things like this we just use, well, because we can. :P

Funky

#30
TSMDude

TSMDude
  • Members
  • 865 messages

FunkySwerve wrote...

Ours does indeed require nwnx, and linux-only plugin nwnx_structs, but only trivially, not for the core functionality. The bubbles, for example, we set a unique effect id on, to check for it and only apply if not present already (and to strip when leaving watewr). You don't really need the bubble vfx at all - things like this we just use, well, because we can. :P

Funky

You can add it as well as we did this way;


    if (iROUND > iHOLD)
        {
        int iDC = GetLocalInt(oPC,"DC");                    // << DC to keep holding breath
        if (iCONSave>=iDC)
            {
            iDC=iDC+1;
            SetLocalInt(oPC,"DC",iDC);
            SendMessageToPC(oPC,"** You are barely holding your breath **");
            FloatingTextStringOnCreature("** blub blub **", oPC);
            ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_DUR_BUBBLES), oPC);

While not as purdy as scripts of real scripters we tried, lol....it fires off every 6 seconds flying off the PC making the sound and all that.

#31
Invisig0th

Invisig0th
  • Members
  • 170 messages
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 .


#32
Artistmonk

Artistmonk
  • Members
  • 30 messages
Ok, so yours works as is correct TSM, just add script to module?

#33
TSMDude

TSMDude
  • Members
  • 865 messages

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 .


#34
Artistmonk

Artistmonk
  • Members
  • 30 messages
Thanks will give it a look, scripting noob, will google spellhooking.

#35
ShadowM

ShadowM
  • Members
  • 768 messages
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

#36
HUNTER_of_Wisdom

HUNTER_of_Wisdom
  • Members
  • 9 messages

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:

#37
Squatting Monk

Squatting Monk
  • Members
  • 444 messages
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. :P

#38
HUNTER_of_Wisdom

HUNTER_of_Wisdom
  • Members
  • 9 messages
I understood ...
Well, do not cost to try.

Thanks for your help.