Author Topic: *Scripting Thread*  (Read 87974 times)

0 Members and 1 Guest are viewing this topic.

Offline Johny_Nawalony

  • First Lieutenant
  • *
  • Posts: 762
    • View Profile
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #120 on: June 12, 2016, 06:34:11 pm »
Is it posibble to implement misfires throught scripting?, so the musket wont really shot, and the player will reload from the last phase? (powder to the pan)
I can do paid skin comissions so yeah msg if ya want one

Offline Victorcin

  • Second Lieutenant
  • *
  • Posts: 67
    • View Profile
    • SpainIsLife
  • Side: Neutral
Re: *Scripting Thread*
« Reply #121 on: June 17, 2016, 02:23:32 am »
Hello all,I wanted to know if I can answer these two questions and how they could make such a change.

1º- It is possible that when a person does kill team using a firearm to be thrown from the server.

2º-When a person friendly fire or remove a player takes a message on the screen.

Regards,Victor.
He visto lo bastante de una guerra para no desear volver a ver otra.

Offline Grozni

  • Second Lieutenant
  • *
  • Posts: 308
    • View Profile
  • Nick: RRA_10thRH_SoH_Grozni
  • Side: Neutral
Re: *Scripting Thread*
« Reply #122 on: June 17, 2016, 06:54:00 pm »

