Author Topic: OnPlayerDmg help...  (Read 781 times)

0 Members and 1 Guest are viewing this topic.

Offline shantec

  • Soldier
  • **
  • Posts: 140
  • Get ANGREH!!
OnPlayerDmg help...
« on: April 14, 2008, 01:47:11 pm »
Hi agen everyone. I'm trying to make short script which spawns an arrow upon Victim every time he gets damage. Here is what I've made:
Code: [Select]
function OnPlayerDamage(Victim,Shooter: Byte;Damage: Integer) : integer;
begin
  if Victim <> Shooter then begin
    CreateBullet(GetPlayerStat(Victim,'x'), GetPlayerStat(Victim,'y')-40,0,0,100,8,Victim);
end;
end;

Well, basicly it works but it spawns no arrows, secondly when i walk to the "invisible arrow which never spawned" i die ???
Help?

Oh and edit edit. Cause the arrow would do some damage, it would do a damn "arrow loop"... so how to fix that?
Also Known As REIMA


Lol Happles (happy apples)

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: OnPlayerDmg help...
« Reply #1 on: April 15, 2008, 12:12:25 pm »
if 8 is flame arrow, they are disabled (you can't spawn them). Use something else.

As for the loop, just think about it... Set a boolean to true when you spawn the projectile and to false next time he gets damage; or check the distance between the points where the player gets damage and where you last spawned the bullet; or check the time interval; or use 32 as the ID for Shooter when spawning the bullet and then check for ID when spawning it again...

but actually you won't get the loop effect to begin with, because Shooter would be the same ID as Victim, because the bullet you spawn belongs to the same player >.<