Author Topic: PnP Turn-Based System via Wands  (Read 358 times)

Legacy_Mad.Hatter

  • Full Member
  • ***
  • Posts: 156
  • Karma: +0/-0
PnP Turn-Based System via Wands
« on: May 29, 2011, 03:26:23 am »


               http://nwvault.ign.c....Detail&id=3814

I wasn't satisfied with the turn-based options available on the
Vault and some of my DM'd campaign players are a bit older and don't do
well in real time so I devised an easy to use and easy to implement option.

This system is controlled by one variable saved on the DM. A wand toggles this variable on or off. A simple heartbeat script checks for that variable and applies a timestop to the module. The DM can then use a second wand called "Next Turn" to remove the effect for 6 seconds (one PnP round). While frozen, DMs and players can queue up their actions and plan tactically like in a PnP game.

I haven't devised a single-player or PW friendly version of this yet (PW's could just substitute their timestop logic into the scripts and cutscene parylize the area rather than timestop the module), but I wanted to share this in the meantime.

-David
               
               

               
            

Legacy_Mad.Hatter

  • Full Member
  • ***
  • Posts: 156
  • Karma: +0/-0
PnP Turn-Based System via Wands
« Reply #1 on: May 29, 2011, 03:45:00 am »


               It's probably obvious but the DM does not freeze between turns. He can move as normal. I'm not sure what the limit of queued actions is but I had spawns, heals, kills, XP giving and so on all queued as soon as real time began again.
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
PnP Turn-Based System via Wands
« Reply #2 on: May 30, 2011, 01:23:18 pm »


               Wouldn't it be better to just play offline or enable player pausing?
               
               

               


                     Modifié par _Guile, 30 mai 2011 - 12:26 .
                     
                  


            

Legacy_Mad.Hatter

  • Full Member
  • ***
  • Posts: 156
  • Karma: +0/-0
PnP Turn-Based System via Wands
« Reply #3 on: May 30, 2011, 04:15:34 pm »


               No. Why would it be?

(1) Considering this is designed for use by a DM and I explicitly mention that it is not designed for single player, playing offline would be nonsensical (I assume you didn't read the post?).
(2) Player pausing has its virtue, and could be enabled given DMs' and players' preference, but having a wand-based, automated solution is preferable because it provides the standard D&D round for real time action before freezing again. It is constant, steady, and reliable (unlike player pausing). Player pausing rarely leads to PnP turn-based style action, particularly if your players are older and have less twitch reflex (my uncle and father prefer playing clerics and wizards... you can imagine how fun it has been as they pause and unpause one another in an attempt to target their spells). Also, from a DM's perspective, a turn-based solution allows me to play the enemy much more intelligently and handle combat better than relying on the AI or randomly pausing (which then appears unfair to the players because it isn't the norm).
               
               

               
            

Legacy_Xardex

  • Sr. Member
  • ****
  • Posts: 414
  • Karma: +0/-0
PnP Turn-Based System via Wands
« Reply #4 on: May 30, 2011, 05:21:39 pm »


               If it is for use by DMs only you dont actually need to do anything, DMs can pause the game whenever they want to. The server option is for just players. You also should consider using the Player/DM tool feats for this purpose (if you go with the timestop effect), since using a wand is counted as an action, and has to go through your queue, whereas the feats bybass the queue.
               
               

               


                     Modifié par Xardex, 30 mai 2011 - 04:22 .
                     
                  


            

Legacy_Mad.Hatter

  • Full Member
  • ***
  • Posts: 156
  • Karma: +0/-0
PnP Turn-Based System via Wands
« Reply #5 on: May 30, 2011, 10:13:14 pm »


               The point of this isn't the pause, it's the consistency of 6 second rounds and queuing actions between those rounds. Of course a DM can pause the game whenever he wants, but this makes sure each player and the DM can play as if NWN were turn based, not sporadic DM pausing.

Xardex: Thanks for the recommendation to use the DM tool feat. I will definitely check that out. I also considered removing the heartbeat entirely by Next Turn doing a timestop DelayCommand by 6 seconds.
               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
PnP Turn-Based System via Wands
« Reply #6 on: May 31, 2011, 04:17:50 pm »


               nwnx_odbc would be ideal for this.

select UNIX_TIMESTAMP()

