Sauerworld Forum

[ACCURACY WARS] - NEW SERVER MOD!

va|DeathStar

  • *
  • 19
  • +1/-0
    • TechMaster
[ACCURACY WARS] - NEW SERVER MOD!
« on: October 22, 2017, 04:35:15 pm »
Server Name
[ACCURACY WARS]

How it works
If anyone gets higher than 50% accuracy, they get +40 health each time someone dies.
When their accuracy drops below 50% again, the health boost goes away.

Fun mode ideas
efficctf - a flagcarrier that is healthboosted because of high accuracy can sustain for a long time.

effichold - if you're accurate, you can be an amazing flagholder, you will keep regenerating health.

effic - snipers rule accuracy wars efficctf. Any high accuracy player will be rewarded heavily.

regen capture - the rifle base will be the most demanded base in the whole game, like a capture point.

collect - collecting the skulls will be easy with a healthboost.

tactics - since weapons are supplied randomly, the healthboosted people will most likely be random too.

ffa - this would be the most difficult to get high accuracy on. Rifle pickups rule.

insta - this mod doesn't work well in insta because the health isn't restored. Avoid this mode.

Pass the flag
you can pass the flag in accuracy wars. This allows the game to progress more rapidly.

Ideas?
If you have ideas for another mod that you'd like to see, please post a reply and I will work on it, seriously.
I have been considering linking hulk mode with accuracy wars but I don't know what people want.

The code
 void checkbestacc() {
        loopv(clients) {
            clientinfo *ci = clients;
            if(!ci->CheckedBestAcc && ci->connected && ci->clientnum < 128) {
                int cacc = clients->state.damage * 100 / max(clients->state.shotdamage, 1);
                if(cacc > 50) {
                    defformatstring(sc)("You are accurate (%d%%), giving you +40 health!",cacc);
                    sendf(ci->clientnum,1,"ris",N_SERVMSG,sc);
                    ci->state.health = ci->state.health+40;
                    ci->CheckedBestAcc = true;
                }
            }
        }
    }
« Last Edit: October 22, 2017, 04:36:46 pm by va|DeathStar »

Timon

  • *
  • 7
  • +0/-0
  • Argh, my stick...
Re: [ACCURACY WARS] - NEW SERVER MOD!
« Reply #1 on: October 22, 2017, 04:59:10 pm »
Why do you use "clients->" instead of "ci->" in some parts? (makes code looks confusing)

CheckedBestAcc variable looks like you're trying to to call checkbestacc() function in the server mainloop (or it's not going to add +40 hp each time someone is dying). See no sense. Would be easier to process that logic just inside server damaging/death procedure.

Why bots are excluded? If you do everything right, you won't get segfaults about it. (Just don't send them N_SERVMSG messages)

Thought would be better to reset player accuracy every death.
« Last Edit: October 22, 2017, 05:07:46 pm by Timon »
Go out my love, u smell.

va|DeathStar

  • *
  • 19
  • +1/-0
    • TechMaster
Re: [ACCURACY WARS] - NEW SERVER MOD!
« Reply #2 on: October 22, 2017, 05:13:14 pm »
checkbestacc is being called from dodamage under ts.health 0 so no need to reset acc.

clients loops through all the clients.

ci is an abréviation for clientinfo. ci->state is one thing and clients is another.

Timon

  • *
  • 7
  • +0/-0
  • Argh, my stick...
Re: [ACCURACY WARS] - NEW SERVER MOD!
« Reply #3 on: October 22, 2017, 05:33:27 pm »
checkbestacc is being called from dodamage under ts.health 0 so no need to reset acc.

clients loops through all the clients.

ci is an abréviation for clientinfo. ci->state is one thing and clients is another.

If it's called from dodamage, then you can immediately check accuracy, and add health if target died. Variable CheckedBestAcc is not needed

Code: [Select]
"clients[i]" same as "ci" in your code
Have no idea why do you mix them.
Replace all "clients[i]->" to "ci->", it's gotta work the same way.
But well, it's only matter of formalization, doesn't really affects to anything.
« Last Edit: October 22, 2017, 05:37:58 pm by Timon »
Go out my love, u smell.