Author Topic: Unlimited spells per day?  (Read 1337 times)

Legacy_electricfish

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Unlimited spells per day?
« on: August 19, 2010, 12:30:37 pm »


               Is it possible to modify the game in a way to have unlimited spells per day? In NWN2 all it takes is changing a variable in a 2da file. Since NWN is a little clunkier, I don't think it's that easy and there's no convenient Warlock class to look up.
Is there a 2da file relating to spellcasters that can be edited to allow for unlimited casting with vanilla spell slots? How about lots of spell slots (over 30)? Barring that, is it possible to somehow make resting basically instant so it's a psuedo-infinite spells per day? Like, I press a button or type a thing and bam! Spells restored.
               
               

               


                     Modifié par Zorr Crew, 19 août 2010 - 11:31 .
                     
                  


            

Legacy_Psyammy

  • Jr. Member
  • **
  • Posts: 83
  • Karma: +0/-0
Unlimited spells per day?
« Reply #1 on: August 19, 2010, 12:48:16 pm »


               i got this very fast rest from shadooow, it is very fast i dont know if this is any good to you but it will do what you asked
http://social.biowar...index/3275496/2
               
               

               


                     Modifié par Psyammy, 19 août 2010 - 11:48 .
                     
                  


            

Legacy_C Writer

  • Jr. Member
  • **
  • Posts: 73
  • Karma: +0/-0
Unlimited spells per day?
« Reply #2 on: August 19, 2010, 12:50:25 pm »


               I don't know about the first, but instant resting should be simple. In the module's OnPlayerRest event handler, replace the script with this:



void main()

{

   object oPC = GetLastPCRested();

   if (GetLastRestEventType() == REST_EVENTTYPE_REST_STARTED)

   {

       AssignCommand(oPC, ClearAllActions());

       ForceRest(oPC);

       ExecuteScript("x2_mod_def_rest", GetModule()); // If you already have a custom script, then change the name here



       // Functions below this point are purely for flavour; they are not required but still recommended

       BlackScreen(oPC);

       DelayCommand(1.5, FadeFromBlack(oPC, FADE_SPEED_FAST));

       AssignCommand(oPC, PlaySound("sim_magsleep"));

   }

}
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Unlimited spells per day?
« Reply #3 on: August 19, 2010, 01:14:41 pm »


               you can change amount of spells the character can cast in cls_spgn_*.2das however there isnt value for unlimited. Also there may be some limit maybe 256? well if you experience crash try values lower 256. Other than that, it should be server-side change, so you wont need hak.



The scripting missing IncrementSpellUses function which would do this possible. But if you are trying to make Warlock class, you must make new class and all his spells must be feat-like, because nwn engine do not allow new spellcasters (note that linux NWNX can). There was attempts to do Warlocks already. PRC has him - also I saw one video with custom Warlock, not sure what guy made it. Even I have plans to do him, but waiting for some new NWNX functionalities so I could avoid troublesome workarounds, the all previous Warlocks suffers.
               
               

               
            

Legacy_Genisys

  • Hero Member
  • *****
  • Posts: 961
  • Karma: +0/-0