Retrieves the exact amount of seconds between now and 1/1/1970
eg-  1503294495  or something like that.

If you want to make sure that your players cannot cast spells or act with their wands till after that 6 second timeout, then you simply need to do


SQLExecDirect("SELECT UNIX_TIMESTAMP()");
int iNow = StringToInt(SQLGetData(1));
int iLast = GetLocalInt(oPC,"NEXT_ROUND");
int iDiff = iLast - iNow;
if(iDiff >= 1)
       {
              SendMessageToPC(oPC,"You cannot act for another "+IntToString(iDiff));
              return;
       }


int iFuture = iNow+6;
SetLocalInt(oPC,"NEXT_ROUND",iFuture);




This with a few modifications, will disallow the players to perform the desired action, until 6 seconds has passed since their last action.

I use this system for doing cooldowns on PlayerTool powers in my own PW.
               
               

               
            

Legacy_Xardex

  • Sr. Member
  • ****
  • Posts: 414
  • Karma: +0/-0
PnP Turn-Based System via Wands
« Reply #7 on: May 31, 2011, 05:53:44 pm »


               Actually there is no need to use any nwnx plugins. (hmm... Are they called plugins?)
Also int's are rounded down into full numbers so that script might miss the round start by up to 0.999... seconds.

Here is a few scripts straight from my module.

Put this in an include script
Modify iH if you modified the minutes per hour in your module

// Returns current server time in seconds
int Time();
int Time()
{
    int iTime;
    int iH = 2; // Amount of minutes per hour
    iTime += GetTimeSecond();
    iTime += GetTimeMinute()*60;
    iTime += GetTimeHour()*iH*60;
    iTime += GetCalendarDay()*24*iH*60;
    iTime += GetCalendarMonth()*28*24*iH*60;
    iTime += GetCalendarYear()*12*28*24*iH*60;
    iTime -= GetLocalInt(GetModule(), "zero");
    return iTime;
}


Put this in your OnModuleLoad script

SetLocalInt(GetModule(), "zero", Time());



And after a while of looking through a ridiculous pile of useless scripts I found something that you can easily modify to do what you want. This DOESN'T do what you want as it is, but I did modify it a little for your convenience. '<img'>

#include ""
void main()
{
    object oUser = OBJECT_SELF;  // The one who used the feat.

    // Make sure not to cast it twice in one round
    effect eEff = GetFirstEffect(oUser);
    while (GetIsEffectValid(eEff))       // This doesn't actually work, too tired to fix it
    {                                    //
        if (GetEffectType(eEff) == EFFECT_TYPE_TIMESTOP) {return;}
        eEff = GetNextEffect(oUser);
    }

    int iTime = Time();
    int iRound = (iTime/6);      // Basically equals to the second
        iRound = (iTime*6)+6;    // next server round begins, since int's
                                 // are always rounded down... It should work!

    float fTime = IntToFloat(iTime) + (GetTimeMillisecond()/1000.0); // Must be accurate
    float fRound = IntToFloat(iRound);
    float fN = fRound - fTime;   // Time in seconds until next server round begins

    if (fN != 0.000)
    {DelayCommand(fN, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectTimeStop(), oUser, fN));}
    else
    {ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectTimeStop(), oUser, fN);}

    //
    //
}

Its ready for use, just add it into one of the DM/Player tool feat scripts and it should work... Its not tested though.

What it does (or should do) is pause the game for one round, starting exactly at the beginning of the next round.
               
               

               


                     Modifié par Xardex, 31 mai 2011 - 04:58 .
                     
                  


            

Legacy_Mad.Hatter

  • Full Member
  • ***
  • Posts: 156
  • Karma: +0/-0
PnP Turn-Based System via Wands
« Reply #8 on: May 31, 2011, 06:59:51 pm »


               After a bit more testing, I'm not sure I even need to make a DM tool for this. You see, the DM is not affected by the timestop and so his actions are not queued, they simply don't process until the timestop is removed. He can therefore do whatever he likes (spawn, heal, kill, limbo, etc.) and then activate the wand to advance to the next round. The players can queue actions as normal.

While I'm sure both of your solutions are excellent alternatives, my system is extremely lightweight. I plan to make it even more friendly by eliminating the heartbeat by usingDelayCommand.