Scripts / Ranking system

Author
Message
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 8th Apr 2017 19:50
Ive started in a ranking system for H.E.Trooper which is ok for the first rank, but i need to remove the text showing the first rank after so many kills to display the next? ideas anyone please this is what i have so far. 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
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 9th Apr 2017 09:38
Do it in reverse and with else if is probably the easiest

g_kills = 0

function heranks_init(e)
end

function heranks_main(e)
TextCenterOnXColor(50,91.5,3,"Rank",10,255,10)
if g_kills >= 20 then
TextCenterOnXColor(50,98,3,"Corporal",10,255,10)
elseif g_kills >= 10 then
TextCenterOnXColor(50,98,3,"Lance Corporal",10,255,10)
end

end
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 9th Apr 2017 17:03 Edited at: 9th Apr 2017 17:20
Right ok thanks G will give that a go
EDIT: Sweet thanks m8 works now, now for the other 20 odd ranks lol
I would never have thought to do it in reverse order but there ya go, I presume this is why I haven't got the hang of timers? they count in reverse?
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
lotgd
3D Media Maker
14
Years of Service
User Offline
Joined: 2nd Apr 2010
Location: italy
Posted: 9th Apr 2017 17:35
Honkeyboy when you go to next level the variable they are not saved and reset, I'll just say to avoid that we lose time ..

My Pc Specs : Win10pro64bit /Msi z97 / i74770k / gtx1070 / 16gb ram / SSD 850Evo
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 9th Apr 2017 17:54 Edited at: 9th Apr 2017 18:09
Oh yes of course, but couldn't I write those into the level save files I have e.g
if g_Entity[e]['plrinzone'] == 1 then
local file = io.open("temp.dat", "w")

file:write(g_rank .. "\n" ..)

writing them to a temporary file
and call it with

if g_Entity[e]['plrinzone'] == 1 then
local file = io.open("temp.dat", "r")

g_rank = file:read("*n", "*l")
obviously setting all the ranks as globals


I'm actually getting pretty ok with scripting save and loading now
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
lotgd
3D Media Maker
14
Years of Service
User Offline
Joined: 2nd Apr 2010
Location: italy
Posted: 9th Apr 2017 18:17
perfect! you are informed! good job!

My Pc Specs : Win10pro64bit /Msi z97 / i74770k / gtx1070 / 16gb ram / SSD 850Evo
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 9th Apr 2017 18:24 Edited at: 9th Apr 2017 18:36
Ok got all the ranks working here 1 shot per rank at the mo for testing its abit ugly = all the ends at the end of the script, but its working nicely thanks G for pointing out I had it the wrong way round



if anyone is doing wargames it may be of use to you the ranking structure is that of the Cavalry as
1/ Trooper is the first rank and
2/ I was a Lancer in the 80's so its familiar to me lol
anyways you can always change the "" values to a rank you like will let anyone who needs it the code for the save and load when I have it written oh and don't forget to add g_kills = g_kills +1 to your AI script exit and the numbers to how many kills they need to get the next rank
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: 9th Apr 2017 18:25
Quote: "Honkeyboy when you go to next level the variable they are not saved and reset, I'll just say to avoid that we lose time .."


That needs to be reported as a bug, because as far as a I remember g_ variables were coded to carry over tot he next level some time agio.

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 9th Apr 2017 18:28 Edited at: 9th Apr 2017 18:30
Aye not tested it over levels yet Belidos m8 so it might work yet, but I have had to write some things in "Galaxy" that didn't save over into a separate temporary file so maybe it isn't working properly atm, didn't think about it tbh just wrote it into the winzone/memoryzone
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
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 9th Apr 2017 19:54
sorry, i meant reverse to how you were checking, it doesnt need to be reversed in the list, it's just a case of swapping the < / > sign if you want to go up, i just used the > as i was typing on phone so copied your code
so this would also work fine



i see you're getting good at reading from files

storing g_ variables doesn't (and never has) work(ed) between levels - only if you load a save, but you can quite easily autosave at level end (there's a script for that in my thread) and then read the values in the new level as honkeyboy correctly said.


timers are simple enough.
1. just store the first value once (this is best done in the main(e) part just so you know it will start counting at around the right time).
i.e.

2. now compare g_Time again with the stored value + any time delay you want to wait
i.e.

3. if you need to reuse the timer you can just reset the time1 here so the final code looks something like this
(this would add a free kill every 2 secs)


lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 9th Apr 2017 20:12 Edited at: 9th Apr 2017 20:39
Quote: "storing g_ variables doesn't (and never has) work(ed) between levels - only if you load a save, but you can quite easily autosave at level end (there's a script for that in my thread) and then read the values in the new level as honkeyboy correctly said."


Yeah, I remember you doing that, but I could have sworn a little while after you did that Lee changed the g_ to save, I'm probably misunderstanding something he posted though knowing me, lua confuses me no end.

Edit: I've just tried using your autosave script on my two test levels, it doesn't carry over the g_ variables, is there something else I need to do?

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 10th Apr 2017 18:11 Edited at: 10th Apr 2017 18:11
OK ive had a bash at writing a save and load for the ranking system and have the save saving to a temporary file ok

half way through the load script

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

Attachments

