Hello all, I am looking for a way to increase the default health and ammo based on a admin level check. Wonder if this is possible via lua script.
increase ammo and health based on admin level
no, the concept of level up is nothing new. but I guess this really depends on who you ask,
yes the perks are restricted to a “selection of people” as they level up…which again…is nothing new. but I am hoping to avoid this turning into a debate thread, because how people run their server varies.
And I guess its not really “select” at all, given that I have auto level working, and everyone has the same chance to earn levels. I think it would only be unfair if not everyone had the same opportunity.
I suppose it is possible via lua.
However I wouldn’t do that because it might be considered unfair. And it will make new players start at a disadvantage so they’ll be discouraged from staying on your server.
It is possible. I made the classes hp different from each and as a result I got special classes on my infected mod. Also I give ammo for kills with this lua and this can even go over the default ammo limit given by the source mod (can be coded how you want it to be).
You can find the newest infected lua here to check how I make it possible: http://mnwa.bplaced.net/ftpfiles/infected/infected.lua
However you need to do some codeing and check for the skills/xp/adminlvl which is possible too.
Silent mod has a nice site to check lua (take note that some parts are different then on other mods): http://mygamingtalk.com/wiki/Silent_Lua
Etpros lua: http://wolfwiki.anime.net/index.php/Lua_Mod_API
Overall you might use et.gentity_get() and et.gentity_set() functions to check/set ammo/hp/skill:
http://wolfwiki.anime.net/index.php/Fieldname
EDIT I misread on the way you want, so it will be et.G_shrubbot_level() to check for admin level.
Lats but not least, I did a “messy” hide&seek lua a while ago which comes with features like callofduty.
It is not a good way of coding, sry for that.
http://mnwa.bplaced.net/ftpfiles/Lua/hns.lua
I understand the potential for the public to abuse, so feel free to PM me any help on this. Basically the plan would be to increase the soldier class like maybe 10 health over a span of 10 levels or so.
Micha,
Taking from autolevel lua, and your infected lua, there should be a way to do it as below (just an idea as I am no coder)
if getXP(clientNum) >= lvl10xp and getXP(clientNum) < lvl11xp then
et.gentity_set(cno, "health", == 145)
Curious how the people on your server will like it. I concur with thunder and mateos and I personally see this as a way to bring certain people in better position for the cost of less active and less experienced people. But it’s a free world and your player numbers will reflect if people like it or not 
Alright, I came up with a simple lua which just do the simple stuff. It can be improved on the way it gives ammo (but I need more info about it then). for example Flamethrower and Grenades wont benefit right now.
It will need an extra check for the weapon and then handle it differently.
I agree on the above and think it is unfair, maybe it would be better to make it xp based instead of admin level but anyways, I made it like you wanted.
first lua version (Note: it might be better to load the stats_table once and not each time):
--[[
extraStats.lua
===================
by Micha!
Contact:
--------------------
http://www.teammuppet.eu
Info:
--------------------
This lua grants extra ammo and extra health based on admin level.
Further information:
--------------------
http://forums.warchest.com/showthread.php/47302-increase-ammo-and-health-based-on-admin-level
--]]
-------------------------------------------------------------------------------------
---------------------------------CONFIG START----------------------------------------
-------------------------------------------------------------------------------------
--[[-----//---------------------stats table----------------------------
Set extra_health = 0 and/or extra_ammo = 0 if you do not want to grant additional benefits.
The following is just an example of benefits.
--]]
stats_table = {
{ admin_lvl = 0, extra_health = 0, extra_ammo = 0, },
{ admin_lvl = 1, extra_health = 10, extra_ammo = 10, },
{ admin_lvl = 2, extra_health = 20, extra_ammo = 20, },
{ admin_lvl = 3, extra_health = 30, extra_ammo = 30, },
{ admin_lvl = 13, extra_health = 40, extra_ammo = 40, },
}
-------------------------------------------------------------------------------------
-------------------------------CONFIG END--------------------------------------------
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
----------DO NOT CHANGE THE FOLLOWING IF YOU DO NOT KNOW WHAT YOU ARE DOING----------
-------------------------------------------------------------------------------------
Modname = "extraStats"
Version = "1.0"
Author = "Micha!"
local amount_weapons = 49
function et_InitGame(levelTime,randomSeed,restart)
maxclients = tonumber( et.trap_Cvar_Get( "sv_maxClients" ) ) - 1
et.G_Print("^z["..Modname.."^z] Version: "..Version.." Loaded
")
et.RegisterModname(et.Q_CleanStr(Modname).." "..Version.." "..et.FindSelf())
et.G_LogPrint("["..Modname.."] created by "..Author.."
" )
end
function et_ClientSpawn(cno,revived)
for _, line in ipairs(stats_table) do
if et.G_shrubbot_level(cno) == line.admin_lvl then
-------//--------------------Extra ammo------------------------------
for k = 1, amount_weapons do
et.gentity_set(cno, "ps.ammo", k, (et.gentity_get(cno, "ps.ammo", k) + line.extra_ammo))
end
-------//--------------------Extra health----------------------------
local current_health = et.gentity_get(cno, "health")
if checkclass(cno) == 1 then
et.gentity_set(cno, "ps.stats", 4, current_health + line.extra_health - (line.extra_health/10))
else
et.gentity_set(cno, "ps.stats", 4, current_health + line.extra_health)
end
et.gentity_set(cno, "health", current_health + line.extra_health)
end
end
end
--0=Soldier, 1=Medic, 2=Engineer, 3=FieldOps, 4=CovertOps
function checkclass(client)
local cs = et.trap_GetConfigstring(et.CS_PLAYERS + client)
return tonumber(et.Info_ValueForKey(cs, "c"))
end
Download: http://mnwa.bplaced.net/ftpfiles/Lua/extraStats.lua
Thank you much for this, So far it works! Almost feels like Christmas.
I am okay with only bullet weapons, don’t need extra grenades function, I think there is another lua somewhere for changing grenade values?
I am setting an increase of 1hp/ammo per level, and on my server it works the same as XP based because I use autolevel and nothing else. So should not be unfair in my opinion.
How does the class config work? I see at bottom the classes, is that for some other function or can classes be excluded from this script? If not it is okay, I was only curious.
Thank you again Micha, you still amaze me.
It is a function to get the player class from the client. It is possible to get this with et.gentity_get(client, “sess.playerType”) too.
You can check if a player plays a (example) fieldops with “if checkclass(client) == 3 then”
grenades, flamethrower, mortar could be added like this:
et.gentity_set(cno, “ps.ammoclip”, 6, (et.gentity_get(cno, “ps.ammoclip”, 6)+line.extra_ammo)) --flamethrower
They use just ammoclip and not ammo. That’s the reason why it wont work right now.
Flamethrower has the number 6, mortar 35 and grenade 4 and 9.