Author Topic: Events/day and night system  (Read 2474 times)

For my brickmin mod, I wanted to make a day and night system. No, changing lighting isn't important ATM. This is how I want it.

Events:
Onday- When morning comes
ONnight- When night comes
Onweek- at the end of 7 day/night cycles

Setsafe-  example: onplayertouch - client - setsafe.

It sets you as 'safe' for when night comes. When night comes, a
Code: [Select]
for(%i = 0; %i < clientGroup.getCount(); %i++)should run and check who is safe, if they are not safe, kill them.

Setnotsafe- Just for purposes of keeping people cheating at minimum. When, lets say, activate a brick that teleports them out of the onion (Pikmin mothership), you would include a setnotsafe.

I could probably make the safe events but I could not do the timer. Could someone help me get started with it?

Well, yes - I'm not a event scripting master, but here's some code to get you started.
Code: [Select]
$hoursPerDay = "24";
registerOutputEvent(fxDtsBrick,"setSafe");
function fxDtsBrick::setSafe(%client)
{
          messageClient(%client,'',"\c6You are now safe.");
          %client.isSafe = "1";
}

registerOutputEvent(fxDtsBrick,"setNotSafe");
function fxDtsBrick::setNotSafe(%client)
{
          messageClient(%client,'',"\c6You are now not safe.");
          %client.isSafe = "0";
}

Also, for timing:

...
$dayTime = 1000 * 60 * $hoursPerDay;
schedule($dayTime,toggleDay);

function toggleDay()
{
          if($day $="0")
          {
                    messageAll('',"\c6It is now day!");
                    $day = "1";
          }
          else if($day $="1")
          {
                    messageAll('',"\c6It is now night!");
                    $day = "0";
                    for(%i = 0; i% < clientGroup... stuff here.
          }
}
Remember: I do not guarantee this to work, it is though, just some chunk of code to get you started.
« Last Edit: November 28, 2009, 11:04:12 AM by Tickle »

Can you make the day last 10 minutes instead of a real day?

The first arg in a fxDTSBrick is the brick. Also I dont think people want to wait a whole day for the pikmin day to end =\

The first arg in a fxDTSBrick is the brick. Also I dont think people want to wait a whole day for the pikmin day to end =\
Yea. Come to my server. I got some new stuff.

A schedule can't be longer than 30 minutes or it will just become zero. Also, those events won't work. To find the owner of a brick, you can use %brick.getGroup().client.

A schedule can't be longer than 30 minutes or it will just become zero. Also, those events won't work. To find the owner of a brick, you can use %brick.getGroup().client.
I was using your day and night system as a base and it works fine. No, I won't release it. How would I make the setsafe and the check. Here is the comments

      //This is where I need the check if safe. Check will run until BrickminTickDay()
      //On BrickminTickday(), the check is canceled
      //The check should check if the player is safe or not. If not, after 5 seconds of being not
      //safe, they die. The 5 seconds is useful for respawn times. If someone dies every time
      //They respawn, it will be no fun. You can event the spawn point with a setsafe event so when
      //They respawn after dieing, they won't keep on dieing.

It seems quite difficult. If you want, PM me because I don't want to post the code in public.