Login to view attachments
gd
7
Years of Service
User Offline
Joined: 21st Jul 2016
Location: Small Darkroom with no red light
Posted: 10th Apr 2017 21:30
Hi Honkeyboy, looking good.

As you know I have been working on a score system too. You could also use timers to increase scoring and the ranking system.

Example would be; so many kills in a small amount of time. Also so many kills before you die will also increase their rank.
It will just adds a little more spice to your levels / games and encourage players to go all out to hit the high scores each time they play. Also steam rewards trading cards, etc.

Headshots, Multi-kills and Killing Sprees, etc.

Just an idea.
Dark Base 900 Pro OJ: Rampage V Ed.10, i7 6950x non-OC, DDR4-3333 64 GB RAM, Win 10/64, Asus Strix GeForce 1080 x 2 SLI mode, Water cooled with an old Victorian cast iron radiator and a industrial leather belt driven fan - That's what you call Steampunked.

Laptop - M17xR3


A new competition running for GG
PM
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 11th Apr 2017 14:25 Edited at: 11th Apr 2017 15:18
Yeah gd totally agree with that m8 was just getting the first bits working, going to try tables next to save all the individual filesaves, then hopefully better it, i no scripter really but im slowly getting there.
EDIT:
ok ive re written the main rank script into tables but im finding that now the ranks go up to lance corporal and no futher? any ideas why guys plz?

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
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 11th Apr 2017 15:45
Try script attached above.



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
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

Attachments

Login to view attachments
PM
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 11th Apr 2017 15:50 Edited at: 11th Apr 2017 16:15
thanks 3com will give that a bash
oh thats the save script, oh ok mine works but that looks a lot tidier thanks m8 Its the one in the last post im stuck with m8 doesnt count past lance corporal for whatever reason
ive tried to add g_rank [1] = 0
g_rank [2] = 1 = no go with that :/

EDIT: oh i see yours is a kind of all in 1 display with the save built in nice same problem as mine tho m8 doesnt count past lance corporal
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: 11th Apr 2017 17:33
Just a little tip.

I see you're trying to use the British army rank struture there. In British army ranks, CSM and RSM aren't linear ranks. They're kind of side ranks, or senior versions of the Warrant Officer 1st class ranks, there will only be one CSM per company and one RSM per regiment.

Also staff sergeant is a support regiment specific rank, generally the rank is actually Colour Sergeant, it's only Staff Sergeant in the logisitcs, artillery, R.E.M.E and so on

So if you're working off of a more general army basis it would probably be best to have the following base structure for non commissioned ranks:

Lance Corporal (lance jack)
Corporal (Cpl)
Sergeant (Sgt)
Colour Sergeant (Colour)
Warrant Office 2nd Class (WO1)
Warrant Officer 1st Class (WO2)

(although it is nice to see someone use Staff Sergeant, that was my rank in the 4th herts and beds RA)


Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 11th Apr 2017 17:49 Edited at: 11th Apr 2017 17:54
Same with the 17/21st m8 which i was in, yeah do know about the abbs for the ranks and WO1/2 etc just familiar with CSM and RSM as they used to be well erm cough shouting at us a lot lol kinda hard to forget the RSM and i think not alot of people would know Lance Jack to be honest the true name if i remember from the charge of the light brigade, was Corporal of the Lance and was generally charged with looking after the Lances.
Just as well our sgt's used to have a few bevvies, get mullard and chase the chickens round the garden with them, me and my m8's used to have to retrieve them from the fences etc etc in the mornings lol
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: 11th Apr 2017 17:53 Edited at: 11th Apr 2017 17:54
Quote: "hard to forget the RSM"


Hard to forget the RSM at colchester, i went there for my promotion from sgt to staff, it lasted a day, we celebrated the hell out of the sgt's mess and i woke up the next morning asleep in the middle of the drill square with the rsm shouting at me, so hungover still i didn't know what was happening i told him to ..... off and get out of my room, it was beret off, belt off, laces out, straight to the glass house and rank revoked lol

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 11th Apr 2017 17:55 Edited at: 11th Apr 2017 17:56
Buffing the ceiling for that man! lol didnt get many ranks tbh too much of a mad head got acting full screw for a bit while doing the armoury
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: 11th Apr 2017 17:56 Edited at: 11th Apr 2017 17:59
Quote: "Corporal of the Lance"


Corporal of the Lance is still a rank in the British army, it's the equivalent rank of Sergeant, and only used in mounted guard regiments.

Good old Lance Corporal rank though, hardest to get, easiest to lose, the lance jacks always got the slack, i lost my lance jack about a dozen times before i managed to move on to corporal, after that the ranks came much easier lol

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 11th Apr 2017 17:59
I suppose hence being in the Sgt's mess there again we didn't do much horseback , just Chieftain and then Challenger1
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: 11th Apr 2017 18:00
I was Artillery, sitting on the back lines drinking tea and firing shells

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 11th Apr 2017 18:04 Edited at: 11th Apr 2017 18:10
lol we did alot of sitting was 1986 so Challenger was brand new then was the first Sqn to get it so you just kinda polished it a bit lol until the twice yearly lets go wreck stuff time at Soltau dont ya kinda love heavy weaponry lol anyway.....lol
need to find out why this doesnt count past the first rank whatever army, regiment etc you want to use

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

Login to post a reply

Server time is: 2024-04-20 15:08:32
Your offset time is: 2024-04-20 15:08:32