Remember that it's hard to overpass taken damage. In above code I'm showing how to do Entities stronger. You wont do this that way:
Code:
# EntityHurt Hook:
#- receiving: HurtEvent
def On_EntityHurt(self, Hurt):
real_damage = Hurt.DamageAmount # checking real damage made by C4
(Hurt.DamageAmount/100)*50 # /100*50 because I want to keep this in percentage value (50%)
damage = (Hurt.DamageAmount/100)*50 # checking "new" damage
health = (Hurt.Entity.GetTakeDamage().health) # getting healh
Server.Broadcast(str(real_damage)+" | "+str(damage)+" | "+str(health)) # converting damage (float) to string
Debug showed me:
Code:
[First C4]
Fougerite: 0 | 0 | 5000
Fougerite: 74 | 37 | 535
Fougerite: 600 | 300 | 1000
[Second C4]
Fougerite: 0 | 0 | 5000
Fougerite: 235 | 117 | 461
Are you surprised? Don't look at the numbers, as you probably can't check real damage and health of entity. The point is real damage is 74 + 600 + 235. Damage what you would want is 37 + 300 + 117. So why it's not working?
I destroyed wall with 2 C4. 50% stronger should make them strong for 3C4.
Code will not set DamageAmount, as Fougerite is only plugin, scripting system what FOR game, not IN game. It's always after game.
Rust -> Fougerite -> Rust -> Fougerite
Rust first making damage, then let Fougerite check it amount.
How to do it properly? My code is.
Code:
# EntityHurt Hook:
#- receiving: HurtEvent
def On_EntityHurt(self, Hurt):
real_damage = Hurt.DamageAmount # checking real damage made by C4
health = (Hurt.Entity.GetTakeDamage().health) # getting healh
add_health = (Hurt.DamageAmount/100)*50 # how many health we want to add? 50%
Hurt.Entity.GetTakeDamage().health=Hurt.Entity.GetTakeDamage().health+add_health # adding health
new_health = (Hurt.Entity.GetTakeDamage().health) # getting new healh
Server.Broadcast(str(real_damage)+" | "+str(health)+" | "+str(new_health)) # converting damage (float) to string
First debug:
Code:
[First C4]
Fougerite: 0 | 5000 | 5000
Fougerite: 0 | 5000 | 5000
Fougerite: 6 | 225 | 228
Fougerite: 1 | 1000 | 1000.5
Fougerite: 600 | 1000 | 1300
[Second C4]
Fougerite: 0 | 5000 | 5000
Fougerite: 140 | 222 | 292
[Third C4]
Fougerite: 0 | 5000 | 5000
Fougerite: 600 | 700 | 1000
Fougerite: 0 | 5000 | 5000
And again, don't focus on numbers, because Rust is crazy. Best way to do this would be to set max health for wall, but it will still work like it's now.
You don't change DamageAmount - because it is made before Fougerite. But you can change health, because it can be made after making damage.
If you don't believe, just make your debugs.
EDIT:
Oh and of course final script:
Code:
def On_EntityHurt(self, Hurt):
add_health = (Hurt.DamageAmount/100)*50
Hurt.Entity.GetTakeDamage().health=Hurt.Entity.GetTakeDamage().health+add_health