Solved Rad zones and Animals stronger

Basically I just can't nothing.

WHAT I WANT BEST:
Damage (like bleeding) from 150 RAD - No Radiation Posion, just bleeding or something.
From 450 RAD - Default Radiation Poison

More RAD = More Damage.

Starting with 1 dmg every 10 seconds, to 4 with 450 RAD.

Players would try to not go above 150 if they don't have some Pills and Kits.

WHAT WOULD WORK:
Code:
If Player.GetRadLevel > 200
     Player.IsRadiationPoisoned = true

WHAT I MADE ONLY:

I made a code like "Player.Health-1" with every Hook.... But it's so stupid. It should go loop, not in Hooks, functions, whatever.

Basic script:
Code:
timer = 300
timer = (timer-1)/FPS

if Player.GetRadLevel > 150 and timer == 0
     damage = Player.GetRadLevel/200
     Player.Health = Player.Health-damage
     timer = 300

Would just work if placed in main loop, not hooks.
 
Basically I just can't nothing.

WHAT I WANT BEST:
Damage (like bleeding) from 150 RAD - No Radiation Posion, just bleeding or something.
From 450 RAD - Default Radiation Poison

More RAD = More Damage.

Starting with 1 dmg every 10 seconds, to 4 with 450 RAD.

Players would try to not go above 150 if they don't have some Pills and Kits.

WHAT WOULD WORK:
Code:
If Player.GetRadLevel > 200
     Player.IsRadiationPoisoned = true

WHAT I MADE ONLY:

I made a code like "Player.Health-1" with every Hook.... But it's so stupid. It should go loop, not in Hooks, functions, whatever.

Basic script:
Code:
timer = 300
timer = (timer-1)/FPS

if Player.GetRadLevel > 150 and timer == 0
     damage = Player.GetRadLevel/200
     Player.Health = Player.Health-damage
     timer = 300

Would just work if placed in main loop, not hooks.
Give me 30-40 mins to debug the hurtevent.
 
Basically I just can't nothing.

WHAT I WANT BEST:
Damage (like bleeding) from 150 RAD - No Radiation Posion, just bleeding or something.
From 450 RAD - Default Radiation Poison

More RAD = More Damage.

Starting with 1 dmg every 10 seconds, to 4 with 450 RAD.

Players would try to not go above 150 if they don't have some Pills and Kits.

WHAT WOULD WORK:
Code:
If Player.GetRadLevel > 200
     Player.IsRadiationPoisoned = true

WHAT I MADE ONLY:

I made a code like "Player.Health-1" with every Hook.... But it's so stupid. It should go loop, not in Hooks, functions, whatever.

Basic script:
Code:
timer = 300
timer = (timer-1)/FPS

if Player.GetRadLevel > 150 and timer == 0
     damage = Player.GetRadLevel/200
     Player.Health = Player.Health-damage
     timer = 300

Would just work if placed in main loop, not hooks.

What you call "the main loop" is the main loop from the game, and so, the .Update() called on every frame.

You can do whatever you want, even without hooks, just put a simple timer that fires every x seconds and checks all players and their radiation level. Easy as that.
 
Just make bleedings do 2x damage?
The only way you bleed is from gun shoots I think (which shouldn't matter on a PvE server)

Wild animals also make you bleed.
 
Yes, main game (server) loop, Update(). But how to call Player object in plugin without hook? Fougerite is returning it in hooks like On_Command(self, Player), and not every.

When I tried:
pplayer = Fougerite.Player
pplayer.Health > 40:

It didn't work. Tried also Fougerite.Player()

---

Timer need his own loop. For example:
Code:
def MakeFunction(self, Player):
     Player.Health = Player.Health-1

while 1:
     timer(5,1, MakeFunction)

So you cant make loop in loop, even in plugins. This will crash Rust client. Second think is how to give "MakeFunction" Player object. Of course this code isn't complete, I just wrote it from my head.
 
Yes, main game (server) loop, Update(). But how to call Player object in plugin without hook? Fougerite is returning it in hooks like On_Command(self, Player), and not every.

When I tried:
pplayer = Fougerite.Player
pplayer.Health > 40:

It didn't work. Tried also Fougerite.Player()

---

Timer need his own loop. For example:
Code:
def MakeFunction(self, Player):
     Player.Health = Player.Health-1

while 1:
     timer(5,1, MakeFunction)

So you cant make loop in loop, even in plugins. This will crash Rust client. Second think is how to give "MakeFunction" Player object. Of course this code isn't complete, I just wrote it from my head.
What you want to do will need the hurtevent though.
 
No, don't have even gaming mic to talk. Usually I'm using E-Mails, or polish communicator. I don't even know English - just to write, read and listen. Anyway:

HurtEvent - but for use like "Make HurtEvent(Player,Bleeding,2Dmg)", not to check Hurt, because nothing is hurting player when he have RAD at 150.

Basically I could even do it in C# basing on Fougerite Source, it would be very hard, yes, I hate compilers, yes, but if I would know how to set environment and compiler to make proper dll, I would try.


In future I want to make even harder thing - Secure zones - to enable PvP on server, but keep players who don't like to die very often. So what I'm trying to do now with this RADs looks easy as sht.
 
No, don't have even gaming mic to talk. Usually I'm using E-Mails, or polish communicator. I don't even know English - just to write, read and listen. Anyway:

HurtEvent - but for use like "Make HurtEvent(Player,Bleeding,2Dmg)", not to check Hurt, because nothing is hurting player when he have RAD at 150.

Basically I could even do it in C# basing on Fougerite Source, it would be very hard, yes, I hate compilers, yes, but if I would know how to set environment and compiler to make proper dll, I would try.
2015-02-07_1303.png


Interesting.

C#:
get
            {
                string str = "Unknown";
                Server.GetServer().Broadcast(((int)this.DamageEvent.damageTypes).ToString());
                switch (((int)this.DamageEvent.damageTypes))
                {
                    case 0:
                        return "Bleeding";

                    case 1:
                        return "Generic";

                    case 2:
                        return "Bullet";

                    case 3:
                    case 5:
                    case 6:
                    case 7:
                        return str;

                    case 4:
                        return "Melee";

                    case 8:
                        return "Explosion";

                    case 0x10:
                        return "Radiation";

                    case 0x20:
                        return "Cold";
                }
                return str;
            }

The Radiation is also bleeding.
 
Yes, like I told about 2 times :D I did debugs too before I found this "Player Metabolism" class. :)
2015-02-07_1309.png


