Scripts / Kill counter launches sprite after x kills

Author
Message
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 16th Oct 2016 18:00 Edited at: 16th Oct 2016 18:03
Im starting to try to put together a kill counter script that displays badges after x kills but my scripting skills are that of a house brick :/ so far i have the counter display working and it counts to 1 and stops can anyone give me any pointers here plz thanks


Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 16th Oct 2016 20:17 Edited at: 16th Oct 2016 20:46
LoadImage only loads the image into memory, it doesn't display it on screen.




obviously in your AI's script, in the death section you need to add:

g_kills = g_kills + 1

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 16th Oct 2016 20:52
Oh .. that script will only show the badge if you have exactly 10 kills, when you get 11 it will disappear, if you want it to stay on screen you need to change:


  if g_Entity[e]['plrinzone']==1 and g_kills == 10 then

to

  if g_Entity[e]['plrinzone']==1 and g_kills >= 10 then

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 16th Oct 2016 20:56 Edited at: 16th Oct 2016 21:40
Cheers Belidos the main thing was it was only counting to 1 and no further any ideas why that might be? re-tested and still only counts to 1

Edit ok think i found the issue, because im using an adapted cash display script by DVader they seemed to conflict so what i did was add it to that script and it seems to be working although the sprite isnt displaying (maybe i have it pointing to the wrong folder) I'll look into that

Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 16th Oct 2016 21:18 Edited at: 16th Oct 2016 21:18
What are you doing to increase the count?

You need to put


g_kills = g_kills + 1


in the death part of the AI script of the character you want to kill

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 16th Oct 2016 21:32
Also, the format of your LoadImage line is wrong, you cannot specify a specific file path with images, only a folder.

It needs to be ...



i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 16th Oct 2016 21:41 Edited at: 16th Oct 2016 21:57
yeah had that on the soldier script m8 just didn't seem to want to work as a separate script see above oh and that'll be why that bit isnt working lol so should the image be directly in the images folder? or can it be in a folder? ( and this is scriptbank\images? )
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 16th Oct 2016 22:32 Edited at: 16th Oct 2016 22:49
OK i wrote you a script (no need to change the name or location of your image):



Put it in a dynamic, always active entity

in ai_soldier.lua (best work with copies if you are editing default scripts), find:



and change it to:



that should do the job for you.

Note: in the init I added variables for size, and position of the text and the images so you can change it easily.

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.

Attachments

Login to view attachments
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 16th Oct 2016 22:53
Here's the same script, but when you have 20 kills it displays two badges, you should be able to work it out from there if you want more.




For some reason it doesn't work if you head shot them, maybe someone could tell us why?

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.

Attachments

Login to view attachments
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 16th Oct 2016 23:22
Cheers Belidos m8 im sure others who see this will also find some use so thanks m8
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 16th Oct 2016 23:24 Edited at: 17th Oct 2016 08:19
Quick video to show it working (please excuse the sprites i've used, the closest image at hand was a penguins skeleton with arrows proving that penguins do in fact have knees ) ...


i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 17th Oct 2016 11:58
Nice one didn't actually use your script as a separate script but added it to the script i have running on all the maps (that way i don't have to drop in and edit every map) but thanks m8 works like a charm. I will just have to edit the kills to 100, 500 and 1000 change the badges to "Imp KIller", "Imp Destroyer" etc and add some sounds. Here it is in action

Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 17th Oct 2016 12:16
Glad i could help

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.

Login to post a reply

Server time is: 2024-05-07 20:59:35
Your offset time is: 2024-05-07 20:59:35