Author Topic: Roll Command  (Read 1096 times)

I've been playing on Gunner's RP for awhile, and it occurred to me that Blockland RPG's could use a good turn based battle type of PvP. What I'm thinking is that you type /roll, and it gives you a number out of 100 (perhaps broadcasting it into the chat so someone can't lie about what they got). It would also be nice if you could use a command to give people roll bonuses, or maybe an event that does that.
/discuss

Code: [Select]
function serverCmdRoll(%client)
{
   if(getSimTime() - %client.lastRoll < 5000)
      return;
   %r = getRandom(1, 100) + %client.rollBonus;
   %r = (%r > 100 ? 100 : %r);
   messageAll('', "\c3" @ %client.getPlayerName() SPC "\c6rolled\c3" SPC %r @ "\c6!");
   %client.lastRoll = getSimTime();
}

function serverCmdSetRollBonus(%client, %target, %val)
{
   if(!%client.isSuperAdmin)
      return;
   findClientByName(%target).rollBonus = %val;
   messageClient(%client, '', "\c6Set \c3" @ findClientByName(%target).getPlayerName() @ "\c6's roll bonus to \c3" @ %val @ "\c6.");
   messageClient(%client, '', "\c3" @ %client.getPlayerName() SPC "\c6set your roll bonus to \c3" @ %val @ "\c6.");
}
untested, if someone wants to package and test be my guest

Code: [Select]
function serverCmdRoll(%client)
{
   if(getSimTime() - %client.lastRoll < 5000)
      return;
   %r = getRandom(1, 100) + %client.rollBonus;
   %r = (%r > 100 ? 100 : %r);
   messageAll('', "\c3" @ %client.getPlayerName() SPC "\c6rolled\c3" SPC %r @ "\c6!");
   %client.lastRoll = getSimTime();
}

function serverCmdSetRollBonus(%client, %target, %val)
{
   if(!%client.isSuperAdmin)
      return;
   findClientByName(%target).rollBonus = %val;
   messageClient(%client, '', "\c6Set \c3" @ findClientByName(%target).getPlayerName() @ "\c6's roll bonus to \c3" @ %val @ "\c6.");
   messageClient(%client, '', "\c3" @ %client.getPlayerName() SPC "\c6set your roll bonus to \c3" @ %val @ "\c6.");
}
untested, if someone wants to package and test be my guest

shouldn't Roll have a : %client.rollBonus = 0; ?? (Assuming /SetRollBonus is for a 1 time roll.)

Code: [Select]
function serverCmdRoll(%client)
{
   if(getSimTime() - %client.lastRoll < 5000)
      return;
   %r = getRandom(1, 100) + %client.rollBonus;
   %r = (%r > 100 ? 100 : %r);
   messageAll('', "\c3" @ %client.getPlayerName() SPC "\c6rolled\c3" SPC %r @ "\c6!");
   %client.lastRoll = getSimTime();
   %client.rollBonus = 0;
}

as far as i'm concerned the bonus is constant until removed

But we should at least let him decide.

I made a server mod for this and sent it to Gunner last night.

I made a server mod for this and sent it to Gunner last night.

Send it to me.
« Last Edit: February 03, 2012, 09:50:32 PM by Sitrus »