Unlimited spells per day?
« Reply #4 on: August 19, 2010, 01:50:23 pm »


               U could create an item with unlimited uses, which in turn would instantly rest the PC, and instantly buff the PC Caster (in one use)..  That would be more or less the way to go..  (Of course you wouldn't want to check to see if they were in combat, for them to truly have unlimited spells All The Time)

Unfortunately, this item would be a free Heal Spell too..
               
               

               


                     Modifié par Genisys, 19 août 2010 - 12:51 .
                     
                  


            

Legacy_electricfish

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Unlimited spells per day?
« Reply #5 on: August 19, 2010, 04:01:08 pm »


               My fault for not being clear. I don't want to make a new class, but rather modify existing vanilla ones to get some extra amusement out of spellcasters. I only mention the Warlock because it is the single class in NWN2 that even has infinite casting and is pretty much the only reason for the "InfiniteSpells" column in the 2da file.

But perhaps you could elaborate on the IncrementSpellUses function and how it could be used? I'll be trying out the rest script given by the person above, but I would like to try and find a more spell focused method if it's even possible. i.e. not restoring health, spell-like abilities, etc. at the same time.

ShaDoOoW wrote...

you can change amount of spells the character can cast in cls_spgn_*.2das however there isnt value for unlimited. Also there may be some limit maybe 256? well if you experience crash try values lower 256. Other than that, it should be server-side change, so you wont need hak.

The scripting missing IncrementSpellUses function which would do this possible. But if you are trying to make Warlock class, you must make new class and all his spells must be feat-like, because nwn engine do not allow new spellcasters (note that linux NWNX can). There was attempts to do Warlocks already. PRC has him - also I saw one video with custom Warlock, not sure what guy made it. Even I have plans to do him, but waiting for some new NWNX functionalities so I could avoid troublesome workarounds, the all previous Warlocks suffers.


               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Unlimited spells per day?
« Reply #6 on: August 19, 2010, 04:07:26 pm »


               Well that function currently do not exist, if it does, than making any spell unlimited would be soo easy. You woul have to just call it in the spellhook script to increase ammount just cast spell by one.
               
               

               
            

Legacy_C Writer

  • Jr. Member
  • **
  • Posts: 73
  • Karma: +0/-0
Unlimited spells per day?
« Reply #7 on: August 19, 2010, 04:41:33 pm »


               

Genisys wrote...

Unfortunately, this item would be a free Heal Spell too..


Actually, it might be possible to set the amount of HPs the PC had before they rested as a local integer and then after they 'rest', deal damage to them equal to their maximum HPs minus this integer so that their HPs remains unchanged. I'm not entirely certain, but this may or may not require that the damaging command be delayed by a fraction of a second (0.1 should work) to avoid killing the PC.
               
               

               
            

Legacy_Genisys

  • Hero Member
  • *****
  • Posts: 961
  • Karma: +0/-0
Unlimited spells per day?
« Reply #8 on: August 19, 2010, 06:03:16 pm »


               Actually C Writer, I've found this hideous server crashing / lockup bug by assigning damage..

For some strange reason, when I had applied damage through scripting to the PC, when they go to rest the next time, it locked up the whole server and sometimes crashed it as well..

I'm not sure how this happened, but it definitely was happening through my damage script, so I took it out..

Any clue what was going on there?

I don't have the old script, sorry..
               
               

               


                     Modifié par Genisys, 19 août 2010 - 05:05 .
                     
                  


            

Legacy_C Writer

  • Jr. Member
  • **
  • Posts: 73
  • Karma: +0/-0
Unlimited spells per day?
« Reply #9 on: August 19, 2010, 06:36:43 pm »


               Funny, I've tried making a force rest item and it worked fine. Might just be the script, so here's what I wrote:

void main()
{
        if (GetTag(GetItemActivated()) != "ITEM_TAG_HERE") return;

        object oPC = GetFirstPC();

        SetLocalInt(oPC, "CurrentHP", GetCurrentHitPoints(oPC));
     ForceRest(oPC);
     ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(GetMaxHitPoints(oPC) - GetLocalInt(oPC, "CurrentHP")), oPC);
}

Although you are able to see your character taking damage, but I wouldn't personally be bothered by that.
               
               

               


                     Modifié par C Writer, 19 août 2010 - 05:41 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Unlimited spells per day?
« Reply #10 on: August 19, 2010, 06:55:49 pm »


               just a note: you don't have to save it into locals

void main()
{
    if (GetTag(GetItemActivated()) != "ITEM_TAG_HERE") return;

    object oPC = GetFirstPC();

    int nHP = GetCurrentHitPoints(oPC);
    ForceRest(oPC);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(GetCurrentHitPoints(oPC) - nHP), oPC);
    AssignCommand(oPC,ClearAllActions(TRUE));
}

the clear actions clears combat state that will arise from fact the character was damaged
               
               

               


                     Modifié par ShaDoOoW, 19 août 2010 - 05:56 .
                     
                  


            

Legacy_C Writer

  • Jr. Member
  • **
  • Posts: 73
  • Karma: +0/-0
Unlimited spells per day?
« Reply #11 on: August 19, 2010, 06:58:27 pm »


               ^^ Oh yes, that's probably a better way of writing it, so thanks.

EDIT: Hang on, did you just write "GetCurrentHitPoints(oPC) - nHP"? Shouldn't that be the max hit points?
               
               

               


                     Modifié par C Writer, 19 août 2010 - 06:00 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Unlimited spells per day?
« Reply #12 on: August 19, 2010, 07:09:00 pm »


               it could be max hitpoints, but in this time current should be equal to max, well its rather sanity check