Scripts / Counting the amount of enemies i killed and writing the amount to a text file.

Author
Message
stor
9
Years of Service
User Offline
Joined: 27th Feb 2015
Location:
Posted: 5th Jan 2017 10:57
How do i do it?
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 5th Jan 2017 20:21
Quote: " Counting the amount of enemies i killed"

Here you'll need to declare some global var at the top of the script.
That global var hold all the enemies killed amount. (killcount)

Quote: "and writing the amount to a text file"

Here you'll need a function doing the task, or some code added directly to the "soldier script" i the "exit" part of the function.
function ai_soldier_killcount_exit(e).

Attach this code to each enemy you want to count.



Analyze the script step by step, try to understand how it works, to be able to apply it, in other different cases.

hth

3com


Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
stor
9
Years of Service
User Offline
Joined: 27th Feb 2015
Location:
Posted: 8th Jan 2017 08:11
thank you!!!
PM
Unspokenbond
8
Years of Service
User Offline
Joined: 28th Nov 2016
Playing: GameGuru
Posted: 10th Jan 2017 21:11
This is awesome! Would it be possible to display the kill count on the screen at all times? So the player could always know and see the count going up?
Still learning LUA but 'attempting' to build my first game
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 10th Jan 2017 22:35

Easy way for do it, just add some trigger closest to the player start market, and attach script bellow to it.



hth

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
Unspokenbond
8
Years of Service
User Offline
Joined: 28th Nov 2016
Playing: GameGuru
Posted: 11th Jan 2017 04:07
oooh snap so awesome thank you sir!!

I'm looking thru the code now. I'm trying to make it so I have enemy kill count and civilian kill count so the player can see both. Super fun!
Still learning LUA but 'attempting' to build my first game
PM
Unspokenbond
8
Years of Service
User Offline
Joined: 28th Nov 2016
Playing: GameGuru
Posted: 11th Jan 2017 04:48
Just got it so it displays both. I'll post the code shortly after some testing
Still learning LUA but 'attempting' to build my first game
PM

Login to post a reply

Server time is: 2024-12-23 03:18:24
Your offset time is: 2024-12-23 03:18:24