Author Topic: A Scripting Riddle - Can You Solve It?  (Read 1509 times)

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
A Scripting Riddle - Can You Solve It?
« on: April 23, 2011, 06:48:27 pm »


               // gen_cbm

// Created by Genisys / Guile
// Created on 4/23/2011
//////////////////////////////////////////////////
/*
   This script is a riddle
   To Solve one must answer two questions
   What does (cbm) stand for in the name of the script (The Tough Part)
   What is the general message of the script?
*/
/////////////////////////////////////////////////

int GetMonsterStats(object oPC);
void DestroyMonsters(object oPC);
void FindSolution(object oPC);

void main()
{
 object oPC = GetFirstPC();

 while(GetIsObjectValid(oPC))
 {

  FindSolution(oPC);

  oPC = GetNextPC();
 }

//Main Script End
}

//////////////////////////////////////////////
int GetMonsterStats(object oPC)
{
 int nMonsters = 0;
 int nMonsterStats = 0;

 object oArea = GetArea(oPC);

 object oMonster = GetFirstObjectInArea(oArea);

  while(GetIsObjectValid(oMonster))
  {

   if(GetIsReactionTypeHostile(oMonster, oPC) &&
    GetIsEncounterCreature(oMonster))
   {
     nMonsters +=1;
     nMonsterStats += GetLocalInt(oMonster, "MONSTER_STATS");
   }

   oMonster = GetNextObjectInArea(oPC);
  }
  if(nMonsterStats>=2)
  {
   nMonsters = nMonsters *nMonsterStats;
  }
  return nMonsters;
}

//////////////////////////////////////////////
void DestroyMonsters(object oPC)
{
 object oArea = GetArea(oPC);

 object oMonster = GetFirstObjectInArea(oArea);

  while(GetIsObjectValid(oMonster))
  {

   if(GetIsReactionTypeHostile(oMonster, oPC) &&
    GetIsEncounterCreature(oMonster))
   {
     SetPlotFlag(oMonster, FALSE);
     SetImmortal(oMonster, FALSE);
     DestroyObject(oMonster, 0.0);
   }

   oMonster = GetNextObjectInArea(oPC);
  }
}

//////////////////////////////////////////////
void FindSolution(object oPC)
{
    int nChallenge = GetMonsterStats(oPC);

    int nPC = GetLocalInt(oPC, "PC_STATS");

    effect eDeath = EffectDeath(TRUE, FALSE);

    if(nChallenge <=  nPC)
    {
      DestroyMonsters(oPC);
    }
    else if(nPC < nChallenge  && nChallenge != 0)
    {
      ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oPC, 0.0);
    }
    else 
     DestroyObject( GetModule(), 0.0 );  //how would we come to this?

//End Riddle
}
               
               

               


                     Modifié par _Guile, 01 mai 2011 - 06:00 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
A Scripting Riddle - Can You Solve It?
« Reply #1 on: April 23, 2011, 08:47:58 pm »


               Here is differant Question.  

What are the Major Error in the script.
               
               

               
            

Legacy_Ryuhi2000

  • Full Member
  • ***
  • Posts: 159
  • Karma: +0/-0
A Scripting Riddle - Can You Solve It?
« Reply #2 on: April 23, 2011, 09:03:52 pm »


               my guess is cbm stands for character battle monster and the general message means that one side will result in death if theyre stats are less then the opposing sides and if the players all die the module gets destroyed?
               
               

               


                     Modifié par Ryuhi2000, 23 avril 2011 - 08:05 .
                     
                  


            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
A Scripting Riddle - Can You Solve It?
« Reply #3 on: April 24, 2011, 01:37:29 am »


               The winner(s) of this challenge gets a very unique reward...

A Preview of the reward...
'Posted

This is a very special project I'm working on for a friend, who will recieve a copy of it, and the winner of first part of the riddle of this challenge will get one copy & the winner who solves the general message will recieve a copy as well, though I'm not telling you what the reward is, sorry..  =D
               
               

               


                     Modifié par _Guile, 24 avril 2011 - 12:36 .
                     
                  


            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
A Scripting Riddle - Can You Solve It?
« Reply #4 on: April 24, 2011, 01:40:26 am »


               

Lightfoot8 wrote...

Here is differant Question.  

What are the Major Error in the script.


Obviously it's a ficticious script, so there can be no errors..  =D
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
A Scripting Riddle - Can You Solve It?
« Reply #5 on: April 24, 2011, 01:54:52 am »


               

Ryuhi2000 wrote...

my guess is cbm stands for character battle monster and the general message means that one side will result in death if theyre stats are less then the opposing sides and if the players all die the module gets destroyed?


Incorrect on both parts, sorry, but your welcome to try again. =D
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
A Scripting Riddle - Can You Solve It?
« Reply #6 on: April 24, 2011, 02:38:24 am »


               

_Guile wrote...

Lightfoot8 wrote...

Here is differant Question.

What are the Major Error in the script.


Obviously it's a ficticious script, so there can be no errors..  =D


Ok Let see. 

You loop through the PC's and compair the local int on them to the first object in the area of the first PC. 
 What is this Object?    It can be anything including the first PC, A WayPoint, A Trigger, An Item the PC dropped or Perhaps even a Monster that I think you are shooting for.  

I have No Idea why you would want to compair that Randon Object to every PC in the module There is no garentee that the PC who fired off the script is even the First PC who's area that object is being taken from. Making the object even that much more random. 


