Hello, I've been doing some private development and I'm a novice scripter, so it didn't go so perfectly.
I added this value here:
RPDB.addValue("Difficulty", 0);
In my view, that added a Difficulty value that is set to 0 by default. If I am wrong please correct me.
That difficulty values shows its role here:
function ServerCmdToggleDifficulty(%client)
{
if (%client.RPData.value["Difficulty"] = 0)
{
%client.RPData.value["Difficulty"] = 1;
messageclient(%client, '', "Difficulty has been set to Hardcore");
}
else
{
%client.RPData.value["Difficulty"] = 0;
messageclient(%client, '', "Difficulty has been set to Normal");
return;
}
}
But for some reason, when I use /toggledifficulty it says Difficulty has been set to normal for however many times I enter the command /toggledifficulty. I am currently aiming for it to switch between Hardcore and Normal so if someone could show me how I could make it work that would be great.
And then there is this code:
function GameConnection::onDeath(%client, %killerPlayer, %killer, %damageType, %damageLoc)
{
Parent::onDeath(%client, %killerPlayer, %killer, %damageType, %damageLoc);
if (%client.RPData.value["Difficulty"] = 1)
{
// Message about Stats
messageClient(%client, '', "\c6Your stats reset due to your difficulty setting.");
%client.RPData.value["tools"] = "";
%client.RPData.clear();
}
else
{
// Lose tools and Clear Stats
if (isObject(%client) && %client.isInRP())
{
%client.RPData.value["tools"] = "";
}
}
}
That was supposed to be determined by the Difficulty but whenever I die it says Your stats reset due to difficulty setting when ever I just start the game or use the /toggledifficulty command.
When I use the /toggledifficulty command it says my difficulty was set to normal but when I die after using the /toggledifficulty command, it still resets my stats. If anyone could post any fixes or could teach me how to fix these scripts it would be great. Thanks!
--Sgt. Gary