Hi, everybody. Help to write a script please.
It is necessary for me that 30% of a dmg were reflected
Here that I wrote, but it doesn't work:
[CODE] local function HookEntityTakeDamage( victim, dmg )
if( IsValid( dmg:GetAttacker():IsPlayer() ) && dmg:GetAttacker() ) then
dmg:ScaleDamage( 0.3 )
end
end
hook.Add( "EntityTakeDamage", "hook_name", HookEntityTakeDamage );[/CODE]
If it were so simple why can't you do it? Hook into whatever you need to that is called when an entity receives damage, then damage the attacker by that damage * 0.3..
[QUOTE=Walrus Viking;47394695]If it were so simple why can't you do it? Hook into whatever you need to that is called when an entity receives damage, then damage the attacker by that damage * 0.3..[/QUOTE]
I visited but at me the nonsense turns out
Use ScalePlayerDamage hook: [url]http://wiki.garrysmod.com/page/GM/ScalePlayerDamage[/url]
[QUOTE=Acecool;47397917]Use ScalePlayerDamage hook: [url]http://wiki.garrysmod.com/page/GM/ScalePlayerDamage[/url][/QUOTE]
It is necessary to me that the loss was reflected not only from shots
[editline]26th March 2015[/editline]
Please write me an example of this script
That will scale any type of damage you want. There is an example on the Wiki, the shortest it could be would be 3 lines... hook.Add( .... scale ... end ); which would scale any type of damage...
You can use body groups to change scale, etc.... as described in the wiki!
You can write your own script, everything is pretty well documented for this on the wiki, it all just takes research and [I]effort[/I].
You have made quite a few threads recently called "simple" scripts that you want made and always just ask for an example or the script as a whole, which people have ended up making the script for you.
I don't know why you want to make these but if you need people to make all of these simple scripts for you, you probably won't learn what is needed to code on your own.
I wrote a script, but it doesn't work.
What did I make incorrectly?
[CODE]
local function EntityTakeDamage( target, dmginfo )
if ( target:IsPlayer() and dmginfo:GetInflictor() ) then
dmginfo:ScaleDamage( 0.9 )
end
end
hook.Add( "EntityTakeDamage", "hook_name", EntityTakeDamage );
[/CODE]
what do you mean with "Doesn't work" because you can't easily detect 0.9 of a damage
[QUOTE=gonzalolog;47400462]what do you mean with "Doesn't work" because you can't easily detect 0.9 of a damage[/QUOTE]
I tried different values - there is no effect (doesn't work)
[editline]26th March 2015[/editline]
Thanks everybody. I wrote a script.
Пока =)
Sorry, you need to Log In to post a reply to this thread.