Then we get into what you are doing with this compairsion versious this int set on who know what and every PC in the module.   

if it is bigger on the PC then the object (orEqual to)    and it happens to be hostile and an encounter creature we kill the encounter creature.     if not  we kill the module.  Good thing the module can not die. at least not by this means, because this is going to most likely happen 99% of the time the script fires. unless of course you have set the local on every door/waypoint/ item...../object in the module to something higher then 0.  

In the unlikely event that the int on the object is bigger then the one on the PC( and by the way that else if , is totaly not needed, It can just be an else for the same results.) you kill the PC.  Not that it matters much, since if any other PC's are in the module they may well try to kill the module it's self.  

In short if you Object oMonster is not an Hostile Encounter Cerature and that beats the PC, And it is most likely not,  The module is dead.   Good thing that can't happen this way.  

EDIT: cdm stands for Club Down Module.
General Message is the Module is Dead.
               
               

               


                     Modifié par Lightfoot8, 24 avril 2011 - 01:44 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
A Scripting Riddle - Can You Solve It?
« Reply #7 on: April 24, 2011, 06:13:47 am »


               I think cbm stands for "can't be modest".
               
               

               
            

Legacy_Ryuhi2000

  • Full Member
  • ***
  • Posts: 159
  • Karma: +0/-0
A Scripting Riddle - Can You Solve It?
« Reply #8 on: April 24, 2011, 08:50:46 am »


               say out of curiosity when is the deadline for figuring this out?
               
               

               
            

Legacy_leo_x

  • Sr. Member
  • ****
  • Posts: 403
  • Karma: +0/-0
A Scripting Riddle - Can You Solve It?
« Reply #9 on: April 24, 2011, 10:35:50 am »


                Complete Bowel Movement. '<img'>  I keed, I keed.

Seriously tho, this seems to be some message about the old hobgoblin of NWN whose name is Balance.  If his protestations are not met your module will DIE. '<img'>  So, in sum, this script is an example of what previously thought impossible: a Completely Balanced Module.
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
A Scripting Riddle - Can You Solve It?
« Reply #10 on: April 24, 2011, 01:43:35 pm »


               

pope_leo wrote...

 Complete Bowel Movement. '<img'>  I keed, I keed.

Seriously tho, this seems to be some message about the old hobgoblin of NWN whose name is Balance.  If his protestations are not met your module will DIE. '<img'>  So, in sum, this script is an example of what previously thought impossible: a Completely Balanced Module.


You are getting warm on the general message (though it's not about balance per say, it has something to do with balance)..  '<img'>

But the CBM part is completely incorrect.. (both guesses)

=============================================

BTW: There is no deadline, it may take some time for the community to solve the riddle...
               
               

               


                     Modifié par _Guile, 24 avril 2011 - 01:29 .
                     
                  


            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
A Scripting Riddle - Can You Solve It?
« Reply #11 on: April 24, 2011, 01:59:58 pm »


               Fixed the script for LightFoot who obviously is focused on the script & not the message.. '<img'>
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
A Scripting Riddle - Can You Solve It?
« Reply #12 on: April 24, 2011, 06:19:04 pm »


               Well the Message of this one is entirely differant then the first.

The Whole is greater then the sum of its parts. At least if you are a hostile Encounter creature. (   nMonsters = nMonsters *nMonsterStats;) nMonsterStats is already the sum of the parts.

And Life Goes on.  taken from the line:
else DestroyObject( GetModule(), 0.0);
Since unlike the first version It logicly has no chance to ever execute. The only reason for it to be there would be to point out that it would never happen.  

You also need to fix the line: oMonster = GetNextObjectInArea(oPC);

I guess another theam would be  Live Together Or Die as One. Since the PC's never stand together.
               
               

               
            

Legacy_Xardex

  • Sr. Member
  • ****
  • Posts: 414
  • Karma: +0/-0
A Scripting Riddle - Can You Solve It?
« Reply #13 on: April 26, 2011, 01:21:33 pm »


               Well, you seem to have some variables for custom challenge rating, or "stats" as it is in your script.
It seems the player has his own stat value and so do the creatures..

If the PC's value is greater or equal to the sum of the current area's hostile encounter creature's stats multiplied by the amount of such creatures, they will all be killed. If the PC's value is lower, the player will be killed, but only if he has no immunity to death magic.

The destruction of the module is there just for gags as it wouldn't work nor does it have the chance to execute, ever.

I'd suppose a script like this could be used for some mass mind or death magic attack, battle of willpowers, of endurance or something like that.

CBM is the short for cubic meter and canadian baptist mission, and propably a few others.
I would guess here its supposed to be "Create Balance Massacre" but thats propably something only I would use...

Though is it balance if you destroy one of the two sides that you are trying to balance...

Chaotic Battle Mindrape
Charismatic Boomboom Massacre
Carrot Bunny Muppet??
               
               

               


                     Modifié par Xardex, 26 avril 2011 - 12:27 .
                     
                  


            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
A Scripting Riddle - Can You Solve It?
« Reply #14 on: April 29, 2011, 02:55:12 am »


               CBM & the general message are both very much linked together, most likely nobody will be able to guess CBM till the general message is solved.  Again, I'll iterate for those who fail to understand, this is not a real script, it's a script that is an enigma/riddle & has a general message...

Leo was the only one who was even remotely close so far to the message...

Trying to pick apart a riddle using logic usually fails, because the writer usually thwarts logic with enigmas within the riddle...