Author Topic: How to kill with CreateBullet without using explosive rounds?  (Read 4284 times)

0 Members and 1 Guest are viewing this topic.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
title says it all, if i spawnBullet (or whatever it is) on someone it doesnt do any damage, i could do 100 bullets and it still hasnt done any damage,

although my wep mod is set to 999999 damage, which works fine when actually using the weapons,

i want to move away from using explosive rounds as its causing MASSIVE lag issues on my server so, how do i do it?

i know that Dodamage results in a selfkill which isnt what i want

i also want to set up like a turret that auto fires, but how do i get the angle of direction from turret to target and Createbullet with that angle info?
« Last Edit: June 28, 2010, 07:23:53 pm by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #1 on: June 29, 2010, 12:22:54 am »
You need to get angle between turret and player:
Code: [Select]
function arctan2(X, Y: single): single;
begin
  if X < 0 then Result := arctan(Y/X) + Pi else
  if X > 0 then Result := arctan(Y/X) else
  if Y > 0 then Result := 1.5707 else
   Result := -1.5707;
end;

a:= arctan(X2-X1,Y2-Y1);
*arctan2() made by tk.

Code: [Select]
vX:= cos(a)*velocity;
vY:= sin(a)*velocity;
CreateBullet(TurretX,TurretY,vX,vY,Power,Style,ID);
This will create a bullet going from turret to player, you need to find some angle adjustments though if you want low velocity bullets to hit.

Offline VirtualTT

  • Veteran
  • *****
  • Posts: 1026
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #2 on: June 29, 2010, 03:12:12 am »
CreateBullet function doesn't use any values from weapon mod, you need to manually specify bullet power (~10000 for sure kill). Also resulting damage will be effected by the speed of the bullet. So don't set speed to 0 if bullet is spawned just inside the player.
« Last Edit: June 29, 2010, 03:16:39 am by VirtualTT »

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #3 on: June 29, 2010, 08:51:33 am »
CreateBullet function doesn't use any values from weapon mod, you need to manually specify bullet power (~10000 for sure kill). Also resulting damage will be effected by the speed of the bullet. So don't set speed to 0 if bullet is spawned just inside the player.
Aswell don't place bullets with rapid speed near players because they will just fly through them.

Code: [Select]
function arctan2(X, Y: single): single;
begin
  if X < 0 then Result := arctan(Y/X) + Pi else
  if X > 0 then Result := arctan(Y/X) else
  if Y > 0 then Result := 1.5707 else
   Result := -1.5707;
end;
<3  :P

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #4 on: June 29, 2010, 10:29:33 pm »
uhh how exactly do i set bullet "speed" in CreateBullet? someone give me an example plz

theres no "speed" var in the syntax, only VelX and VelY, tried 1000 VelY with HitMultiplier as 10000 and it doesnt kill, so how exactly do i set the speed?
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #5 on: June 30, 2010, 12:34:34 am »
1000 for a sold at velocity is ungodly. The bullet would span the entire map in a second.... Try 1.


Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #6 on: June 30, 2010, 06:59:42 am »
Well.. speed would be sqrt(VelX * VelX + VelY * VelY)
And if you don't understand what VelX and VelY means you kinda did miss something..

CreateBullet(x, y, -10, 0, 100, 14, owner); Bullet flys straight up.
CreateBullet(x, y, -10, 10, 100, 14, owner); Would create a bullet which starting angle is 45° (flys ^>)
CreateBullet(x, y, 0, 10, 100, 14, owner); Flys to the right of it's spawning position.

I think this should be enough so you get the idea.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #7 on: June 30, 2010, 01:31:56 pm »
1 VelY doest kill, even with a hit multiplier of 100000, for a kill i need a minimum of 1000 VelY coupled with hitM of 100000

idk wtfh is going on here, but it is irritating

also, VelX and VelY isnt explained in the doc at all if anything so its a bit confusing

and also i need to use GetPlayerStat in VelX and VelY for it to even work

makes more sense now tho but my problem with Vely is an issue :S
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #8 on: July 01, 2010, 06:47:29 am »
You don't need GetPlayerStat..
Negative VelY: Bullets move up.
Positive VelY: Bullets move down.
The point (0|-5) would be over the point (0|5), it's just how MM coded it.
Hope that's what you wanted to know.
Also why don't you just use DoDamage() >_>'

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #9 on: July 01, 2010, 01:24:53 pm »
Because Dodamage results in selfkill of target, like i said earlier, that is not what i wanted

thanks swompie for the explanation, explains a few things that have happened (somewhat randomly(ugh! silly me)) :D
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #10 on: July 01, 2010, 01:48:29 pm »
Because Dodamage results in selfkill of target, like i said earlier, that is not what i wanted
DoDamageBy()

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #11 on: July 01, 2010, 07:12:12 pm »
thanks Gizd :), im guessing the syntax is DoDamageBy(Target,Owner) ?

also where did you get that function? it isnt on:
http://enesce.com/help/ or http://devs.soldat.pl/wiki/index.php?title=Server_Scripting
« Last Edit: July 01, 2010, 07:19:42 pm by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #12 on: July 01, 2010, 11:04:32 pm »
thanks Gizd :), im guessing the syntax is DoDamageBy(Target,Owner) ?