1. multiplayer_server_agent_hit_common trigger in mission_templates
In block which applies to server (      (this_or_next|multiplayer_is_server), (neg|game_in_multiplayer_mode),)
-Get victim's agent (store_trigger_param_2,":attacker_agent_no"),
-Check if attacker is a player, check if victim is a player (if you don't want this to work for TKing bots), get their players (agent_get_player_id,":attacker_agent_player",":attacker_agent_no"), and their teams and compare if they're same team to continue
-Check if victim will lose more or equal to HP that he already has (if you want this to work only for killing and not wounding) to continue. You get damage dealt with (store_trigger_param_3,":damage"),
-Get attacking item stored in reg0 and check if it is firearm, or a bullet, I'm actually not sure what kind of item will be attacking item in case of firearm.
-if all checks are true, (kick_player, ":attacker_agent_player"),

2. Not sure what kind of message you want to display, look into how script_multiplayer_broadcast_message works.

Offline Gurkha

  • Lieutenant General
  • ***
  • Posts: 2650
  • Former 33rd LtCol
    • View Profile
    • Official 33rd Regiment of Foot Website
  • Nick: Gurkha
  • Side: Union
Re: *Scripting Thread*
« Reply #123 on: June 17, 2016, 08:54:10 pm »
Any possible script that could auto kick/ temp ban a player if they type a keyword like a offensive term/slur in both chats ingame?

Offline Grozni

  • Second Lieutenant
  • *
  • Posts: 308
    • View Profile
  • Nick: RRA_10thRH_SoH_Grozni
  • Side: Neutral
Re: *Scripting Thread*
« Reply #124 on: June 17, 2016, 09:39:36 pm »
Any possible script that could auto kick/ temp ban a player if they type a keyword like a offensive term/slur in both chats ingame?

No, at least as far as I know. Accessing stuff typed in chat in NW is impossible.

One workaround I can think of is very complicated and outside of scope of NW modding: have a script on the server (Linux script, not mod script) which periodically scans the game server's latest log file for censored words, if found extract the name and game ID of this person from same log file, then have it trigger the ban somehow, that is more complicated part but possible.

Offline Thunderstormer

  • FSE Developer
  • ****
  • Posts: 6309
  • Worse than Hotler
    • View Profile
  • Side: Neutral
Re: *Scripting Thread*
« Reply #125 on: June 17, 2016, 10:21:39 pm »
messing around with the admin stuff and i am trying to figure out how the game gives you the list of say living players only.  I want to make refill ammo command do something more useful but it would only work on dead people.  so getting a list of all the dead players(and only dead) would be helpful but i haven't had any luck in figuring out where to look or how to do it. ( i would imagine it would be a simple change somewhere to look for dead agents + a few other possible tweaks if necessary)

nvm, figured this out the other day.  had to make the changes client side to get it to show up.

i made it so this is now possible on na1.

Spoiler
[close]



Spoiler
[close]

Spoiler
[close]
Should you need to talk to me regarding NA1 or or something regarding admining or the admins, PM me here on the forums and not on steam.  *

*This does not include Official Server Admins.

Offline Grozni

  • Second Lieutenant
  • *
  • Posts: 308
    • View Profile
  • Nick: RRA_10thRH_SoH_Grozni
  • Side: Neutral
Re: *Scripting Thread*
« Reply #126 on: June 17, 2016, 10:43:58 pm »
Congrats on making a resurrection script by yourself, too bad it requires client mod tho, maybe the player list can be populated server-side I'll look into that.

Offline Thunderstormer

  • FSE Developer
  • ****
  • Posts: 6309
  • Worse than Hotler
    • View Profile
  • Side: Neutral
Re: *Scripting Thread*
« Reply #127 on: June 19, 2016, 12:04:35 am »
Congrats on making a resurrection script by yourself, too bad it requires client mod tho, maybe the player list can be populated server-side I'll look into that.

Thanks.  and yea, idk much about presentations.  i haven't found any tutorials about how they work as of yet.  I took a guess that if other presentation changes/additions other people made could be used client side without the server having them then mine would work too.  and it did.  i plan on messing around with it a little more to see how things work or what can be made/changed.
Should you need to talk to me regarding NA1 or or something regarding admining or the admins, PM me here on the forums and not on steam.  *

*This does not include Official Server Admins.

Offline DanyEle

  • FSE Associate
  • ***
  • Posts: 517
  • Sssh! I'm coding, don't disturb :D
    • View Profile
  • Nick: DanyEle
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #128 on: June 19, 2016, 11:50:56 am »
Any possible script that could auto kick/ temp ban a player if they type a keyword like a offensive term/slur in both chats ingame?

No, at least as far as I know. Accessing stuff typed in chat in NW is impossible.

One workaround I can think of is very complicated and outside of scope of NW modding: have a script on the server (Linux script, not mod script) which periodically scans the game server's latest log file for censored words, if found extract the name and game ID of this person from same log file, then have it trigger the ban somehow, that is more complicated part but possible.
It's indeed impossible in Warband's engine itself, as there is no way to filter content of strings there. Still, external libraries like WSE actually allow that in other Warband mods. However, an alternative to achieve this in Napoleonic Wars would be routing messages sent by players to an external PHP script, which filters and checks the content, eventually sending back a response for the server to kick / ban the player that typed the message. Not so straight forward and you would need a web server for that. But still doable! It's similar to this , OSP code. So you may look at it and eventually take whatever you need  ;) . Yeah, it's for PW, but Warband is still Warband.



Offline Grozni

  • Second Lieutenant
  • *
  • Posts: 308
    • View Profile
  • Nick: RRA_10thRH_SoH_Grozni
  • Side: Neutral
Re: *Scripting Thread*
« Reply #129 on: June 19, 2016, 12:06:41 pm »
Now I'm curious, though I can't figure out how can this be applied to an unmodified NW client, as this script is about custom chat channel so you can't use it for standard global/team chat, right? How would you route standard global/team messages sent by players to the external script, without another external script that parses the log?

Offline DanyEle

  • FSE Associate
  • ***
  • Posts: 517
  • Sssh! I'm coding, don't disturb :D
    • View Profile
  • Nick: DanyEle
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #130 on: June 19, 2016, 02:03:58 pm »
That's right. It would only apply to custom chat channels, unless you find somewhere in the Module System where Team / Global chat messages are handled (which I haven't found yet), so it could just work for Admin chat, unfortunately. This way you could still make sure your admins don't use any bad words  ;D



Offline Pio

  • Sergeant
  • *
  • Posts: 47
    • View Profile
    • my steam profile
  • Side: Neutral
