// 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 .