Author Topic: Morale  (Read 593 times)

Offline StultusTemporis

  • Newbie
  • *
  • Posts: 28
Morale
« on: September 09, 2015, 07:11:14 PM »
Just curious, but how exactly does morale work in the current version of DC?  Does it give the target the isafraid or isfleeing SA's when it reaches a certain threshold, or is there another mechanic at work? 

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9631
Re: Morale
« Reply #1 on: September 09, 2015, 07:39:27 PM »
I dont' think we're doing anything with morale at this point. But, if we were, it would be scripted. :)

Why not doing anything? Not enough agreement on what it should do, and no guidance from FRUA to point the way.

Offline StultusTemporis

  • Newbie
  • *
  • Posts: 28
Re: Morale
« Reply #2 on: September 10, 2015, 06:58:23 PM »
Alright. 

In that case, I'll come up with something so that I can test the morale experiments I'm working on. If you want, I'll post it when it's done so that you can have a look at it.

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9631
Re: Morale
« Reply #3 on: September 10, 2015, 07:28:30 PM »
Alright. 

In that case, I'll come up with something so that I can test the morale experiments I'm working on. If you want, I'll post it when it's done so that you can have a look at it.

Posting your results would be great. :D

Offline StultusTemporis

  • Newbie
  • *
  • Posts: 28
Re: Morale
« Reply #4 on: January 01, 2017, 12:59:15 AM »
First, I am sorry that I didn't get back to this before now.  Things have been busy on my end.

I did a little research into ways morale worked in three of the versions of D&D that FRUA might have taken its cue from.

In Basic D&D each monster was assigned a Morale score between 2 and 12.  When the monster needed to check morale, the DM would roll 2d6, and if the monster rolled equal or  greater than its morale it fled.  If it rolled a 12, it entered a berserk frenzy and would not check for morale after that.

In 1E D&D monsters were not assigned morale.  However, henchmen had a morale score based off of several factors (how well they liked their leader, how strong their leader was, how close in alignment the leader was, etc).  When they needed to check morale, they would roll a DC 15 charisma-based save, with the morale bonus used instead of their level modifier.

In 2E D&D each monster was assigned a Morale score between 2 and 20.  It is my understanding that the morale check was similar to Basic D&D, except with 2d10 instead of 2d6.

Looking at the monsters in DC, they are assigned morale scores between 0 and 50.  If one was to implement the morale systems from D&D, then these numbers would have to be changed in the different monster blocks to match the desired range.  It would be simpler to use the current ranges as a baseline, and then pick a number between 0 and 50 every time the game makes a morale check.  If the number is greater than the monster's morale, then they flee.  Naturally this would need to be playtested until the fight/flight ratios felt right (e.g. currently Giant Black Squirrels and Ravens would flee 49 out of every 50 checks). 

Personally, I feel the check should be made at the end of the combat round so that none of the monsters run off immediately after starting combat.  However, I did not see any scripts in the SA database that dealt with the events that take place at the end of the combat round.  I did see scripts in the SA database for the beginning of the combat round, but I do not know if those detail all the events in the round, or if they only affect the start of the round.  For example, the SA "CombatRoundStart1" says "$SA_PARAM_SET("-?-?-");".  This makes no sense, even after looking through the GPDL help page.  Could someone please explain what it does?

Offline Jadefang

  • Dungeon Craft Tester
  • Sr. Member
  • ***
  • Posts: 350
Re: Morale
« Reply #5 on: January 01, 2017, 03:38:41 AM »
Seems this was actually discussed over a decade ago: http://www.ironworksforum.com/forum/showthread.php?t=42574

Offline StultusTemporis

  • Newbie
  • *
  • Posts: 28
Re: Morale
« Reply #6 on: January 01, 2017, 09:29:33 AM »
Excellent! So, if I were to write a C function to do the same thing, it would look like this:

#include <stdio.h>

//define the constants
#define FIGHT = 0;
#define FLIGHT = 1;


//define the variables
unsigned char combat morale, morale, intelligence;
int monsterhealth, monsterhealthmax, grouphealth, grouphealthmax;

//define the function
unsigned char moralecheck(combat morale, morale, intelligence, monsterhealth, monsterhealthmax, grouphealth, grouphealthmax);

//function text

unsigned char moralecheck(combat morale, morale, intelligence, monsterhealth, monsterhealthmax, grouphealth, grouphealthmax)
{
   if (intelligence <= 5)
   {
      return FIGHT;
   }
   if (grouphealth / grouphealthmax * 100 > combatmorale)
   {
      if (monsterhealth / monsterhealthmax *100 > morale * 2)
      {
         return  FLIGHT;
      }
   }
   else return FIGHT;
}