Re: *Scripting Thread*
« Reply #131 on: June 19, 2016, 08:01:48 pm »
You will not find global and team chat in the module system. It's not there. I haven't read every single line of code in there so I could be wrong, but I'm pretty sure it isn't there. Maybe you could somehow reverse engineer the game to achive what you want. A PHP script will do that, but only with admin chat and also that solution has one issue: if your web server is offline because of any reason you will not get your results.

The only solution would be what Grozni suggested: write a program (or have someone do it) that constantly searches for certain words in log file. Unfortunately there might be a problem with this solution too. You would have to convince your hosting provider to put it on the server or make the program connect through FTP and make it constantly download the newest log file so that your program could use it. Unless you host your server on your own hardware.

Offline Lilja Mariasdóttir

  • Colonel
  • *
  • Posts: 2015
  • Ist ein Schaf in einer Tasse
    • View Profile
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #132 on: June 22, 2016, 02:27:53 pm »
nvm, figured this out the other day.  had to make the changes client side to get it to show up.

i made it so this is now possible on na1.

If the plan is still to have it without a client mod, you could use for example the kick-playerlist in both ways, you just need a switch. I like to abuse "Poll Threshold (%)" if it has to be totally serverside (there you have from 50-100 any number free to use, so 50 different functions).
However, a player could now type 50 into it and his kick-playerlist reverts into Ressurection-playerlist, and the other way around, completly serverside. This is of course quite circuitous for the admin to use.
A clientmod would be the most easy thing, just add to the playerlist another mode (only displaying deads and sending a different result to the server).
The actual playerlists are totally clientside, you cant manipulate them from serverside.
Seehofer schafft das Heer ab.

Offline Thunderstormer

  • FSE Developer
  • ****
  • Posts: 6309
  • Worse than Hotler
    • View Profile
  • Side: Neutral
Re: *Scripting Thread*
« Reply #133 on: June 23, 2016, 05:41:43 pm »
That is pretty neat.  Never thought of using that but now that you point that out, that could be very useful.(seen you did some neat stuff with polls on Griffs server)   but yea, if the refill stuff was actually useful on na1, that would be good way to have both.(for those who don't know, the refill ammo does not give you ammo if you lost it in the water.  you lose your cartridges so it cant be refilled.  now i could of fixed this by giving those who don't have any cartridges another ammo item but meh.  it would rarely be used on na1)

never really looked at the polls.  Most servers have them off.  Deofuta turned them off in the fall of 2012  for NA1 as people as per usual, spam them all the time for lols. 

not really sure if there is anything left for me to add in terms of scripting.  I have it so it writes in the logs when the map changes and the round ends.  i have my own intro message.(well not just for me, everyone gets their own)  i have it so people can be revived.  teamwounding and teamkilling(includes horses) show up.  i made it so i can ban admins in server.(only the senior admins currently) and i put a "god mode" on there as well.(this could be tweaked by me later but it works)

one thing i was curious about was if it is possible to have another "tier" of admins that log in with a different pw.  i never could find where one joins the server(and typing said pw) i mean i can make a new tier by limiting what they can access in the admin panel/powers.(which i did)  i figured if one could make a new tier, it would be easier to go down that route in the long run.
Should you need to talk to me regarding NA1 or or something regarding admining or the admins, PM me here on the forums and not on steam.  *

*This does not include Official Server Admins.

Offline Lilja Mariasdóttir

  • Colonel
  • *
  • Posts: 2015
  • Ist ein Schaf in einer Tasse
    • View Profile
  • Side: Confederacy
Re: *Scripting Thread*
« Reply #134 on: June 23, 2016, 09:18:35 pm »
Not sure, what you mean with "Griffs server", but if you mean my cavserver, yeah, polls are a way for nonadmins to communicate to the server, without a clientmod.
Disadvantage is, that they can only do a poll every 15 minutes (or after a mapchange).

You can create different types of admins, but I think you will need to decide what kind of admin they are, via different GUID-lists, or you use a clientmod, and people have to enter another admincode/different clientmods send automatic different codes. With a clientmod, you could disable the need to type an adminpw completly (server tells the client he is admin).
Seehofer schafft das Heer ab.