Official Soldat Forums
Server Talk => Scripting Discussions and Help => Topic started by: y0uRd34th on February 28, 2009, 03:04:20 pm
-
Whats the best way for Damage Multipliers (Input/Output)?
Result := Damage * Output[ID] * Input[ID];
or
Result := Damage * (Output[ID] - Input[ID]);
Something like that, but should i use Single or Integers, what's better?
-
Result := round(MULTIPLYER * strtofloat(inttostr(Damage)));
Use singles for the multiplyer.
-
What are you trying to do?
-
A little Zombie script, maybe i make a Survival.
Wanna make better Bots but for that i need the Multiplier thing and i was not sure what's the best way is..
Result := round(MULTIPLYER * strtofloat(inttostr(Damage)));
Use singles for the multiplyer.
Why so Complex, why you don't use 'IntToFloat'? :D
But my other Problem is that i want to make Input and Output, and im not sure how..
-
Result := round(MULTIPLYER * strtofloat(inttostr(Damage)));
you dont have to use these functions
Result := Round(MULTIPLER * Damage) is enough.
use singles
for example:
Output[shooter] := 1.12;
Input[victim] := 0.93;
Result := Round(Damage * Output[shooter] * Input[victim]);
-
Thanks will try it out directly!
Umm, tried some things but whenever I do:
...
if Damage < 5000 then
dec(HealthLeft[Victim],Round(Damage * Bot[Shooter].DamageOutput * Bot[Victim].Input));
else
dec(HealthLeft[Victim],Round(Damage * Bot[Shooter].DamageOutput * Bot[Victim].Input / 75));
...
It won't work Damage always goes to 0...
I don't know why, any ideas?
-
first of all, if you have "else" after a single line, there should be no semicolon. Secondly, we have no idea what HealthLeft[] is, so please tell us.
-
-> HealthLeft: Array [1..32] of Integer;
I've made a script which makes Bots stronger (Like Gizd Special Bots Script: Found here (http://forums.soldat.pl/index.php?topic=30292.0))
first of all, if you have "else" after a single line, there should be no semicolon.
Yes, I often forget it^^
But my Problem is that it deals 0 Damage to the Bots and for me all.
-
Paste whole script, because this part is just decreasing bot's fake hp which doesn't affect damage...
-
you have to have this line in the end of onplayerdamage (just a guess since we dont have the whole procedure yet):
result := damage;
since if you dont have that string, onplayerdamage will do no actual damage :|
-
I have but the Bots have more Health then 150 i set up some things and i want to decrease it and that wont work, also it works but ingame it wont decrease their Health.
->dec(HealthLeft[Victim],Round(Damage * Bot[Shooter].DamageOutput * Bot[Victim].Input));
And I'm more than sure that this correct is!
function OnPlayerDamage(Victim,Shooter: Byte;Damage: Integer) : integer;
begin
Result := Damage;
if Assignable(Victim) then begin
if HealthLeft[Victim] > 0 then begin
Result := -Damage;
if Damage < 5000 then begin
dec(HealthLeft[Victim],Damage);
end else begin
dec(HealthLeft[Victim],Round(Damage/75));
end;
if Bot[Victim].ShowHealth then ShowHealth(Victim,Shooter);
if HealthLeft[Victim] < 1 then DoDamageBy(Victim,Shooter,500);
end;
end;
end;
That's the actually one i use..
-
well... since you do DoDamageBy() in the end of onplayerdamage, it just call onplayerdamage again and just decreases the fake health variable again and again without actually damaging the bot. Make it something like Damage := 4000 instead, so the onplayerdamage function actually kills the bot when it finishes running
-
Yes, but it's only killing it when his HP < 1 and not bigger.
-
its not killing, its just making the function call itself again without doing any *actual* damage
-
hmm, i don't think so because without these dmgmultipliers its working >.<
The Problem is that the HealthLeft[] will not decreased if i modify the dmg ;/
-
Take a look at this very simple script that I wrote. I think it has what you are trying to do in it, if not then at least that is how I do it.
http://soldatcentral.com/index.php?page=script&f=6
-
Ya, very simple one, but youre only adding Damage and I want to multiple it with a Single also percentes. Although Thanks iDante.