Always day and Item condition

danowner

New Member
Member
Sep 11, 2014
7
0
1
Simple 2 questions that I am incapeble of knowing at the moment... How do I make it always day, and also how do I turn off item condition? (weapons don't break)?

Cheers guys
 

Jakkee

Retired Staff
Retired Staff
Plugin Developer
Jul 28, 2014
1,465
932
113
Australia
*Always day;
I know Rust++ has Freeze_Time setting but i think its broken. (@mikec will know)
*item condition;
Go to Root/Server_data and open server.cfg.
and paste this into it.
Code:
conditionloss.damagemultiplier 0 
conditionloss.armorhealthmult 0
0 = off, 1 = default. 0.5 = half, etc.
 

CorrosionX

Plugin Developer
Plugin Developer
Sep 3, 2014
212
85
18
California
*Always day;
I know Rust++ has Freeze_Time setting but i think its broken. (@mikec will know)
*item condition;
Go to Root/Server_data and open server.cfg.
and paste this into it.
Code:
conditionloss.damagemultiplier 0
conditionloss.armorhealthmult 0
0 = off, 1 = default. 0.5 = half, etc.
Yup it's broken: http://fougerite.com/threads/fougerite-mc.148/page-3#post-1630

@ OP

There are a bunch of built in commands to give some of the most requested features, that's why I laugh when people use plugins to accomplish them. Here is a list of all server variables you can add to your server.cfg

http://playrustwiki.com/wiki/Server_Commands
 

Jakkee

Retired Staff
Retired Staff
Plugin Developer
Jul 28, 2014
1,465
932
113
Australia
Last edited:

balu92

Retired Staff
Retired Staff
Trusted Member
Jul 11, 2014
338
75
28
34
Its possible to set to noon every 1 min by using timers.
JavaScript:
function DayTimeCallback(){
    World.Time = 12; //Set time to 12 (Noon)
}

function On_PluginInit() {
    Plugin.CreateTimer("DayTime", 1000).Start(); //10,000 = About 1 min.
}
That's ms... 1000 = 1sec, 60000 =1min
 

CorrosionX

Plugin Developer
Plugin Developer
Sep 3, 2014
212
85
18
California
Could the dangerous "while" be used? (Dangerous for me :D)
JavaScript:
function On_PluginInit() {
try{
      while(World.Time != 12){
           World.Time = 12;
      }
}catch(err){Plugin.Log("Error", "Something Broke! --> " + err.message);}
}
I always use try now, learned my lesson. :D
 

Viproz

Moderator
Moderator
Aug 12, 2014
39
9
8
France
Could the dangerous "while" be used? (Dangerous for me :D)
JavaScript:
function On_PluginInit() {
try{
      while(World.Time != 12){
           World.Time = 12;
      }
}catch(err){Plugin.Log("Error", "Something Broke! --> " + err.message);}
}
I always use try now, learned my lesson. :D
Don't do it !

Never ever use a wile loop when you arn't sure that it will stop or have a delay in it

Here I'm not sure of what it will do, two options :
- Run once and then go out of the wile loop not resetting the time anymore
- Keep running again and again cause the time have the time to update just after you set it and before it checks, this will lag your server

You should use a timer ;)
 

Snake

Moderator
Moderator
Jul 13, 2014
288
174
28
Don't do it !

Never ever use a wile loop when you arn't sure that it will stop or have a delay in it

Here I'm not sure of what it will do, two options :
- Run once and then go out of the wile loop not resetting the time anymore
- Keep running again and again cause the time have the time to update just after you set it and before it checks, this will lag your server

You should use a timer ;)

Why would you use a while for that ? I would do :



C#:
World w = World.GetWorld();
w.DayLength = float.MaxValue;
w.Time = 12;

Translated to js :


JavaScript:
World.DayLength = Number.MAX_VALUE;
World.Time = 12;
JavaScript:
function On_PluginInit(){
     Plugin.CreateTimer("Time", 60000).Start();
}

function TimeCallback(){
     Plugin.KillTimer("Time");
     World.DayLength = Number.MAX_VALUE;
     World.Time = 12;
     Plugin.CreateTimer("Time", 60000).Start();
}

This way the sun shouldn't even move. Correct me if I wrote something wrong.
 
  • Winner
Reactions: mikec

mikec

Master Of All That I Survey
Retired Staff
Trusted Member
Jul 12, 2014
296
152
28
Los Angeles, California, USA
env.timescale "amount"Sets the passage of time (day/night cycle) to a certain speed, default is "0.0066666667".

You should be able to make the daytime clock practically stop (a Rust day lasts years) by tweaking this value.

I've already added code to Fougerite to set server globals to disable decay. There are six variables involved with decay, but Fougerite combines them into one setting, on or off.

The same could be done for controlling time in Rust. I'll put it on the enhancements list.