Alright now I understand your problem. We might need to find an event something like onplayerradiation.

The only good idea i can come up with is this: (Hold on posting code lol)
 
Python:
import clr

clr.AddReferenceByPartialName("Fougerite")
import Fougerite

RadiationCheck = []
class WhatEver:

    # Respawned and fresh connected players are handled here.
    def On_PlayerSpawned(self, Player, SpawnEvent):
        RadiationCheck.append(Player)

    def On_PlayerKilled(self, DeathEvent):
        if DeathEvent.Victim is not None:
            RadiationCheck.remove(DeathEvent.Victim)

    def On_PlayerDisconnected(self, Player):
        RadiationCheck.remove(Player)

    def On_PluginInit(self):
        for player in Server.Players:
            RadiationCheck.append(player)
       #6000 = 6 seconds.
        Plugin.CreateTimer("RadCheck", 6000).Start()

    def RadCheckCallback(self):
        Plugin.KillTimer("RadCheck")
        for player in RadiationCheck:
            rad = int(player.RadLevel)
            if rad >= 150:
                # You can add radiation:
                player.AddRads(float(50))
                #or:
                player.Damage(float(10))
                player.Message("You got dmaaged!")
        Plugin.CreateTimer("RadCheck", 6000).Start()
 

Attachments

Yeah man working awesome. Don't even need to send message, all "hurting" effect is working. Wow.

I'm owe you (bad english), so if you want something from me I'll do that. I can add some Wikia pages or something. Let me know.

Try to add this to wiki:
Code:
RadiationCheck.append(Player)

As I didn't know how to give this object to my functions, so probably more people had problems with this.
 
Yeah man working awesome. Don't even need to send message, all "hurting" effect is working. Wow.

I'm owe you (bad english), so if you want something from me I'll do that. I can add some Wikia pages or something. Let me know.

Try to add this to wiki:
Code:
RadiationCheck.append(Player)

As I didn't know how to give this object to my functions, so probably more people had problems with this.
Well these new radiation methods and metabolism pointers are not yet included in Fougerite. I might make a build from the latest fixes and additions and release a version called 1.0.7C

Btw. = [] is an array in python.
 
And one thing, this debug thing what is writing "Fougerite: 0" needs to be deleted ;) It's showing twice every time I'm hurt.
 
Yeah man. Players will be happy. I'll update server now.

I added this to R++ notices :) "notice3=Special thanks for DreTaX and Fougerite Team 4 making it possible."

So nice. Remember write to me if you need some help, especially with wiki. I know that there is only about 6-8 hooks, but Fougerite have about 30, so you know. Just tell me and I'll help.
 
  • Like
Reactions: Snake
Yeah man. Players will be happy. I'll update server now.

I added this to R++ notices :) "notice3=Special thanks for DreTaX and Fougerite Team 4 making it possible."

So nice. Remember write to me if you need some help, especially with wiki. I know that there is only about 6-8 hooks, but Fougerite have about 30, so you know. Just tell me and I'll help.
I don't force any work on anyone regardless if they owe me or not. If you wish to join the wiki editor team thats your call. And even if you do, we don't expect 24/7 editing.