Sauerworld Forum

Flag holders and time reset flag script

alebrije

  • *
  • 21
  • +4/-0
    • JuGadores Latinos eXtremos
Flag holders and time reset flag script
« on: January 12, 2016, 08:09:50 PM »
NOTE: The script is only for the WC-NG Client (by Thomas)

Well, this script show the name of the flag holder in the gamehud and also the count down in seconds until the flag was restored/reset (when the flag is droped).
Thomas help me with the script long time ago but i "lose" the script when i formated my PC  :o so i have to make it again.

You can see the script here (in pastebin): flag holder script

Here some screenshots:











If you are as spectator maybe the names are blocked so, you need add more 'new lines' (^n) to put the names over the "SPECTATOR name" label in the screen.

Thx Thomas for the support and i'll try do it with vectors the next time,  ::)


How install:
  • Extract the content of the zip file (flag_holder.cfg) in your config dir (where you have your autoexec.cfg)
  • Add the next line at the end of your autoexec.cfg: exec flag_holder.cfg
  • And... thats all. You will see the next message at startup of sauer: Flag holders extension loaded.
« Last Edit: January 21, 2016, 06:39:16 PM by alebrije »
Verba volant, scripta manent

alebrije

  • *
  • 21
  • +4/-0
    • JuGadores Latinos eXtremos
Re: Flag holders and time reset flag script
« Reply #1 on: January 25, 2016, 09:45:00 PM »
Well, I've found the script that made Thomas and I (he teach me how to use the scriptvectors).

And you can see it on the link: flag holder script (with scriptvectors) v1
(you can download the zip file flag_holder_v1.zip)
The output format of the script is the same as the first script, i mean with two lines: one for the red flag events and the other one for the blue flag.

And i did another one (well, is the same thing) but the format output is in one single line (i remember that this is the Thomas way).
This is the script: flagholder script (single line)
(you can download the zip file flag_holder_v2.zip).
Screenshots of the single line version:









blue name = name of your team mate who has the red flag
red name = name of the enemy player who has the blue flag (your flag)
red number = countdown (in seconds) until the red flag is restored
blue number = countdown (in seconds) until the blue flag is restored

Apparently the first version (without scriptvectors) has a bug (at least) and consists of the following: if someone has the flag or has droped the flag, and changes the map during the game (that's still not finished) the "flagholder hud" show the names who carried the flag (or the countdown if the flags was droped) in the previous map. Well, this is my impression (I've not verified).

Why is this? Because i dont reset the flags at mapstart event.

What I did? (in the versions with scriptvectors) Every time you connect to a server or start a new game (or map) values of the flagholder_hud are cleared. This implies that if at the time you connect to a server and someone has the flag or has droped the flag, does not display the name or countdown as these events have still not been "detected" by the script. As soon as one of these events happen (since your are connected), the script will begin to work normally.

This is because the event mapstart happens when you connect to a server (not only when a new game start), it is somewhat rare but this is how it works. And I am not referring only to the scriptevent "mapstart", but also to the "function" mapstart of the vanilla client.

If anyone knows how to solve this "bug", I would appreciate your help.
« Last Edit: January 25, 2016, 09:49:20 PM by alebrije »
Verba volant, scripta manent

alebrije

  • *
  • 21
  • +4/-0
    • JuGadores Latinos eXtremos
Re: Flag holders and time reset flag script
« Reply #2 on: January 26, 2016, 09:31:45 PM »

Apparently we can not know who is carrying the flag and whether it was released (seconds before) at the time of connecting to a server as these events are activated from the moment that we connect to that server. We cannot know what occurred seconds before you connect, this information has only the server and we cannot get it at the time of connecting.

The scriptevents dropflag, flagtaken, flagreset and flagscore do not know what happened seconds before to connect to a server. They begin to work at the time that we are already connected to the server.

So when you connect or change server, the names of the flag carrier or his countdown is not shown (will be clean), until any of the events listed above happen.
Verba volant, scripta manent

Suicizer

  • ***
  • 141
  • +6/-5
Re: Flag holders and time reset flag script
« Reply #3 on: November 22, 2016, 08:31:45 AM »
What if you would reset the script if the start-intermission is shown? Every new match starts with a gametime (which could be used to trigger the reset), a maptitle and the gamemode. So when called up the echo of maptitle, it resets the script.

Another idea,
What if you use the remaining time as a value to reset the timer? So if the remaining time is equal or more than at the start of a match (at default 10 minutes), the script values should be reset.
« Last Edit: November 22, 2016, 04:16:35 PM by Suicizer »