/*Where combat morale = monster morale (from Combat Event screen), morale = Morale (from Monster database),
intelligence = Intelligence (from monster database), monsterhealthmax = hit points (at beginning of combat),
monsterhealth =  hit points (current), grouphealth = hit points (group total, calculated at beginning  of
combat), and grouphealthmax = hit points (group total, best calculated at the beginning of the monster's turn)*/

From there, one could call the function that determines if the monster surrenders or flees if FLIGHT is returned.  I'm not sure how that translates into GPDL. 

Please feel free to use and modify this if it proves useful.
« Last Edit: January 01, 2017, 10:42:33 AM by StultusTemporis »

Offline Nol Drek

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2131
    • Nol Drek's Web Site
Re: Morale
« Reply #7 on: January 01, 2017, 02:32:21 PM »
the SA "CombatRoundStart1" says "$SA_PARAM_SET("-?-?-");".  This makes no sense, even after looking through the GPDL help page.  Could someone please explain what it does?

It sets the value of the parameter for the CombatRoundStart1 SA equal to "-?-?-".

"-?-?-" is the default value for many Strings in GDPL. If a function returns this value, it means that the parameter is still the default value and hasn't been set equal to anything special yet.
"Into the Drachensgrab Mountains!"

http://www.noldrek.com

Offline StultusTemporis

  • Newbie
  • *
  • Posts: 28
Re: Morale
« Reply #8 on: January 01, 2017, 03:35:17 PM »
Alright.  So, if I see "-?-?-", is that a sign of a placeholder value, or can it be converted into a specific value?

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2161
Re: Morale
« Reply #9 on: January 01, 2017, 05:32:46 PM »
I don;t know how adept you are at manipulating
Special Abilities.  They can be very confusing.  Even
to experts.
I think this is what is happening:
========= 
You are looking at the definition of a Special Ability.
This is not the Special ability itself, but the definition
of a Special Ability.

Some combatant (very likely all combatants) may
have that Special Ability along with a parameter which will
be provided to the definition of the Special Ability .

Guesswork follows:

This Special ability is probably examined multiple times during
a combat round.  It appears that the code wants to 'reset'
that parameter at the beginning of a combat round.  It will
probably update the parameter as events unfold during the
combat round.  In any case, it appears to 'reset' the parameter
to the value "-?-?-" as a sort of 'impossible' value to indicate
that it has not been otherwise altered during the combat round.

Later in the combat, another Special Ability might examine the
parameter of this Special Ability ("StartCombatRound1")
to see if exists and contains a parameter with value "-?-?-".
If it does, then it might allow some action that
is only supposed to happen once per round and, perhaps, delete
the Special Ability from the combatant or give it a different
parameter to indicate that the action has occurred.

Confusing.  We have found it quite powerful.  Perhaps its
very power is what makes it confusing.  Manikus may be able
to help with this particular Special Ability when
he returns from New Year's holiday.  Searching the specialAbilities.txt
file for other references to this Special Ability might provide
some hints.

Offline StultusTemporis

  • Newbie
  • *
  • Posts: 28
Re: Morale
« Reply #10 on: January 01, 2017, 08:11:53 PM »
I think I see what the problem was now.  I was looking at the database, where each SA is separated into different components.  Some of these are constants, some are variables, some are scripts that define variables, and some are scripts that run different events in the game.  When viewed individually, they have no context, and therefore no meaning.  However, when viewed from specialAbilities.txt, they are all interact with one another to produce the correct effect at the correct time.  Thank you for pointing me to the .txt file. 

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9631
Re: Morale
« Reply #11 on: January 03, 2017, 02:51:56 PM »
First off, great conversation. :)

Morale:
In DC, Morale is actually 0 to 100. I would assume it is this way because FRUA is...
0 - 50 in each monster definition and 0 - 50 set in the particular combat event.

CombatRoundStart1:
This SA was added by nologgie for some future use - it's not called by any other SA, so is never given to any combatants.
The value of "-?-?-" is returned if the queried target does not have a particular SA. If nologgie had gone on with this (I have no idea what he had planned), I would have changed it to $REMOVE_SA(), to avoid confusion.
If you look through the specialAbilities.txt, you can see lots of examples of how CombatRoundStart is used.

End of combat:
A time back, Paul had offered that if we ever needed a EndCombatRound Hook to let him know and he would see about adding it. If you need it, you should ask. :D I think Paul may be amenable to such a request.

Fleeing:
We have a Hook called AutoAction that when it returns an "F" plus the index of someone to run from, will cause the combatant to flee the combat.
http://www.dianneandpaul.net/UAF/Help/SAAutoAction.html

Please keep asking questions, this is great. :D