Author Topic: Creature Abilities  (Read 495 times)

Legacy_RealityRevision

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Creature Abilities
« on: October 25, 2010, 08:50:23 am »


               Hi everybody,
does anybody of you know, how to give creatures abilities that are not on the defined list?
Unfortunately I've no scripting experience, that exceeds editing variables in a given script.

For example:
cockatrice  (On successful hit, Fort DC 12, petrify)
Behir (7d6 electricity, Ref DC 19, 1/2 damage, usable every 10 rounds)
Chimera (3d8 fire, Ref DC 17, 1/2 damage, usable every 1d4 rounds)

There are abilites defined that are similar to those I need, but in most cases the DC are incorrect. cockatrice with Flesh to stone on hit has DC 19, but I can't lower it. 

Can someone help me?
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Creature Abilities
« Reply #1 on: October 25, 2010, 07:44:03 pm »


               Example:
cockatrice
1) find the ability - Opening the creature (located in the standard palette under Magical Beasts) with Edit Copy in the toolset, I looked at its Special Abilities Tab to see that it had Touch, Petrification. If I simply wanted to add more abilities, I could easily do it in this tab, or in the Spells tab, if I wanted to make Merlin the Spellcasting cockatrice.

2) find the ability in spells.2da - using NWN Explorer (link: http://nwvault.ign.c...Detail&id=1369  ), I look in NWN: HotU Main Data, the Game Data folder, for spells.2da. I export it by right clicking on the display section to the right and choosing Export Text. I open the spells.2da.txt file with a standard text editor like Notepad, and search for 'petr'. That search shows me Touch_Petrify on line 496. Should I want further verification, I could pull up the tlk table strref, shown in the next column to the right as 3801, using the TalkTableViewer in my nwn install C:\\\\NeverwinterNights\\\\NWN\\\\utils folder.Entering 3801 in the TalkTableViewer, it shows Touch, Petrification, matching the string displayed in the monsters Special Abilities exactly.

3) find the spell script - still looking in the 2da, I check the ImpactScript column, which is 8 columns to the right of the Label column (the label Touch_Petrify was what my search turned up). It shows the script as x0_s1_petrtouch. I open the toolset's script editor, then click to Open an existing file (folder icon on the top). I paste in the name and select the option to show All Resources on the left side of the Select Resource window that pops up. I see the script, so I open it, revealing the following script:

//::///////////////////////////////////////////////////
//:: X0_S1_PETRGAZE
//:: Petrification touch attack monster ability.
//:: Fortitude save (DC 15) or be turned to stone permanently.
//:: Copyright (c) 2002 Floodgate Entertainment
//:: Created By: Naomi Novik
//:: Created On: 11/14/2002
//::///////////////////////////////////////////////////

#include "x0_i0_spells"

void main()
{
    object oTarget = GetSpellTargetObject();
    int nHitDice = GetHitDice(oTarget);

    DoPetrification(nHitDice, OBJECT_SELF, oTarget, GetSpellId(), 15);
}

4) Edit the spell script. We need to modify the script so that it retains its normal behavior except when we want it to do something different. To do this, we'll need to identify the creature we want to change the behavior for in some way. We could set a petrification dc variable on it in the toolset and use the number stored in it, or we can simply set the number in script, checking for some other thing unique to the creature. A simple way to do this is to add a check for its tag. Looking in the toolset, the cockatrice's tag is X0_cockatrice - I'll use that for this example.


//::///////////////////////////////////////////////////
//:: X0_S1_PETRGAZE
//:: Petrification touch attack monster ability.
//:: Fortitude save (DC 15) or be turned to stone permanently.
//:: Copyright (c) 2002 Floodgate Entertainment
//:: Created By: Naomi Novik
//:: Created On: 11/14/2002
//::///////////////////////////////////////////////////

#include "x0_i0_spells"

void main()
{
    object oTarget = GetSpellTargetObject();
    int nHitDice = GetHitDice(oTarget);
   
    int nDC = 15;//We'll store the original DC here, and change the DoPetrification line to use nDC instead of 15
    if (GetTag(OBJECT_SELF) == "X0_cockatrice")
        nDC = 12;//Now we override it for all creatures with the tag X0_cockatrice

    DoPetrification(nHitDice, OBJECT_SELF, oTarget, GetSpellId(), nDC);
}


LMK if you have any questions.

Funky
               
               

               


                     Modifié par FunkySwerve, 25 octobre 2010 - 07:15 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Creature Abilities
