Author Topic: Damage Multipliers - What's the best Way to do it?  (Read 1257 times)

0 Members and 1 Guest are viewing this topic.

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Damage Multipliers - What's the best Way to do it?
« on: February 28, 2009, 03:04:20 pm »
Whats the best way for Damage Multipliers (Input/Output)?
Code: [Select]
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?

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Damage Multipliers - What's the best Way to do it?
« Reply #1 on: February 28, 2009, 04:49:51 pm »
Code: [Select]
Result := round(MULTIPLYER * strtofloat(inttostr(Damage)));Use singles for the multiplyer.


Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: Damage Multipliers - What's the best Way to do it?
« Reply #2 on: February 28, 2009, 09:07:18 pm »
What are you trying to do?

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Damage Multipliers - What's the best Way to do it?
« Reply #3 on: March 01, 2009, 04:16:56 am »
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..

Quote from: Hacktank
Code: [Select]
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..

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: Damage Multipliers - What's the best Way to do it?
« Reply #4 on: March 01, 2009, 04:21:36 am »
Quote
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]);

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Damage Multipliers - What's the best Way to do it?
« Reply #5 on: March 01, 2009, 05:14:41 am »
Thanks will try it out directly!

Umm, tried some things but whenever I do:
Code: [Select]
...
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?
« Last Edit: March 01, 2009, 09:11:39 am by y0uRd34th »

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Damage Multipliers - What's the best Way to do it?
« Reply #6 on: March 01, 2009, 04:21:09 pm »
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.

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Damage Multipliers - What's the best Way to do it?
« Reply #7 on: March 02, 2009, 08:07:30 am »
-> HealthLeft: Array [1..32] of Integer;
I've made a script which makes Bots stronger (Like Gizd Special Bots Script: Found here)

Quote from: danmer
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.



« Last Edit: March 02, 2009, 08:13:50 am by y0uRd34th »

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Damage Multipliers - What's the best Way to do it?
« Reply #8 on: March 02, 2009, 09:04:10 am »
Paste whole script, because this part is just decreasing bot's fake hp which doesn't affect damage...

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Damage Multipliers - What's the best Way to do it?
« Reply #9 on: March 02, 2009, 09:47:15 am »
you have to have this line in the end of onplayerdamage (just a guess since we dont have the whole procedure yet):
Code: [Select]
result := damage;since if you dont have that string, onplayerdamage will do no actual damage :|

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Damage Multipliers - What's the best Way to do it?
« Reply #10 on: March 02, 2009, 12:27:53 pm »
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!

Code: [Select]
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..
« Last Edit: March 02, 2009, 12:32:13 pm by y0uRd34th »

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Damage Multipliers - What's the best Way to do it?
« Reply #11 on: March 02, 2009, 02:40:11 pm »
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

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Damage Multipliers - What's the best Way to do it?
« Reply #12 on: March 03, 2009, 07:28:55 am »
Yes, but it's only killing it when his HP < 1 and not bigger.

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Damage Multipliers - What's the best Way to do it?
« Reply #13 on: March 04, 2009, 06:24:22 am »
its not killing, its just making the function call itself again without doing any *actual* damage

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Damage Multipliers - What's the best Way to do it?
« Reply #14 on: March 04, 2009, 08:39:41 am »
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 ;/

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: Damage Multipliers - What's the best Way to do it?
« Reply #15 on: March 04, 2009, 10:25:31 am »
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

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Damage Multipliers - What's the best Way to do it?
« Reply #16 on: March 04, 2009, 11:27:25 am »
Ya, very simple one, but youre only adding Damage and I want to multiple it with a Single also percentes. Although Thanks iDante.