[Tutorial] Kill/Death System Code
the code virtually source is ready, but just have some basic changes.
Thank @
Yuri-BR for sharing this code, only it is already in the source.
I'll just teach to put the code in flash.
Go to Data folder
LangPack/
NameLang.lang
Search
Code:
$FR_SURVIVOR_SCREEN_CREATE_KILLED_CIVILIANS=CIVILIANS KILLED
Add
Code:
$FR_HeadShot_Ratio=HEADSHOT RATIO
$FR_KDR=KILL DEATH RATIO
$FR_ACCURACY=ACCURACY
Now, go to
FrontEnd.fla
\src\classes\warz\frontend
Open Frontend.as
Search
Code:
public function addClientSurvivor (Name:String, health:Number, xp:int, timeplayed:int,
Add final line
Code:
, kdrS:int, hsrS:int, accyS:int)
like this, don't forgot '
,' symbol
Now
Go to src\classes\warz\dataObjects
Open Survivor.as
Search and edit
Code:
public var civiliansKilled:int;
Add
Code:
public var kdrS:int;
public var hsrS:int;
public var accyS:int;
Search
Code:
public function Survivor (Name:String, health:Number, xp:int, timeplayed:int,
Change or add
Code:
kdrS:int, hsrS:int, accyS:int
Like this (don't forgot ',' symbol)
Search
Code:
this.civiliansKilled = civiliansKilled;
Add
Code:
this.kdrS = kdrS;
this.hsrS = hsrS;
this.accyS = accyS;
Now, open FrontEnd.fla and go to
_Survivors>Survivors
Right Click and EDIT
Add in TEXT
PHP Code:
KDRTitle
HeadShotTitle
AccuracyTitle
and add in RED line TEXT
Now, Open src\classes\warz\frontend
SurvivorsScreen.as
Search
Code:
Survivors.KilledCivTitle.text = "$FR_SURVIVOR_SCREEN_CREATE_KILLED_CIVILIANS";
Add
Code:
Survivors.HeadShotTitle.text = "$FR_HeadShot_Ratio";
Survivors.KDRTitle.text = "$FR_KDR";
Survivors.AccuracyTitle.text = "$FR_ACCURACY";
Search
Code:
Survivors.KilledCiv.text = "";
Add
Code:
Survivors.HeadShotTitle.text = "";
Code:
Survivors.KDRTitle.text = "";
Survivors.AccuracyTitle.text = "";
Go to FrontEndDebug
Search
Code:
api.addClientSurvivor(
Add final line
Search
Code:
Survivors.KilledCivTitle.visible = false;
Add
Code:
Survivors.HeadShotTitle.visible = false;
Code:
Survivors.KDRTitle.visible = false;
Survivors.AccuracyTitle.visible = false;
Search
Code:
Survivors.KilledCivTitle.visible = true;
Add
Code:
Survivors.HeadShotTitle.visible = true;
Code:
Survivors.KDRTitle.visible = true;
Survivors.AccuracyTitle.visible = true;
Search
Code:
Survivors.LastMap.text = survivor.lastMap;
Add
Code:
Survivors.kdrS.text = String (survivor.kdrS);
Survivors.hsrS.text = String (survivor.hsrS);
Survivors.accyS.text = String (survivor.accyS);
Publish and Test
Now in WarZ.sln
Search and uncomment
Code:
sprintf(kdrS, "%.2f", getRatio(float(slot.Stats.KilledSurvivors + slot.Stats.KilledBandits), float(slot.Stats.Deaths)));
Now, change all this func.
Code:
// Kill/Death System Code \ RaGEZONE
char kdrS[32];
sprintf(kdrS, "%.2f", getRatio(float(slot.Stats.KilledSurvivors + slot.Stats.KilledBandits), float(slot.Stats.Deaths)));
var[23].SetString(kdrS); // kdr
char hsrS[32];
sprintf(hsrS, "%.2f", getRatio(float(slot.Stats.ShotsHeadshots), float(slot.Stats.ShotsFired)));
var[24].SetString(hsrS); // hsr
char accyS[32];
sprintf(accyS, "%.2f", getRatio(float(slot.Stats.ShotsHits), float(slot.Stats.ShotsFired)*100.0f)); // accuracy
var[25].SetString(accyS); // accyS
var[26].SetInt(slot.Stats.Deaths); // died*/
in
23 change to
26
Code:
gfxMovie.Invoke("_root.api.addClientSurvivor", var, 23);
Build and test
Finish
http://i.imgur.com/CzcMyAp.png
Re: [Tutorial] Kill/Death System Code
to enable in client just uncomment these lines
in FrontEndWarZ.cpp
Code:
/*char kdrS[32];
sprintf(kdrS, "%.2f", getRatio(float(slot.Stats.KilledSurvivors + slot.Stats.KilledBandits), float(slot.Stats.Deaths)));
var[23].SetString(kdrS); // kdr
char hsrS[32];
sprintf(hsrS, "%.2f", getRatio(float(slot.Stats.ShotsHeadshots), float(slot.Stats.ShotsFired)));
var[24].SetString(hsrS); // hsr
var[25].SetInt(int(getRatio((float)slot.Stats.ShotsHits, (float)slot.Stats.ShotsFired)*100.0f)); // accuracy
var[26].SetInt(slot.Stats.Deaths); // died*/
- - - Updated - - -
and remember that the kdr and hsr is a floating point
Re: [Tutorial] Kill/Death System Code
Re: [Tutorial] Kill/Death System Code
help Me!!!!
It does not change
http://i.imgur.com/GYamqmt.jpg
Re: [Tutorial] Kill/Death System Code
Quote:
Originally Posted by
srbalboa
adds at the end, three new arguments and assign any values
Re: [Tutorial] Kill/Death System Code
Quote:
Originally Posted by
Yuri-BR
adds at the end, three new arguments and assign any values
3 values, however if memory serves me correct, the first 2 need to be string based so.. something like
Quote:
"GetRektBambi","IsSexyyyyy",0
will be sufficient!
Re: [Tutorial] Kill/Death System Code
Quote:
Originally Posted by
GetRektBambi
3 values, however if memory serves me correct, the first 2 need to be string based so.. something like
will be sufficient!
yes, as I said above, kdr and hsr and a floating point, and with two digits after point, so it is being set as a string
Code:
/*char kdrS[32];
sprintf(kdrS, "%.2f", getRatio(float(slot.Stats.KilledSurvivors + slot.Stats.KilledBandits), float(slot.Stats.Deaths)));
var[23].SetString(kdrS); // kdr
char hsrS[32];
sprintf(hsrS, "%.2f", getRatio(float(slot.Stats.ShotsHeadshots), float(slot.Stats.ShotsFired)));
var[24].SetString(hsrS); // hsr
var[25].SetInt(int(getRatio((float)slot.Stats.ShotsHits, (float)slot.Stats.ShotsFired)*100.0f)); // accuracy
var[26].SetInt(slot.Stats.Deaths); // died*/
api.addClientSurvivor(..., "0.00", "0.00", 0);
Re: [Tutorial] Kill/Death System Code
no mistakes, only lack of attention, it's all in the tutorial.
Re: [Tutorial] Kill/Death System Code
Re: [Tutorial] Kill/Death System Code
Quote:
Originally Posted by
McGrumpy
Quote:
Originally Posted by
Yuri-BR
adds at the end, three new arguments and assign any values
api.addClientSurvivor(..., "0.00", "0.00", 0);
Re: [Tutorial] Kill/Death System Code
Re: [Tutorial] Kill/Death System Code
Quote:
Originally Posted by
McGrumpy
errr no! LOL
The ... Stood for what was previously in the function arguments. Therefore append, "0.00","0.00",0 after the aguments and before the );
Re: [Tutorial] Kill/Death System Code
Can you help me i don't know what you guys saying here i try to fix it but its not work can you tell me normally how to fix pls
Re: [Tutorial] Kill/Death System Code
Quote:
Originally Posted by
McGrumpy
Can you help me i don't know what you guys saying here i try to fix it but its not work can you tell me normally how to fix pls
you must add only what is in red
Code:
api.addClientSurvivor("Sagor", 100, 666, Math.random() * 100000, 0, 1, 0, 0, 0, 1, 100, 100, 100, 100, 36, 32, 0, 0, 0, "Good", "Hell", true, 100000, "0.00", "0.00", 0);
Re: [Tutorial] Kill/Death System Code
Yuri look i have now this new errors
http://i.imgur.com/qX8jOhc.png
http://i.imgur.com/fLnvOpa.png
can you maybe send me the full of "FrontendDebug.as" if you can Yuri and thanks for trying to help =D