« Reply #2 on: October 25, 2010, 08:15:47 pm »


               Please note, the X0_cockatrice tags should be in all caps - these boards don't seem to want to allow that for some reason.
               
               

               
            

Legacy_RealityRevision

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Creature Abilities
« Reply #3 on: October 25, 2010, 11:51:40 pm »


               Hi FunkySwerve,

first of all, thank you for your intensive help.

The good thing is, that I understand what you did. I've tested the script and the cockatrice had a DC of 12. :-)

I didn't noticed that the original cockatrice had 'this' special ability. I've made new blueprints for the creatures in my module. When I tried to create the cockatrice I gave him a creature-weapon with the ability: cast flesh to stone on hit (so it doesn't waste an action). Although there were spell-levels to choose, I couldn't lower the DC of 19.



The bad thing on the other side is, that each problem is different and I don't know how to change the scripts. I know there are Script-Generators and I tested one. But I didn't get the result I was looking for.



Maybe the functions doesn't exist.

So I think this problem is too complex for me to do.



Nonetheless I thank you for your time and your help FunkySwerve.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Creature Abilities
« Reply #4 on: October 26, 2010, 12:13:18 am »


               If it's onhit: cast spell flesh to stone, that just means you need to edit the flesh to stone spell. Following the same process as above, that's the x0_s0_stoflesh script. I'd post an example, but the spell scripts of the mod I'm in at present are heavily modified. If you can't figure it out, just post your x0_s0_stoflesh script and I can show you - it's essentially the same thing with a different script.



Funky
               
               

               
            

Legacy_RealityRevision

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Creature Abilities
« Reply #5 on: October 26, 2010, 12:23:15 am »


               Okay, lets try it:
This is x0_s0_fleshsto. You meant this one, or is it really x0_s0_stoflesh?

//::///////////////////////////////////////////////
//:: Flesh to Stone
//:: x0_s0_fleshsto
//:: Copyright (c) 2002 Bioware Corp.
//:://////////////////////////////////////////////
/*
//:: The target freezes in place, standing helpless.
*/
//:://////////////////////////////////////////////
//:: Created By: Brent Knowles
//:: Created On: October 16, 2002
//:://////////////////////////////////////////////
#include "X0_I0_SPELLS"
#include "x2_inc_spellhook"

void main()
{

/*
  Spellcast Hook Code
  Added 2003-06-20 by Georg
  If you want to make changes to all spells,
  check x2_inc_spellhook.nss to find out more

*/

    if (!X2PreSpellCastCode())
    {
    // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
        return;
    }

// End of Spell Cast Hook


    //Declare major variables
    object oTarget = GetSpellTargetObject();
    int nCasterLvl = GetCasterLevel(OBJECT_SELF);

    if (MyResistSpell(OBJECT_SELF,oTarget)
    {
       DoPetrification(nCasterLvl, OBJECT_SELF, oTarget, GetSpellId(), GetSpellSaveDC());
     }
}

               
               

               


                     Modifié par RealityRevision, 25 octobre 2010 - 11:26 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Creature Abilities
« Reply #6 on: October 26, 2010, 12:31:03 am »


               Whups, no, that's the right one - I just copied one row too low out of the 2da by mistake (486 instead of 485).

Here's the edit:


//::///////////////////////////////////////////////
//:: Flesh to Stone
//:: x0_s0_fleshsto
//:: Copyright (c) 2002 Bioware Corp.
//:://////////////////////////////////////////////
/*
//:: The target freezes in place, standing helpless.
*/
//:://////////////////////////////////////////////
//:: Created By: Brent Knowles
//:: Created On: October 16, 2002
//:://////////////////////////////////////////////
#include "X0_I0_SPELLS"
#include "x2_inc_spellhook"

void main()
{

/*
  Spellcast Hook Code
  Added 2003-06-20 by Georg
  If you want to make changes to all spells,
  check x2_inc_spellhook.nss to find out more

*/

    if (!X2PreSpellCastCode())
    {
    // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
        return;
    }

// End of Spell Cast Hook


    //Declare major variables
    object oTarget = GetSpellTargetObject();
    int nCasterLvl = GetCasterLevel(OBJECT_SELF);

int nDC =
GetSpellSaveDC();
if (GetTag(OBJECT_SELF) == "X0_cockatrice")
    nDC = 12;

   
if (MyResistSpell(OBJECT_SELF,oTarget)
    {
       DoPetrification(nCasterLvl, OBJECT_SELF, oTarget, GetSpellId(), nDC);
     }
}
Again, X0_cockatrice should be all caps, if the forum decaps it again.

Funky