also where did you get that function? it isnt on:
http://enesce.com/help/ or http://devs.soldat.pl/wiki/index.php?title=Server_Scripting

I believe it's DoDamageBy(Victim, Shooter, Damage);
« Last Edit: July 01, 2010, 11:07:49 pm by squiddy »
www.soldatx.com.br - The brazilian Soldat community.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #13 on: July 02, 2010, 01:29:32 am »
thanks squiddy :D

hmm ill have to stick with CreateBullet, DoDamageBy with 99 set as damage causes way worse lag than createbullet and actually continuosly causes the script to crash and the server to completely hang, hmm

From: July 02, 2010, 01:43:54 am
edit: wtf is going on? if i remove the GetplayerStat from VelY in CreateBullet it doesnt kill!! wtf!!!!!!!!
« Last Edit: July 02, 2010, 01:43:54 am by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #14 on: July 02, 2010, 02:01:35 am »
also where did you get that function? it isnt on:
http://enesce.com/help/ or http://devs.soldat.pl/wiki/index.php?title=Server_Scripting
Quote from: devs.soldat.pl
NOTE: If you wish to be able to specify a player ID doing damage, use DoDamageBy:
 procedure DoDamageBy(ID,Shooter: Byte; Damage: Integer);

hmm ill have to stick with CreateBullet, DoDamageBy with 99 set as damage causes way worse lag than createbullet and actually continuosly causes the script to crash and the server to completely hang, hmm
Lies! Code please.
« Last Edit: July 02, 2010, 02:03:37 am by Gizd »

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #15 on: July 02, 2010, 03:34:55 am »
nevermind, got CreateBullet to work fine, dont need DoDamageBy
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #16 on: July 02, 2010, 04:41:09 am »
nevermind, got CreateBullet to work fine, dont need DoDamageBy
If player is close to wall it might change.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #17 on: July 02, 2010, 05:58:24 am »
ok if thats the case

this is in OnPlayerKill, all Vars have been declared, dont understand why this causes the server to hang when this weapon is used, this ONLY started hanging after i put in DoDamageBy (was using the commented out CreateBullet)

Code: (pascal) [Select]
if Weapon = 'Barrett M82A1' then begin
for i := 1 to 32 do
begin
x := GetPlayerStat(Victim,'x');
y := GetPlayerStat(Victim,'y');
x2 := GetPlayerStat(i,'x');
y2 := GetPlayerStat(i,'y');
if RayCast(x,y,x2,y2,Dist,400) then begin
if i <> Killer then begin   
if GetPlayerStat(i,'Alive') = true then begin
//WriteLn(IDtoName(i)+' is in range of Raycast');
//CreateBullet(GetPlayerStat(i,'x'), GetPlayerStat(i,'y') - 0, 0,-1000,100, 3, Killer);
                                                                     DoDamageBy(i, Killer, 99);
BioKills[Killer]:=BioKills[Killer]+1;
end;
end;
end;
end;
WriteConsole(Killer,'Bio-Kills: '+Inttostr(BioKills[Killer]),$EE81FAA1);
BioKills[Killer]:=BioKills[Killer]*0;
end;

this is the only part of the script that has the DoDamageBy

i dont get it, why the hell is it hanging the server? why is it the CreateBullet works fine with barely any lag yet DoDamageBy hangs the server? i dont get it :S also the script crashes 20 times in a row, then i get a crapload of access violations in Panel Log resulting in me needing to reset the server
Quote
If player is close to wall it might change.

has now, now that you mention it, i just found that out while in my server

edit: i dont get why the forum has indented DoDamageBy so far to the right....
« Last Edit: July 02, 2010, 06:03:39 am by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #18 on: July 02, 2010, 06:46:33 am »
Can you show OnPlayerDamage? Before doing so check if it's making an Infinite damage loop.

Offline croat1gamer

  • Veteran
  • *****
  • Posts: 1327
  • OMG CHANGING AVATAR!!! ^ω^
Re: How to kill with CreateBullet without using explosive rounds?
« Reply #19 on: July 02, 2010, 07:15:22 am »
I would need the whole script to find the problem, because of Weapon and similar stuff.

Also, i cant remember that DoDamageBy exists, it isnt even in the scripting manual. :\
Did you try  DoDamage(i, Killer, 4000)

Also, what is the script supposed to do, or at least this fragment?
Kill the enemy if he is inside a 400 radius while the victim has barrett?
I think you would need to assign with AppOnIdle the weapon check to each player, something like this (youll need to adopt it to the overall script:
Code: (pascal) [Select]
procedure AppOnIdle(Ticks: integer);
var
i: integer;
Weapon: array[1..255] of array[1..32];
begin
for i:= 1 to 32 do Weapon[GetPlayerStat(i, 'Primary')][i];
end;
end;

//and then instead of
if Weapon = 'Barrett M82A1' then begin 
        for i := 1 to 32 do 
//place
for i: 1 to 32 do if Weapon[8][i] then begin 

// or something like that. again, i would need to see the whole script
Also, im not sure if i can assign the double array like that, but i always failed with x[y][z] := x[1][2] and similar, can someone recheck that part?
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.