Flying Squirrel Entertainment

Mount & Blade Warband: Napoleonic Wars => Modifications => Topic started by: Saxinger on August 10, 2013, 01:27:33 pm

Title: *Scripting Thread*
Post by: Saxinger on August 10, 2013, 01:27:33 pm
I opened this Thread for Script Questions in NW and Mount and Blade. Ask for help or share your scripts here.

Greets Saxinger :)
Title: Re: *Scripting Thread*
Post by: BSM 'Shut up' Williams on August 10, 2013, 01:30:37 pm
How would someone add weapons to a different class?
Title: Re: *Scripting Thread*
Post by: Saxinger on August 10, 2013, 01:32:40 pm
Hm you mean that the troops spawn with modifiyed weapons? Well you can write a Event in the module_scripts and define the weapons the different troops should spawn with, or you edit the module troops, but then everybody who has to spawn with this added weapons, need your module system :)
Title: Re: *Scripting Thread*
Post by: Gurkha on August 10, 2013, 01:35:36 pm
Can anyone tell me how to get the script where if a unauthorised user logs into a server with the admin pass, the server will automatically ban them. I heard that the Groupfighting server has this script installed for their I server and wanted to know how to get it.
Title: Re: *Scripting Thread*
Post by: Saxinger on August 10, 2013, 01:44:11 pm
Hm.what do ya mean with unautorised? Old admins who aren't allowed to be admin anymore? Or general people who got the admin pass from a friend, but they aren't admin?
Title: Re: *Scripting Thread*
Post by: Gurkha on August 10, 2013, 01:53:53 pm
When someone random logs on to the server with the admin pass.
Title: Re: *Scripting Thread*
Post by: Saxinger on August 10, 2013, 01:57:47 pm
Hm I don't know where to get a script which do this.  I would write a script which checks the ID of the players who join as a Admin and if the Master Admin didn't marked their ID's as autorised they will be autobanned by the server. First you need to know the ID's of your admins but a Script which gives you their ID's isn't really difficult to write :D Could do this ;)
Title: Re: *Scripting Thread*
Post by: Gurkha on August 10, 2013, 02:02:30 pm
That's what I meant. ID of admins can just be checked via the server logs.
Title: Re: *Scripting Thread*
Post by: Saxinger on August 10, 2013, 02:14:46 pm
It's not difficult to write a script which stores the ID of a player and show it to a admin. I added in my NW Admin Mod a function with a script of me. You use it like when you want to slay a agent. But in this case it shows you the ID of the player. If anyboy want to have this scripts I would share them :)
Title: Re: *Scripting Thread*
Post by: El_Presidente on August 10, 2013, 03:13:13 pm
He means the system the 91st has on groupfight, if you know that.

Interesting to know how one installs these server plugins...
Title: Re: *Scripting Thread*
Post by: 32nd_Rct_Schinider on August 10, 2013, 03:46:59 pm
I wantted to make a Autofire script so how does one make an autofire script :)
Title: Re: *Scripting Thread*
Post by: DanyEle on August 10, 2013, 07:04:53 pm
I'd suggest that you look into my BF2's open source code. We got one perfectly working and i know a few other mods are using it. You can download it from this page

http://forums.taleworlds.com/index.php/topic,257974.0.html
Title: Re: *Scripting Thread*
Post by: 32nd_Rct_Schinider on August 10, 2013, 07:50:15 pm
How do i use this?
Title: Re: *Scripting Thread*
Post by: jamiecross on August 10, 2013, 08:01:19 pm
If I post on this thread then it will get bumped.
End
Title: Re: *Scripting Thread*
Post by: 32nd_Rct_Schinider on August 10, 2013, 08:32:31 pm
Well? Anyone?
Title: Re: *Scripting Thread*
Post by: Momcilo on August 10, 2013, 08:41:01 pm
Would it be possible to script serverside that once the round begins in Team Deathmatch:

1. Everyone gets placed in one team, and 5 players are randomly chosen to be in the 2nd team.
2. Once someone from the 2nd team kills someone from the 1st team, the ones killed are automatically switched to a specific class in 2nd team.
Title: Re: *Scripting Thread*
Post by: Saxinger on August 11, 2013, 10:25:01 am
Would it be possible to script serverside that once the round begins in Team Deathmatch:

1. Everyone gets placed in one team, and 5 players are randomly chosen to be in the 2nd team.
2. Once someone from the 2nd team kills someone from the 1st team, the ones killed are automatically switched to a specific class in 2nd team.

So you want that in the next spawn, the killed player plays in the second team? Well if you mean this, then it should be possible...
Title: Re: *Scripting Thread*
Post by: Saxinger on August 11, 2013, 10:26:04 am
He means the system the 91st has on groupfight, if you know that.

Interesting to know how one installs these server plugins...

I don't really know what you mean... could you please explain it to me?
Title: Re: *Scripting Thread*
Post by: Gurkha on August 11, 2013, 10:55:57 am
Basically the owner of the server manually adds the ID's of the server admins to the script, if anyone who's ID hasn't been added to the server that logs into the server with the admin pass will automatically get banned from the server.

It's a nice system that prevents people form getting the admin pass from untrustworthy admins, it's currently used on the groupfighting server.
Title: Re: *Scripting Thread*
Post by: Saxinger on August 11, 2013, 11:03:46 am
Hm ok... I think I could write a Script like this if you don't find it..
Title: Re: *Scripting Thread*
Post by: Momcilo on August 11, 2013, 11:47:48 am
Would it be possible to script serverside that once the round begins in Team Deathmatch:

1. Everyone gets placed in one team, and 5 players are randomly chosen to be in the 2nd team.
2. Once someone from the 2nd team kills someone from the 1st team, the ones killed are automatically switched to a specific class in 2nd team.

So you want that in the next spawn, the killed player plays in the second team? Well if you mean this, then it should be possible...


Yes man, but not only just that, he needs to be moved to a specific class after he gets killed by one of the 5 randomly chosen players at the start. This is to be used for a zombie mod. So if you can direct me to anyone who could do this job, I would appreciate it.

Basically, 3 things need to be done server side:

1. Server moves everyone to team 1 and automatically chooses 5 random players to go to a specific class in team 2.

2. If anyone from team 2 kills anyone from team 1, the person killed gets moved to a specific class in team 2.

3. When everyone from team 1 gets transferred to team 2, the game restarts.

We have a server that would be used for this, now we need a scripter to do it serverside.
Title: Re: *Scripting Thread*
Post by: Saxinger on August 11, 2013, 11:58:28 am
You need also to delete the autobalance system then... I think it's not very difficult to do this if you got some knowledge. There should be some scripters who can do this... when i got time i'll have a look :)
Title: Re: *Scripting Thread*
Post by: Momcilo on August 11, 2013, 12:12:20 pm
You need also to delete the autobalance system then... I think it's not very difficult to do this if you got some knowledge. There should be some scripters who can do this... when i got time i'll have a look :)

Thank you man, the reason I posted here is that I wanted to find out if it is possible or not. I have no scripting knowledge, and if you do have a look at it in the near future please let me know via PM, again thank you :D
Title: Re: *Scripting Thread*
Post by: Saxinger on August 11, 2013, 12:13:14 pm
No problem mate ;) I'll contact ya ;)
Title: Re: *Scripting Thread*
Post by: Gurkha on August 11, 2013, 12:49:56 pm
Hm ok... I think I could write a Script like this if you don't find it..

Yes please :)
Title: Re: *Scripting Thread*
Post by: Saxinger on August 11, 2013, 12:57:07 pm
Ok I am at Mallorca for 3 Weeks noe, after this I'll have a look ;)
Title: Re: *Scripting Thread*
Post by: LeBrun on August 11, 2013, 01:35:01 pm
Hi

It's been few day's that i work to import auto firing script on a Napolenic Module System , i've found the module syste of BF2 who present script of auto firing weapons on Warband but i don't know what take and what is usefull for make it work on NW system.

So i call for help and someone who knows better how to make that.
Title: Re: *Scripting Thread*
Post by: Saxinger on August 11, 2013, 05:55:15 pm
Hm...post the code where u think it could be usefull ;)
Title: Re: *Scripting Thread*
Post by: DanyEle on August 12, 2013, 12:37:46 am
Hi

It's been few day's that i work to import auto firing script on a Napolenic Module System , i've found the module syste of BF2 who present script of auto firing weapons on Warband but i don't know what take and what is usefull for make it work on NW system.

So i call for help and someone who knows better how to make that.

Suggestion: try to do that yourself and use your knowledge. Read guides on the TW forum, dom't try to have other people to make what you'd like to achieve. Else, you won't learn anything.I'm the one who released that code and i'm talking from experience.
Title: Re: *Scripting Thread*
Post by: Saxinger on August 12, 2013, 11:00:24 am
Hi

It's been few day's that i work to import auto firing script on a Napolenic Module System , i've found the module syste of BF2 who present script of auto firing weapons on Warband but i don't know what take and what is usefull for make it work on NW system.

So i call for help and someone who knows better how to make that.

Suggestion: try to do that yourself and use your knowledge. Read guides on the TW forum, dom't try to have other people to make what you'd like to achieve. Else, you won't learn anything.I'm the one who released that code and i'm talking from experience.

Of course he shpuld learn it on his own. But he can post the code, he tjink which is usefull and we help him. I don't think that somebody want to make this for him :D
Title: Re: *Scripting Thread*
Post by: Harybo on August 13, 2013, 01:22:15 pm
Hi im sort of a noob to coding and scripting so i just have a question. I know that coding in terms of NW means changing unit and faction names etc., and am guessing that scripting more has to do with making certain specific events happen, but  what are more specifically the main differences between coding and scripting?
Title: Re: *Scripting Thread*
Post by: BSM 'Shut up' Williams on August 13, 2013, 06:51:00 pm
Hi im sort of a noob to coding and scripting so i just have a question. I know that coding in terms of NW means changing unit and faction names etc., and am guessing that scripting more has to do with making certain specific events happen, but  what are more specifically the main differences between coding and scripting?

To me they're the same.
Title: Re: *Scripting Thread*
Post by: Saxinger on August 13, 2013, 08:01:27 pm
Hi im sort of a noob to coding and scripting so i just have a question. I know that coding in terms of NW means changing unit and faction names etc., and am guessing that scripting more has to do with making certain specific events happen, but  what are more specifically the main differences between coding and scripting?

To me they're the same.

+1
Title: Re: *Scripting Thread*
Post by: Gokiller on August 13, 2013, 08:36:09 pm
They are basicly the same. However, (to me atleast) to be more exact.

Scripting is creating features from scratch, (random example: implenting a testudo formation for a Roman mod). Coding, implenting items, and the rest.

This is the way I see it, I could be wrong but that shouldn't really matter.
Title: Re: *Scripting Thread*
Post by: Harybo on August 14, 2013, 12:11:29 pm
oh ok i see then i guess it was less complicated than i thought
thanks
Title: Re: *Scripting Thread*
Post by: DanyEle on August 15, 2013, 10:29:38 pm
They are basicly the same. However, (to me atleast) to be more exact.

Scripting is creating features from scratch, (random example: implenting a testudo formation for a Roman mod). Coding, implenting items, and the rest.

This is the way I see it, I could be wrong but that shouldn't really matter.

Yeah, for example something i just did was creating a sniper rifle system for NW. I think that's scripting. Coding means modifying existing parameters, adding a few tweaks, fixing bugs and so on.... Ah, saying scripting makes you have more swag  8)
Title: Re: *Scripting Thread*
Post by: El_Presidente on August 18, 2013, 02:47:17 pm
Would it be possible to write a script that could actively disable units in the game, for the AI ? So say once a certain condition was met, on the next round the AI could only spawn as foot guards vs normal line infantry in the previous round?

Here is a kind of broken, not realistic pseudo-code that might give you an idea more of what I'm talking about:

Spoiler
Code
TotalRounds = int(TotalRounds) #The actual thing will be an intiger already, but oh well  :P.

if TotalRounds is between 0 and 2:
     AISpawnAsLineInfantry = True
     AISpawnAsFootGuard = False

if TotalRounds is between 3 and 5:
     AISpawnAsLineInfantry = False
     AISpawnAsFootGuard = True
[close]

I know all the variable names are wrong etc, and it's probably full of syntax errors but it's meant to be a rough example! I'm trying to rewrite the code for siege into an invasion-styled script and this is the most practical method I can devise. The only reason I, personally, can only see it wouldn't work is that actively updating what the AI can play as is impossible/would have to be a heavy modification - but I don't know. I've never tried modding before, I'm used to writing my own programs in python from scratch and this is awfully alien to me  ;).

Why can't the game just use simple Boolean values like I do?
Title: Re: *Scripting Thread*
Post by: SeanBeansShako on August 18, 2013, 06:34:24 pm
I have an interesting suggestion what about a script for client side that replaces the regimental standard with the image of your regiments chosen banner instead?

And a 2nd suggestion, a script that gives the banner a green halo around the edges if they pick an officer class?
Title: Re: *Scripting Thread*
Post by: Brawn on August 22, 2013, 09:15:58 pm
I have a scripting question, ehem, will you be my mod's scripter? O.o

Jking of course, but I do have a question.

How do do you give a class that would normally spaw with one gun, spawn with another?
Ex.) Russian jaegers can spawn with a rifle and a cavalry musket, dependent on which one is chosen.
Title: Re: *Scripting Thread*
Post by: DanyEle on August 25, 2013, 03:04:35 pm
Just assign that weapon to that troop.
Title: Re: *Scripting Thread*
Post by: Richard_Miller on August 28, 2013, 05:00:39 pm
i was told there was a way to make items like spy glasses useable in the map could i have some help pls  :-\
Title: Re: *Scripting Thread*
Post by: BSM 'Shut up' Williams on August 28, 2013, 05:03:47 pm
You right click with the spy-glass and Eureka it's usable.  ;)
Title: Re: *Scripting Thread*
Post by: Richard_Miller on August 28, 2013, 05:36:16 pm
You right click with the spy-glass and Eureka it's usable.  ;)

*face palm*
Title: Re: *Scripting Thread*
Post by: Brawn on August 28, 2013, 09:02:11 pm
You right click with the spy-glass and Eureka it's usable.  ;)

-1
Title: Re: *Scripting Thread*
Post by: DanyEle on September 07, 2013, 01:20:54 am
Scrpting question: how can I make a deployed item(which uses the same system of the rocket launcher) disappear once i click the reset button? Where do i need to get its instance and then clean it up? (I think this has to do with the script clean_up_prop_instance, but i have no idea where to apply it).
Title: Re: *Scripting Thread*
Post by: DanyEle on September 07, 2013, 09:29:06 pm
Found by myself.

Beneath #reset ze treasure just add this piece of the code for the prop you placed you'd like to remove.
  #reset ammo crates
      
Code
(scene_prop_get_num_instances, ":num_instances_of_scene_prop", "spr_ammobox"),
   (try_for_range, ":cur_instance", 0, ":num_instances_of_scene_prop"),
(scene_prop_get_instance, ":cur_instance_id", "spr_ammobox", ":cur_instance"),
(scene_prop_slot_eq, ":cur_instance_id", scene_prop_slot_is_spawned,1),
# (call_script, "script_clean_up_prop_instance", ":cur_instance_id"),
(call_script, "script_clean_up_prop_instance_with_childs", ":cur_instance_id"),
  (try_end),
Title: Re: *Scripting Thread*
Post by: Brawn on November 29, 2013, 03:16:14 am
I downloaded the source code from NW's Moddb page. When I open the "build_module.bat" I can't find where to place the path for my mod, any help?
Title: Re: *Scripting Thread*
Post by: Gokiller on November 29, 2013, 09:15:04 am
module_info.py
Title: Re: *Scripting Thread*
Post by: Brawn on November 29, 2013, 09:27:09 pm
module_info.py

Ahhh thats right! Thanks mate, feel ridiculous now.
Title: Re: *Scripting Thread*
Post by: Brawn on December 01, 2013, 08:17:18 pm
Does anyone know where the sailor clothing items are? I can't find them in "module_items.py"
Title: Re: *Scripting Thread*
Post by: Gokiller on December 01, 2013, 09:00:24 pm
Just look for their name in the BRF and use the name that is being used in there in the search function on the module_items.py
Title: Re: *Scripting Thread*
Post by: Brawn on December 04, 2013, 04:52:42 am
I just figured that it wasn't implemented and I added it. But another problem, I'm adding custom meshes to a faction in "module_items.py" and it is textured in Brf, but not in the game.
Title: Re: *Scripting Thread*
Post by: Brawn on November 26, 2014, 05:58:56 am
bump, still having trouble with the question above almost a year later
Title: Re: *Scripting Thread*
Post by: Brawn on November 26, 2014, 06:09:13 am
Oh also I try to add an item in the source code under, "Module_Items," and it just seems to never work so I assume I'm doing something wrong there.
Title: Re: *Scripting Thread*
Post by: Mercuri on November 26, 2014, 09:59:26 am
I just figured that it wasn't implemented and I added it. But another problem, I'm adding custom meshes to a faction in "module_items.py" and it is textured in Brf, but not in the game.

When you create a new object and add it to game you must edit 3 BRFs in order to it be textured ingame.

Example. You want to create a new uniform in the French Faction. You must edit:
1. mm_french_uniforms.brf (here you import the .smd object)
2. mmmaterials.brf (here you create the material that you assigned to the imported items and for that material you must to assign the textures with the same name that you used to save the .dds in the Texture folder)
3. mmtextures.brf (here you must to create the textures that you assigned to the material with the same name that you used to save the .dds in the Texture folder)

Oh also I try to add an item in the source code under, "Module_Items," and it just seems to never work so I assume I'm doing something wrong there.

Go to module_items.py, search the item that you want your newitem was based, copy it and paste it just later, change the name of the new item and the name of the mesh (name you used in the .brf) of that item.

I think that's your problem.
Cheers.


Title: Re: *Scripting Thread*
Post by: Brawn on November 26, 2014, 07:02:51 pm
Thanks man, will try it when I reach my comp!
Title: Re: *Scripting Thread*
Post by: Victorcin on November 27, 2014, 09:03:06 am
I have three questions:

1) How can I hide faction in the game?I have been searching and I didn´t found anything that is effective.


2) Can you spawn one prop in a scene?. Example, the character is in a certain place on the map and want to invoke a cannon and appears.

3) It is possible spawn civilians in a scene, or guards at a particular scene (like the citizens of the cities of the native)

Thanks,
Cheers.  :)
Title: Re: *Scripting Thread*
Post by: Grozni on December 01, 2014, 01:43:56 pm
I have three questions:

1) How can I hide faction in the game?I have been searching and I didn´t found anything that is effective.


2) Can you spawn one prop in a scene?. Example, the character is in a certain place on the map and want to invoke a cannon and appears.

3) It is possible spawn civilians in a scene, or guards at a particular scene (like the citizens of the cities of the native)

Thanks,
Cheers.  :)


1) here, https://www.fsegames.eu/forum/index.php?topic=20171.0

2) yes you can, dig through NW module system source for ways to spawn props.
And yes, you can trigger scripts when character is in a certain place, one possible way would be to create new invisible scene prop (for example lets call it "trigger_cannon_spawn"), place it where you want on map,
then write trigger in module_mission_templates which will fire each second or something like that, checks if there are any "trigger_cannon_spawn" props in the scene, and for each found iterate through all agents (characters) in the scene and compare positions between trigger scene prop and agent to find out if the two are near enough to make something happen.
I'm too busy atm to write code for you, but if you're serious about modding then you'll get enough info from code already written by others.

3) yes its possible, for examples of spawning visitors to the scene I think it would be best to check out the native module system source rather than NW.
Title: Re: *Scripting Thread*
Post by: DanyEle on December 09, 2014, 07:27:13 pm
I have three questions:

1) How can I hide faction in the game?I have been searching and I didn´t found anything that is effective.


2) Can you spawn one prop in a scene?. Example, the character is in a certain place on the map and want to invoke a cannon and appears.

3) It is possible spawn civilians in a scene, or guards at a particular scene (like the citizens of the cities of the native)

Thanks,
Cheers.  :)


1) I described the best procedure you should follow in NW in this very topic https://www.fsegames.eu/forum/index.php?topic=20171.msg872073#msg872073

2) Absolutely! Let's take your example: spawn a cannon on a player that has pressed a certain button. First of all, bear in mind that spawning stuff MUST be always done serverside, so whatever you're going to do, do it on a server-side trigger (multiplayer_is_server), = your keyword to find or add serverside stuff, or inside server event. Afterwards, you are going to need to call the following commands. Let's assume it's a trigger and you know which agent you're dealing with:

Code
(agent_is_active, ":agent_id"),
(agent_is_alive, ":agent_id"),

(agent_get_position, pos1, ":agent_id"),
(set_spawn_position, pos1),
(spawn_scene_prop, "spr_scene_prop_name"),

That's really all you need. You can modify the position, rotate the prop, put it in a loop, etc... But I dont want to ruin all the fun that comes with modding and coding  ;) Feel free to ask any questions that come to your mind though. You can also spawn items instead of scene props. In this case, all you need to do is use the following code:

Code
(agent_is_active, ":agent_id"),
(agent_is_alive, ":agent_id"),

(agent_get_position, pos1, ":agent_id"),
(set_spawn_position, pos1),
(spawn_item, "itm_rockets", 0, 300), #300 seconds(5 minutes) is the time after that the items gets despawned if it remains on the ground

3) Yes, you could look into commands like spawn_agent or spawn_horse , but i cannot really say how or if they work in NW as I never used them before. You might want to ask to the creators of the Anglo-Zulu war and ask them how they implemented swarms of bots. For citizens, not sure if that's really possible since we're in a multiplayer game and bots are usually hostile. You might have to use some AI paths or script some AI behaviour yourself if you want them to perform certain actions. Still, there could be some good guides on the TW forum that could really help you. For instance, I just went onto the Mod Development section and found this awesome tool http://forums.taleworlds.com/index.php/topic,317313.0.html
Title: Re: *Scripting Thread*
Post by: MaxLam on December 16, 2014, 07:47:03 pm
Is it possible to have the game regenerate HPs when a player uses a prop such as a gate?
Title: Re: *Scripting Thread*
Post by: DanyEle on December 16, 2014, 08:52:45 pm
Of course.
Title: Re: *Scripting Thread*
Post by: William on January 01, 2015, 06:49:09 pm
Nvm
Title: Re: *Scripting Thread*
Post by: Portals on February 22, 2015, 06:01:33 am
Hey, I was working on a mod with a few of my friends, and we are looking to make it multiplayer. Only problem is that we have around 12 factions, and we were wondering if there was either a way to make it so that the extra factions are deleted in multiplayer (Without effecting the single player) or to make it so that when a server autoswitches it does not select the nations that we are not going to be using for multiplayer. I was wondering if its possible to do this?

Also, is it possible to add more factions to multiplayer?
Title: Re: *Scripting Thread*
Post by: lindblom on February 22, 2015, 02:32:46 pm
Hey, I was working on a mod with a few of my friends, and we are looking to make it multiplayer. Only problem is that we have around 12 factions, and we were wondering if there was either a way to make it so that the extra factions are deleted in multiplayer (Without effecting the single player) or to make it so that when a server autoswitches it does not select the nations that we are not going to be using for multiplayer. I was wondering if its possible to do this?

Also, is it possible to add more factions to multiplayer?

I would recommend you to read this guide (http://forums.taleworlds.com/index.php?topic=116286.0)

Best of luck with your module!
Title: Re: *Scripting Thread*
Post by: Portals on February 22, 2015, 09:22:15 pm
Hey, I was working on a mod with a few of my friends, and we are looking to make it multiplayer. Only problem is that we have around 12 factions, and we were wondering if there was either a way to make it so that the extra factions are deleted in multiplayer (Without effecting the single player) or to make it so that when a server autoswitches it does not select the nations that we are not going to be using for multiplayer. I was wondering if its possible to do this?

Also, is it possible to add more factions to multiplayer?

I would recommend you to read this guide (http://forums.taleworlds.com/index.php?topic=116286.0)

Best of luck with your module!

Never mind, found it!
Title: Re: *Scripting Thread*
Post by: KL4R1N0G4MPR0S on February 22, 2015, 09:31:58 pm
Hi,

A couple of my regiment's members were thinking of making a fun mini-mod for theb reg to play after events, with small changes to skins, weapon attributes, etc.
I made a couple of Conquest maps with an AI Mesh for this, but I was know wondering how and if you could only choose a specific troop class from each nation to spawn when you increased the bot count. Currently, as you know, bots spawned in will be of a random class, from both inf, cav, and special troop classes.

My question is whether there is a script for this (I'm thinking of something similar to the 15th's HvB server), so that we can choose which troop classes bots have for PvE.

Thanks
Title: Re: *Scripting Thread*
Post by: MaxLam on February 28, 2015, 07:15:52 pm
I think I saw some scripts to display information messages but I can't remember where. If someone could help me that would be nice, I need those for Commander_Battle.
Title: Re: *Scripting Thread*
Post by: lindblom on March 10, 2015, 03:46:32 pm
I think I saw some scripts to display information messages but I can't remember where. If someone could help me that would be nice, I need those for Commander_Battle.

module_scripts.py
Code
			 (multiplayer_send_string_to_player, ":player_no", multiplayer_event_show_server_message, "str_intro_msg"),

module_strings.py
Code
("intro_msg","This is an example message that will be displayed to the player when joining the server!"),

Hope this was of any help to you :)

Title: Re: *Scripting Thread*
Post by: MaxLam on March 12, 2015, 01:02:05 pm
Exactly this, thank you.  :-*
Title: Re: *Scripting Thread*
Post by: Mercuri on March 19, 2015, 03:40:07 pm
Hi, I removed the  "itp_cant_reload_while_moving" on the muskets in module_items.py and now you can reload while moving (obviously xD) But you run while reloading!!! and I want that you walk like when you reload a pistol. How can i do it?
Title: Re: *Scripting Thread*
Post by: usnavy30 on March 19, 2015, 04:28:49 pm
Hi, I removed the  "itp_cant_reload_while_moving" on the muskets in module_items.py and now you can reload while moving (obviously xD) But you run while reloading!!! and I want that you walk like when you reload a pistol. How can i do it?

Try adding itcf_reload_pistol item flag to the musket as a test.
Code
itp_type_pistol|itp_merchandise|itp_primary|itp_cant_reload_while_moving_mounted ,itcf_shoot_pistol|itcf_reload_pistol|itcf_carry_pistol_front_left
Title: Re: *Scripting Thread*
Post by: Mercuri on March 19, 2015, 08:48:56 pm
Hi, I removed the  "itp_cant_reload_while_moving" on the muskets in module_items.py and now you can reload while moving (obviously xD) But you run while reloading!!! and I want that you walk like when you reload a pistol. How can i do it?

Try adding itcf_reload_pistol item flag to the musket as a test.
Code
itp_type_pistol|itp_merchandise|itp_primary|itp_cant_reload_while_moving_mounted ,itcf_shoot_pistol|itcf_reload_pistol|itcf_carry_pistol_front_left

Doesn´t works, just get the pistol animation on the musket :S
Title: Re: *Scripting Thread*
Post by: usnavy30 on March 19, 2015, 08:50:20 pm
Is it only the pistol animation though? Or the slow walking while reloading as well?
Else I wouldn't know I just try to help  :-X
Title: Re: *Scripting Thread*
Post by: Mercuri on March 19, 2015, 09:53:38 pm
just the animation, thx for answer
Title: Re: *Scripting Thread*
Post by: Mercuri on April 12, 2015, 04:20:32 pm
Hi, I removed the  "itp_cant_reload_while_moving" on the muskets in module_items.py and now you can reload while moving (obviously xD) But you run while reloading!!! and I want that you walk like when you reload a pistol. How can i do it?

Plssssss help me  :'(
Title: Re: *Scripting Thread*
Post by: hunter491 on April 15, 2015, 08:37:28 pm
I think I saw some scripts to display information messages but I can't remember where. If someone could help me that would be nice, I need those for Commander_Battle.

module_scripts.py
Code
			 (multiplayer_send_string_to_player, ":player_no", multiplayer_event_show_server_message, "str_intro_msg"),

module_strings.py
Code
("intro_msg","This is an example message that will be displayed to the player when joining the server!"),

Hope this was of any help to you :)

Hey sorry im puzzled where should i place the message i wanna convey to player and how many strings i can make?
Title: Re: *Scripting Thread*
Post by: cedric1709 on April 27, 2015, 11:47:21 pm
Hi,

A couple of my regiment's members were thinking of making a fun mini-mod for theb reg to play after events, with small changes to skins, weapon attributes, etc.
I made a couple of Conquest maps with an AI Mesh for this, but I was know wondering how and if you could only choose a specific troop class from each nation to spawn when you increased the bot count. Currently, as you know, bots spawned in will be of a random class, from both inf, cav, and special troop classes.

My question is whether there is a script for this (I'm thinking of something similar to the 15th's HvB server), so that we can choose which troop classes bots have for PvE.

Thanks

Been trying to figure this out for some time now aswell, would anyone like to help out with this? Because it's really hard to find in the server source code
Title: Re: *Scripting Thread*
Post by: NickyJ on May 04, 2015, 11:50:09 pm
Question: I've heard of server mods being able to make people spawn with different weapons, for example a spontoon instead of a flag or sword for color bearers. With that in mind, is it technically possible to completely remake a class with just a server-side script? Like change French sailors into a skirmisher class, with a normal uniform and rifles instead of random weapons. Making a different module might be more effective, but I was thinking of something that could be geared towards hosting linebattles with it so that people don't have to download a different module just for that one battle. I know next to nothing about scripting, so this question is pretty much just a shot in the dark. :-\
Title: Re: *Scripting Thread*
Post by: Commissar Jdf on May 09, 2015, 05:25:19 am
Hi guys!

I've seen a lot of servers nowadays that have custom messages appear saying things like "<regiment name> is recruiting," or more commonly on Native things like "Welcome to our server <player name>." The first shows up on the top-middle-most part of the screen in pink-bold text, much like the admin chat, and the latter appears down at the bottom left in small reddish-pink text.

My question is how would I do both of these? I know it would go in module_scripts.py.

Thanks bunches.


I FIGURED OUT HOW TO DO THIS MYSELF :)
Title: Re: *Scripting Thread*
Post by: Commissar Jdf on May 12, 2015, 07:09:25 pm
Now that I know how to make a basic message appear when someone joins the server, how exactly would you make a timed admin message appear (i.e every 10 minutes "Don't forget to add this server to your favorites!" appears.)?

Starting extremely simply, maybe I could try this in module_scripts.py?
Code
(multiplayer_send_string to player, ":player_no", multiplayer_event_send_admin_chat, "str_admin_msg"),
Title: Re: *Scripting Thread*
Post by: Gurkha on August 29, 2015, 03:52:46 pm
Is it possible to merge conquest and siege into one game mode?
Title: Re: *Scripting Thread*
Post by: Gokiller on September 01, 2015, 03:46:49 pm
Now that I know how to make a basic message appear when someone joins the server, how exactly would you make a timed admin message appear (i.e every 10 minutes "Don't forget to add this server to your favorites!" appears.)?

Starting extremely simply, maybe I could try this in module_scripts.py?
Code
(multiplayer_send_string to player, ":player_no", multiplayer_event_send_admin_chat, "str_admin_msg"),
Taken from Saxingers OSP scripts. Haven't tried it myself, but I guess it should work.

Quote from: mission_template
automatic_server_announcement = (
    1, 0, 0, [(multiplayer_is_server),],
   [                 
                  (val_add,"$counter",1),
            (try_begin),
                  (eq, "$counter", 300),
                  (store_random_in_range,":message",1,1),
            (try_begin),
                  (eq,":message",1),
                  (str_store_string, s0, "str_server_message_1"),
            (try_end),
                  (call_script, "script_cf_server_message_syn"),
                  (assign, "$counter", 0),
    (try_end),
  ])

Quote from: Strings
("server_message_1", "Type you first Serveranouncement"),

For the time just adjust this bit:
Quote
(eq, "$counter", 300), 
300 = 5 mins, so in your case 10 mins would be 600.
Title: Re: *Scripting Thread*
Post by: hunter491 on September 16, 2015, 03:37:53 pm
Hey I ve read all posts in this thread and still cant work out how to make  msg when a player shows up at the server?
Could anyone be so kind and help me out, step by step?
Thanks a million.
Title: Re: *Scripting Thread*
Post by: hunter491 on September 19, 2015, 10:37:53 am
Anyone?
Title: Re: *Scripting Thread*
Post by: hunter491 on September 22, 2015, 09:23:39 pm
lol guys, pls just a little help -.-
Title: Re: *Scripting Thread*
Post by: Ted on September 23, 2015, 06:46:11 am
lol guys, pls just a little help -.-

Nope
Title: Re: *Scripting Thread*
Post by: Lilja Mariasdóttir on September 24, 2015, 08:15:26 pm
For the message for joining players, this might help you: https://www.fsegames.eu/forum/index.php?topic=26609.0

Nope
Dear annoying troll, if you dont have anything to contribute to a theme, or thread, how about not posting nonsense? (meant to all your trolls and spams, not only here)
Title: Re: *Scripting Thread*
Post by: hunter491 on September 24, 2015, 09:30:01 pm
Oh that its so educative and helpful, thanks a million :)
Title: Re: *Scripting Thread*
Post by: Siwi on December 08, 2015, 12:13:43 am
Would a script that allowed someone to poll to move to the next map in rotation be possible? I feel like it would, but I'm not sure
Title: Re: *Scripting Thread*
Post by: Clashinnit on January 17, 2016, 11:49:51 pm
Hi!

My regiment has recently got it's own server and I was thinking about ways to help with training. I was hoping someone could help me with how to create a script to force one team to be only one regiment selection.

I basically want it so that I can have players on Team 1 and bots on Team 2 which can be forced to all be Partisans for general practice or cavalry for anti-cavalry practice.

Any help would be great, I have no experience with scripting!

Cheers

Clash
Title: Re: *Scripting Thread*
Post by: Grozni on January 18, 2016, 01:46:34 am
Hi!

My regiment has recently got it's own server and I was thinking about ways to help with training. I was hoping someone could help me with how to create a script to force one team to be only one regiment selection.

I basically want it so that I can have players on Team 1 and bots on Team 2 which can be forced to all be Partisans for general practice or cavalry for anti-cavalry practice.

Any help would be great, I have no experience with scripting!

Cheers

Clash

Both things can be done and are light/medium weight in difficulty, but if you want to script them yourself, since you mention you have no experience in scripting, you have to start with basic M&B modding tutorials, as in how to setup module system and compile it into game files, so you have something to work on.
https://www.fsegames.eu/forum/index.php?topic=3481.0
https://www.fsegames.eu/forum/index.php?topic=11836.0
Since you want to make server-side modification it gets a bit complicated, for testing purposes it is best to have local test server, ie a dedicated server running on your PC in which you will overwrite Modules/Napoleonic Wars/ .txt files with the ones you compiled, while using unmodified game version as client (client=your game that logs on to server) so you can test if server is compatible with standard NW client and acting as it should.
Title: Re: *Scripting Thread*
Post by: Clashinnit on January 18, 2016, 09:20:58 pm
Thanks for the reply!

Is there any way to simply install these scripts without going through the process of writing the scripts yourself? I've never really modded any games before.
Title: Re: *Scripting Thread*
Post by: tired on April 09, 2016, 04:32:42 am
Is there a way when you spawn bots, that you limit their classes? I want to limit spawned bits on a couple of maps to just infantry only. I think a couple of bot servers can already limit bots to infantry only.  I would be grateful for any help

Sent from my SM-G900V using Tapatalk

Title: Re: *Scripting Thread*
Post by: Pio on April 09, 2016, 10:09:38 pm
One way would be to edit module_items.py and remove horses from cav troops equipment. It wouldn't really disable cav, but bots would spawn without horses.
Title: Re: *Scripting Thread*
Post by: tired on April 10, 2016, 04:01:00 pm
Is there a way to associate a specific py file with a specific map? Or what about having only infantry bots spawn and only melee charge instead of use weapons at will

Sent from my SM-G900V using Tapatalk

Title: Re: *Scripting Thread*
Post by: Grozni on April 10, 2016, 04:34:56 pm
Is there a way to associate a specific py file with a specific map?

This would work in module_scripts and module_mission_templates
Code
(store_current_scene, ":cur_scene"),
        (try_begin),
        (eq, ":cur_scene", "scn_mp_custom_map_1"), #is it custom map 1
            #your lines of code here:
            #-do something-
        (try_end), #map 1 block end


Or what about having only infantry bots spawn and only melee charge instead of use weapons at will

Possible but not as simple as commenting out some bots from module_troops, as there are many checks throughout the rest of the code which depend on these troops being defined, you must either alter these checks (I'd expect a lot of work if you're commenting out all cav bots) or think of something else. I don't think a novice can implement previous solution without causing some horrible and impossible to track bugs. Agent_spawned_common script in scripts.py is a good place to manipulate the equipment of each agent just before it gets spawned, just make sure you are adding code to the block which applies to server side of things. You would have to add checks if agents is a bot, not a horse, and is a cav class, and then do stuff with it's equipment like remove mount and change clothes and weapons. For an example of equipment altering code you can look for treasure chest code, the one which swaps your hat with pirate hat.

As for melee charge there is a simple hack, just remove their ammo from their equipment in module_troops and they will never use ranged mode as bots never fire the one bullet they have. Or remove the ammo in that common spawn script, that solution would require less work and would give you control to decide under which conditions the script will activate, as maybe you want to have normal shooting bots for some other uses on the same server.
Title: Re: *Scripting Thread*
Post by: tired on April 10, 2016, 05:07:40 pm
Is there a way to associate a specific py file with a specific map?

This would work in module_scripts and module_mission_templates
Code
(store_current_scene, ":cur_scene"),
        (try_begin),
        (eq, ":cur_scene", "scn_mp_custom_map_1"), #is it custom map 1
            #your lines of code here:
            #-do something-
        (try_end), #map 1 block end


Or what about having only infantry bots spawn and only melee charge instead of use weapons at will

Possible but not as simple as commenting out some bots from module_troops, as there are many checks throughout the rest of the code which depend on these troops being defined, you must either alter these checks (I'd expect a lot of work if you're commenting out all cav bots) or think of something else. I don't think a novice can implement previous solution without causing some horrible and impossible to track bugs. Agent_spawned_common script in scripts.py is a good place to manipulate the equipment of each agent just before it gets spawned, just make sure you are adding code to the block which applies to server side of things. You would have to add checks if agents is a bot, not a horse, and is a cav class, and then do stuff with it's equipment like remove mount and change clothes and weapons. For an example of equipment altering code you can look for treasure chest code, the one which swaps your hat with pirate hat.

As for melee charge there is a simple hack, just remove their ammo from their equipment in module_troops and they will never use ranged mode as bots never fire the one bullet they have. Or remove the ammo in that common spawn script, that solution would require less work and would give you control to decide under which conditions the script will activate, as maybe you want to have normal shooting bots for some other uses on the same server.
Omg wow thanks, I'll play around with these

Sent from my SM-G900V using Tapatalk

Title: Re: *Scripting Thread*
Post by: tired on April 29, 2016, 10:35:48 pm
I've seen a server that sends a message on a server when an admin joins, like "Behave, an admin is here". Would there be a way to do the same thing but play a small sound file instead?

Sent from my SM-G900V using Tapatalk

Title: Re: *Scripting Thread*
Post by: Pio on April 30, 2016, 02:08:56 am
Yes, to do that use:
Code
(call_script,"script_multiplayer_server_play_sound_at_position",":sound_id"),
where sound_id is an id of one of the sounds that exists in the game. The script uses pos56 as a position where the sound will be played. You can only use sounds that already exist in the game.
Title: Re: *Scripting Thread*
Post by: TheDoctor on May 04, 2016, 04:48:35 am
Anyone got a script that would add Musicians / other things to commander battle in NaS.
Title: Re: *Scripting Thread*
Post by: Lilja Mariasdóttir on May 11, 2016, 03:55:15 pm
Anyone got a script that would add Musicians / other things to commander battle in NaS.
Is that even possible?
Title: Re: *Scripting Thread*
Post by: NickyJ on May 11, 2016, 05:27:46 pm
The EU_Commander_Battle server for NW does that, so it is possible. Not sure how, though.
Title: Re: *Scripting Thread*
Post by: Lilja Mariasdóttir on May 11, 2016, 05:34:14 pm
Wow, this must be a really unique server. Are those musicians even playing music, or just decoration?
Title: Re: *Scripting Thread*
Post by: NickyJ on May 11, 2016, 07:21:25 pm
They do play music, usually one or two per regiment. Color bearers are also spawned in. Whoever made it did a very good job.
Title: Re: *Scripting Thread*
Post by: Grozni on May 17, 2016, 01:47:17 am
Adding working musicians and flag bearer bots to NW commander battle server is not that hard, it is actually easy for a good modder, I did it for fun and it took me about four hours. The script uses proper musician and flag-bearer type for all units. Even for cavalry, though you may want to turn that off due to practical reasons. Also it does not interfere with other game types in any way, for example it does not alter typical equipment for bots, though if you host a serious CB server you shouldn't be concerned about that.

Anyone who wants this script, and can prove that he hosts a serious CB server, can send me a PM and we'll work something out. Unlike a certain modder, I will not insist on having my name written all over the server and spammed within announcements each couple minutes.

As for NaS, it is not possible unless developers implement it or make their module system public.
Title: Re: *Scripting Thread*
Post by: BlackNight on May 17, 2016, 09:08:54 am
I would like to give a tip to people that they experiment by them self with coding do what you want and see what goes wrong and on that detail fix it.
You cant succes eithout failing.
Title: Re: *Scripting Thread*
Post by: Thunderstormer on May 17, 2016, 02:55:31 pm
just started learning how to script a few days ago.(mainly for the challenge of learning something new)  managed to get an in game message everytime a map changes on my own.(only to the player)     currently i am working on getting a script to show when someone teamkills a horse.(would like to do teamwounding a person and a horse later but just this for now)

haven't had the most luck getting getting this to work.  I did manage to get the logs to show a player teamkilling a bot.(in the logs, normally it just shows up as a normal kill even though in game it shows up as a teamkill)

i know this is a horse. (neg|agent_is_human, ":dead_agent_no"),  and for the most part, i have been working in this script.  #script_multiplayer_server_on_agent_killed_or_wounded_common( i did make my own script for teamkilling a bot, which was similar to the regular teamkill script)

anyways, any tips as to where to start or what to do.   i would rather i do most of this myself rather than have someone else do it for me.   any help will be appreciated.
Title: Re: *Scripting Thread*
Post by: Grozni on May 17, 2016, 04:14:59 pm
Congrats on making steps to learn something new.

Anyway, your question is a bit blurry, as you don't want someone else to write the code for you, yet you ask for tips without specifying at which point you got stuck. In this situation it is best to post your code so we can tell which part of it is incorrect.
Title: Re: *Scripting Thread*
Post by: Pio on May 17, 2016, 05:25:57 pm
I agree. We can't really help you much without seeing the code.
Title: Re: *Scripting Thread*
Post by: BlackNight on May 17, 2016, 06:14:43 pm
Maybe you should make like trigger that shows who kills horse like when someone kills someone becuse game dosent have teams for horses they are neutral
Title: Re: *Scripting Thread*
Post by: Thunderstormer on May 18, 2016, 12:08:11 pm
Maybe you should make like trigger that shows who kills horse like when someone kills someone becuse game dosent have teams for horses they are neutral
i have heard they are agents, and i have read they are items, not agents.  i have been trying to treat them as agents and tie them to their riders team in different ways. i have done a lot of combos.  some of which were fruitless as i learned more about the code.

anyways, like i said above, i only just started learning about coding. so do forgive any noob mistakes.   idk if i am close or if i am completely off the mark as to what i am doing and where i am doing.

this is in script 54
Spoiler
      (assign,":agent_no",0),
    
      (try_begin),
         (eq, neg|agent_is_non_player, ":dead_agent_no"),
       (agent_get_player_id, ":dead_agent_player", ":dead_agent_no"),
         (neg|player_is_active, ":dead_agent_player"),
         (assign,":dead_agent_player",-1),
      (else_try),
       #(agent_get_player_id,":player_no",":agent_no"),
       (eq, agent_is_non_player, ":agent_no"),
      (agent_is_active,":agent_no"),
            
      (agent_get_horse, ":horse_agent", ":agent_no"),
      (agent_get_item_id, ":horse_agent", ":agent_no"),
          (try_begin),
            (le, ":horse_agent", 0),
      
          (assign,":horse_agent",":dead_agent_no"),
         (neg|agent_is_human, ":dead_agent_no"),
         (agent_is_active,":dead_agent_no"),
         
         (agent_get_team, ":agent_team",":agent_no"),
         (agent_set_team, ":dead_agent_no", ":agent_team"),
        (try_end),
       #(try_begin),
          #(neg|agent_is_human, ":dead_agent_no"),      
            #(agent_get_team, ":dead_agent_team",":dead_agent_no"),                     
       #(try_end),          
        (assign,":dead_agent_no",-1),
      (try_end),
[close]

Spoiler
       (try_begin), # Log teamkills if we have a player teamkilling a horse
           (eq,":kill_type",kill_type_team),
           (neg|agent_is_human, ":dead_agent_no"),
        (call_script,"script_multiplayer_server_on_player_teamkilled_horse", ":dead_agent_no", ":killer_agent_player", ":dead_agent_team"),   <<<<<<<<<<<<<<<<<i left the 3rd part there for now.   
         (try_end),
[close]




been spending most of my time with the first spoiler and not with the last one.  as most of the trouble i was having was in the first.    now i am not sure. 
Spoiler
    #script_multiplayer_server_on_player_teamkilled_player
  # INPUT: arg1 = dead_agent_player, arg2 = killer_agent_player, arg3 = dead_agent_team
  # OUTPUT: none
  ("multiplayer_server_on_player_teamkilled_horse",
   [
     (store_script_param, ":dead_agent_no", 1),
     (store_script_param, ":killer_agent_player", 2),
    (try_begin),
    (eq, neg|agent_is_human,":dead_agent_no"),
   # (server_add_message_to_log,"str_tutorial_info_1"),
    (try_end),
 
     (try_begin), # Log teamkills if we have a player teamkilling a player
       (neg|agent_is_human,":dead_agent_no"),
       (player_is_active,":killer_agent_player"),
       
       (str_store_player_username, s1, ":killer_agent_player"),
       (str_store_agent_name, s2, ":dead_agent_no"),

       (server_add_message_to_log,"str_teamkilled_s1_s2"),
      
     (try_end),
   ]),
   
[close]
i do get an error whenever i slay all or manually swap myself to spec(not using the admin panel)  haven't had time to figure that out. 

as for helping out.  there is a difference between telling me where i am wrong or quickly fixing/modifying/adding something to my code, and just making yours up from scratch and giving it to me.  and while i would appreciate someone's completed code i would prefer to do most of the work myself so i can learn how to do it.(which, if i am not far off then i would of done most of the work.)

the end goals are to have it show up as player x teamkilling y's horse.(i know the last spoiler doesn't have that as i figured i want to see it showing someone teamkilling a horse before i figure out how to put the rider in.  tips on that would be appreciated as well)   then there are my other goals of having the game show someone teamwounding someone(and their horse as well) 


edit: also, i dont think i said this but i am doing these tests with bots and not fellow humans currently.  so the code i am trying to write reflects this.  eventually i will have to change it to involve 2 humans.  it is just faster to work with bots. 

Title: Re: *Scripting Thread*
Post by: Grozni on May 18, 2016, 12:54:35 pm
Referring to 2nd and 3rd spoilers. Without getting too deep in, there are probably other things wrong with script, but for start:


(eq, neg|agent_is_human,":dead_agent_no"), - what you are doing here is comparing if neg|agent_is_human is equal to ":dead_agent_no", and that is pointless. In some other language you could get an error during compile time for doing this, but here you don't, because in M&B module system both neg|agent_is_human and ":head_agent_no" are just numbers, so the compiler sees you are comparing two numbers and doesn't complain, even tho what you are doing makes no sense, it is like comparing a function with the argument that was supposed to be passed to it.
-If you don't understand the above explanation yet, don't sweat, for now what you need to know is you probably just want to do (neg|agent_is_human,":dead_agent_no")  which checks if agent is a horse.


(neg|agent_is_human,":dead_agent_no"), # Teamkiller already checked so only if dead guy is a player and not a bot
Here, you are trying to use the function which checks if agent is a horse to check if agent is a bot. I know it is confusing at start because "is_human" could mean two things, but to set this straight: agent_is_human checks whether agent is a horse, it will not be false for bots as bots count as humans.
-what you want to do is (agent_is_non_player, ":cur_agent"),


Also, since you do (neg|agent_is_human, ":dead_agent_no"), before calling the server_on_player_teamkilled_horse script, the script will fire only if the victim is a horse, so the part of script which checks if victim is a bot will never be used.


Thats just some stuff wrong with script I noticed, don't have much time to go deeper in atm.
Title: Re: *Scripting Thread*
Post by: Thunderstormer on May 18, 2016, 02:27:31 pm
yea, referring to the 2nd spoiler.  What i am trying to say code wise is if the agent that is dead is a horse and by someone from the same team, to go to the script listed.  it made sense in my head. 

when i originally got bots to show up as being teamkilled, i had this  right before it calls the script (agent_is_human, ":dead_agent_no"),  so i thought by adding the proper stuff in front it would still work, just with horses this time around.

the add tutorial message to logs part was just a check to see if it got that far into my script or not.  wasn't intending to keep that there when it worked. 

i copied and modified the normal teamkill script and modified it, which is why that one note was there.  anyways, when i get time, i'll make the changes you recommended or possibly others should they also post. 

and about this line.   (agent_is_non_player, ":cur_agent"),  wouldnt it be  (agent_is_non_player, ":dead_agent_no"), ?  or is that not necessary to get the agents name(dead agent no). 

also, i dont think i said this but i am doing these tests with bots and not fellow humans currently.  so the code i am trying to write reflects this.  eventually i will have to change it to involve 2 humans. 


and perhaps i am going about this all wrong.  would it be better to check if a horse is killed, and rather than get it to write the horses name, write the owner and modify the string.    so it says x teamkilled y horse.(with horse just being the word horse and not any particular type of horse listed)  perhaps it is time for bed so clarify my thoughts on this.  i have done so many tests, tweaks, and various thought processes on this they start to blend together. 

on the bright side, i improved the heal function.(imo.)  healing a player(not all) now heals the horse they are riding.

Title: Re: *Scripting Thread*
Post by: Lilja Mariasdóttir on May 18, 2016, 02:32:32 pm
Forget horses beeing items. Spawned horses are agents. They are stored and spawned via items (so people can have them in their inventory). But after beeing spawned you have an agent.
Any nonhuman is a horse. So check for:
Code
(neg|agent_is_human, ":dead_agent_no"),
Then we get the rider of the horse, if the horse has one.
Code
(agent_get_rider, ":dead_horse_rider", ":dead_agent_no),
(neq, ":dead_horse_rider, -1), #even has a rider?
Then we compare the teams:
Code
(agent_get_team, ":killer_team", ":killer_agent_no"),
(agent_get_team, ":dead_team", ":dead_horse_rider"),
(eq, ":killer_team", ":dead_team"),
Save the names:
Code
(agent_get_player_id, ":killer_player", ":killer_agent_no"),
(agent_get_player_id, ":dead_horse_player", ":dead_horse_rider"),
(str_store_player_username, s68, ":killer_player"),
(str_store_player_username, s69, ":dead_horse_player"),
And then store in the logs, who teamkilled which horse.
But when I remember right, when the horse is dead, you cant get the team and rider anymore (maybe I am mistaken).
However, on my cavserver I solved it via the hit_trigger, same thing:

Code
(store_trigger_param_2,":attacker_agent"),
        (store_trigger_param_1,":hit_agent"),
        (store_trigger_param_3,":damage"),

(agent_is_active, ":attacker_agent"),
(agent_is_active, ":hit_agent"),
(agent_is_alive, ":attacker_agent"),
(agent_is_alive, ":hit_agent"),

(store_agent_hit_points,":real_hp",":hit_agent",1),
(ge, ":damage", ":real_hp"), #integer values, probably not 100% exactly

(neg|agent_is_human, ":hit_agent"),

(agent_get_rider, ":hit_rider", ":hit_agent"),
(neq, ":hit_rider", -1), #even has a rider?

(agent_get_team, ":attacker_ag_team", ":attacker_agent"),
(agent_get_team, ":hit_ag_team", ":hit_rider"),

(eq, ":attacker_ag_team", ":hit_ag_team"),
(agent_is_alive, ":hit_rider"),

(agent_get_player_id, ":attacker_player", ":attacker_agent"),
(agent_get_player_id, ":hit_player", ":hit_rider"),
(str_store_player_username, s68, ":attacker_player"),
(str_store_player_username, s69, ":hit_player"),



Edit: "agent_is_non_player", only gives you back, that the agent is no player. That means it is a bot, or a horse.


Spoiler
Unlike a certain modder, I will not insist on having my name written all over the server and spammed within announcements each couple minutes.
Still salty for beeing banned?^^
[close]

Title: Re: *Scripting Thread*
Post by: Pio on May 18, 2016, 03:09:06 pm
Script 1
You can't use eq and neg together and in this case you don't need eq at all, so this is wrong:
Code
(eq, neg|agent_is_non_player, ":dead_agent_no"),
if you wanted to check if a given agent is a player this is the correct way:
Code
(neg|agent_is_non_player, ":dead_agent_no"),



Another problem:
Code
 (eq, agent_is_non_player, ":agent_no"),
you don'd need eq there, because this operation already returns true or false. The correct way to use it is this:
Code
 (agent_is_non_player, ":agent_no"),




In some parts of the code you are using ":agent_no" variable that was never assigned. I think you meant to use ":dead_agent_no" instead.


In this part:
Code
(agent_get_horse, ":horse_agent", ":agent_no"),
      (agent_get_item_id, ":horse_agent", ":agent_no"),
          (try_begin),
            (le, ":horse_agent", 0),
     
          (assign,":horse_agent",":dead_agent_no"),
         (neg|agent_is_human, ":dead_agent_no"),
         (agent_is_active,":dead_agent_no"),
         
         (agent_get_team, ":agent_team",":agent_no"),
         (agent_set_team, ":dead_agent_no", ":agent_team"),
        (try_end),


(agent_get_horse, ":horse_agent", ":agent_no"), at the beginning is unnecessary, because you are retrieving agent's horse and storing it in ":horse_agent" variable, but you are not using that variable for anything and the line below:
Code
(agent_get_item_id, ":horse_agent", ":agent_no"),
overrides it anyway.


Also I'm not sure if you shold be assigning anything to ":dead_agent_no" variable, because it's used in the entire scirpt 54 and because of that if there is any original code below yours it might stop working, so you might want to create a new variable and use it instead.
Title: Re: *Scripting Thread*
Post by: Grozni on May 18, 2016, 03:17:23 pm
i copied and modified the normal teamkill script and modified it, which is why that one note was there.  anyways, when i get time, i'll make the changes you recommended or possibly others should they also post. 
Depends what you are trying to do really. If you want specific thing to happen only after the deed has been done, ie the bot has already been teamkilled, you are on the right track, but if it is some anti-troll measure the usual thing to do is use ti_on_agent_hit trigger, search for examples of it in mission_templates. This trigger fires whenever someone is hit, and is more appropriate to use in anti-troll script as the act of teamhitting is a crime in itself.

and about this line.   (agent_is_non_player, ":cur_agent"),  wouldnt it be  (agent_is_non_player, ":dead_agent_no"), ?  or is that not necessary to get the agents name(dead agent no). 
That was just an example, the syntax is (function, variable) so, of course, proper thing to use in your case is (agent_is_non_player, ":dead_agent_no"), as variable dead_agent_no holds the number of agent who died (because you told it to).

also, i dont think i said this but i am doing these tests with bots and not fellow humans currently.  so the code i am trying to write reflects this.  eventually i will have to change it to involve 2 humans. 
I have no clue what you plan to do, but if this script is about detecting teamkills of bots and horses, it should work well enough no matter how many humans are on the server.

and perhaps i am going about this all wrong.  would it be better to check if a horse is killed, and rather than get it to write the horses name, write the owner and modify the string.    so it says x teamkilled y horse.(with horse just being the word horse and not any particular type of horse listed)  perhaps it is time for bed so clarify my thoughts on this.  i have done so many tests, tweaks, and various thought processes on this they start to blend together. 

on the bright side, i improved the heal function.(imo.)  healing a player(not all) now heals the horse they are riding.
Depends on what you want to do, it is more likely you want to get rider's name, so like that other person suggested use agent_get_rider

Spoiler
Spoiler
Unlike a certain modder, I will not insist on having my name written all over the server and spammed within announcements each couple minutes.
Still salty for beeing banned?^^
[close]
Actually you being salty is the reason I'm banned.

[close]
Title: Re: *Scripting Thread*
Post by: BlackNight on May 18, 2016, 04:58:13 pm
There is a way to putt players name and then (horse).
If that is what you want.
Ninja killed  Blacky(Horse)(horseicon)

With the bank script that is used on pw.Just need to modify it.
Each time the players spawns with horse,game registers his ID and make and agent.
[Blacky] (acctual player]
and
[Horsy] (horse of player]
and then when Horsy dies game removes ID from registery and announces like simple message
"players_horse_died"

Now i know this is just a theory but it might work.
Title: Re: *Scripting Thread*
Post by: Thunderstormer on May 21, 2016, 04:35:03 am
Now that i got time to sit down and work on it, i indeed got it to work. 

Quote
Depends what you are trying to do really. If you want specific thing to happen only after the deed has been done, ie the bot has already been teamkilled, you are on the right track, but if it is some anti-troll measure the usual thing to do is use ti_on_agent_hit trigger, search for examples of it in mission_templates. This trigger fires whenever someone is hit, and is more appropriate to use in anti-troll script as the act of teamhitting is a crime in itself.
Yea, i stumbled upon that by accident around the time i made my first post here.(looking for anything horse related)   After looking at it and heeding kanades point of doing it there so it keeps track of the rider/horse, i was able to make it show teamwounding players/horses on my own.  The killing of horses was still a pain as it wasn't working.  Tried a combo of mine and kanades to see if i was missing something and finally it started working.(probably forgot to change 1 thing that was left over from my previous block that i copied.)  Not sure what i was doing wrong but its working now.(all of them are in that trigger area, not in script 54.)  I wasn't getting any compile errors.

and thanks to you all for pointing out my errors in syntax.  picking up things over time and it is starting make more sense.(granted i am still very ignorant)  i am trying to use examples that i see in the code  as a base to work off of which is why some of my coding may seem off or my understanding of it. 


Quote
I have no clue what you plan to do, but if this script is about detecting teamkills of bots and horses, it should work well enough no matter how many humans are on the server.

ah, to clarify, i am currently testing on bots as it is the quickest way to do it.  when i know they work, i modify it so that it works with 2 or more humans  instead.


There is a way to putt players name and then (horse).
If that is what you want.
Ninja killed  Blacky(Horse)(horseicon)

With the bank script that is used on pw.Just need to modify it.
Each time the players spawns with horse,game registers his ID and make and agent.
[Blacky] (acctual player]
and
[Horsy] (horse of player]
and then when Horsy dies game removes ID from registery and announces like simple message
"players_horse_died"

Now i know this is just a theory but it might work.

i haven't played PW so i wouldn't know how it works.  With that being said, i would like to avoid where possibly copying anyone's code and use my own instead.  Which is why i am happy to say all the code i made is very much my own minus a line or 2.(pretty much that Neq line for checking if their is a rider.  didn't try it without it.  figured if kanade had it, it has a purpose.  maybe it is pointless? idk)

 
and i know kanade does a lot of scripting for other servers.(or their cav server)  not sure about the rest of you but this may be helpful.  it heals the horse of a player when you heal a single player.  useful if you are in a spot where you want to heal someone and their horse but not everyone.  again thanks for the help everyone.  much appreciated.
              (eq, ":command", player_list_admin_cheat_heal_player),
              (player_get_agent_id, ":value_agent_id", ":value"),
              (agent_is_active,":value_agent_id"),
              (agent_is_alive, ":value_agent_id"),               
              (agent_set_hit_points, ":value_agent_id", 100, 0), # Heal the player
               (try_begin),
                (agent_get_horse, ":horse_agent", ":value_agent_id"),
                (agent_is_active,":horse_agent"),
             (agent_is_alive, ":horse_agent"),
          
                (agent_set_hit_points, ":horse_agent", 100, 0), # Heal the Horse
            (try_end),
          
              (assign, ":script_ok", 1),
              (str_store_string, s4, "str_cheat_heal_player_s2_s3"),
Title: Re: *Scripting Thread*
Post by: Thunderstormer on June 02, 2016, 07:09:56 pm
working on making it so only a few admins are allowed to ban other admins.  thought it would be pretty straight forward.  guess i am wrong.  I believe i am working in the correct area.  I grabbed the part where normal non admins are banned, copied and pasted it below, and modified it so its looking for 2 admins then having the approved one ban the other admin.

havent had any luck yet in getting it to work.  this is where i am leaving it for now, hopefully i didnt leave anything off while i was messing around with it. eventually i will want to have a few "special" admins that can ban other admins. 

#     (else_try),
#         (eq, ":event_type", multiplayer_event_admin_ban_player),
 #       (try_begin),
 #         (store_script_param, ":value", 3),
          #validity check
          # Vincenzo begin
 #         (call_script, "script_multiplayer_server_protect_admin_command", ":player_no"),
 #         (eq, reg0, 1), # ok_admin
          # Vincenzo end
#          (player_is_admin, ":player_no"),
#        (player_get_unique_id, reg44, ":player_no"),
#        (eq, reg44, 111111),       <<<<example id.   later on i believe i will need to use this_or_next| command
 #         (player_is_active, ":value"),
 #         #condition checks are done
         
          # Vincenzo begin
 #         (player_is_admin, ":value"),
         
#          (try_begin),
#            (gt,":player_no",-1),
#            (str_store_player_username, s2, ":player_no"), # adminname
#          (else_try),
#            (str_store_string,s2,"str_you"),
#          (try_end),
#          (str_store_player_username, s3, ":value"),
#          (str_store_string, s4, "str_ban_player_s2_s3"),
#          (call_script, "script_multiplayer_broadcast_message"),
 #         (try_begin),
 #           (player_get_unique_id, ":value_2", ":value"),
 #           (gt,":value_2", 1), # Key auth server problem protection (id 1 if wrong)
#          (ban_player, ":value", 0, ":player_no"),
#          (ban_player, ":value", 0, 0),  <<<< another attempt at banning someone.
#          (else_try),
 #           (kick_player, ":value"),
#          (try_end),
#          # Thunder end
 #       (try_end),

I # all of it as i was working on other scripts. 

do i need to kick the person first then add their stored id to the ban list?  do i need to kick them for "cheating"?  is there a simple error in there or am i way off the mark?  got my other 4 scripts to work on the first try today.  this is the only one that has caused me any trouble. 


Figured it out.

and these 3 lines will get rid of the oddities of teamwounding yourself or your horse, and teamkilling your own horse/

        (neq, ":hit_agent_no", ":attacker_agent_no"),
        (neq, ":attacker_agent_no", ":hit_rider_no"),

        (neq, ":attacker_agent_no", ":dead_rider_no"),
Title: Re: *Scripting Thread*
Post by: Thunderstormer on June 09, 2016, 06:10:42 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)
Title: Re: *Scripting Thread*
Post by: Johny_Nawalony 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)
Title: Re: *Scripting Thread*
Post by: Victorcin 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.
Title: Re: *Scripting Thread*
Post by: Grozni 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.
Title: Re: *Scripting Thread*
Post by: Gurkha 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?
Title: Re: *Scripting Thread*
Post by: Grozni 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.
Title: Re: *Scripting Thread*
Post by: Thunderstormer 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
(https://www.fsegames.eu/forum/proxy.php?request=http%3A%2F%2Fimages.akamai.steamusercontent.com%2Fugc%2F487893695338744775%2F578310E67ED567D919B783BF23478826DBE7D632%2F&hash=3955da535db78b0fd22005b0ad2ef6ecc1d84ee7)
[close]



Spoiler
(https://www.fsegames.eu/forum/proxy.php?request=http%3A%2F%2Fimages.akamai.steamusercontent.com%2Fugc%2F487893695338744891%2F22BAA36B1A518E7AFF8078F4E12E4A6736878D0A%2F&hash=d8399b545579d530304a1b8daf89a7dee09db0cd)
[close]

Spoiler
(https://www.fsegames.eu/forum/proxy.php?request=http%3A%2F%2Fimages.akamai.steamusercontent.com%2Fugc%2F487893695338745007%2F5126E7F2A01F8A5646D7CBB48C3C5DC853B1383A%2F&hash=3b76fba37f5e32505faf42049e9413112db19c7e)
[close]
Title: Re: *Scripting Thread*
Post by: Grozni 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.
Title: Re: *Scripting Thread*
Post by: Thunderstormer 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.
Title: Re: *Scripting Thread*
Post by: DanyEle 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 (https://forums.taleworlds.com/index.php/topic,351061.msg8420802.html#msg8420802) , OSP code. So you may look at it and eventually take whatever you need  ;) . Yeah, it's for PW, but Warband is still Warband.
Title: Re: *Scripting Thread*
Post by: Grozni 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?
Title: Re: *Scripting Thread*
Post by: DanyEle 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
Title: Re: *Scripting Thread*
Post by: Pio 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.
Title: Re: *Scripting Thread*
Post by: Lilja Mariasdóttir 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.
Title: Re: *Scripting Thread*
Post by: Thunderstormer 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.
Title: Re: *Scripting Thread*
Post by: Lilja Mariasdóttir 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).
Title: Re: *Scripting Thread*
Post by: Thunderstormer on June 24, 2016, 01:56:48 am
Yea, i was referring to the NA cav Gf server run by Griffith of the 1erPLG.

i haven't looked into how often someone can make a poll but i thought there was a timer somewhere.(thought i seen it mentioned anyways)  don't really have time right now to look.  if it is not in the script file, it may be in the mission template.

and yea, i have been using their ID to make them into different kinds of admins by giving or removing certain powers.  not sure about client side mods currently. not that they wouldnt be useful but getting people to dl them and use them with the admins staff would be a pain.  considering all the work that would go into it and little gain the server would see from it, idk if it would be worth it.  something for me to think about tho.

Title: Re: *Scripting Thread*
Post by: Lilja Mariasdóttir on June 24, 2016, 02:21:02 am
Ah, yes, it is running an older version of my cavgf script.

The polls are timelocked both, client and serverside, thats why you cant change it only serverside (clientside it is located in presentations.py).
For my server it is enough, as the player just need to decide once, if he wants the messages or not, but if you want to make something, that need a more often communication, the polls are no good option. (btw, admins can do as many polls as they want, if I remember right).
Title: Re: *Scripting Thread*
Post by: Karl_of_the_line on August 19, 2016, 04:41:27 pm
Could anyone help me out and make a script that increases explosion and blast radius from the howitzer by 50 times? Would be greatly appreciated :)
Title: Re: *Scripting Thread*
Post by: DarthKiller on August 28, 2016, 01:24:07 am
Hello I'm new to the scripting scene and as such noob I request the help of you glorious masterminds.

What I want is simple, fix the following script for me or give me atleast a guide what I did wrong there. Any help would be greatly appreciated because I need this script working to prevent sapper spam on my Mod and have doors destructible (these aren't yet in the code but will be added later)

module_mission_templates.py (part)
Quote
multiplayer_server_botbarricadeattack = (
   3, 0, 0, [],
   [
   (call_script, "script_botattackbarricade"),
   ])

module_scripts.py   (part)
Quote
("botattackbarricade",
 [
 (try_begin),
    (try_for_agents,":agent_id"),
   (store_script_param, ":instance_id", 1),
   (agent_is_alive, ":agent_id"),
   (agent_is_active, ":agent_id"),
   (agent_is_human, ":agent_id"),
   (agent_is_non_player, ":agent_id"),
 
       (prop_instance_get_scene_prop_kind, ":prop_kind", ":instance_id"),
         (this_or_next|eq,":prop_kind","spr_mm_stakes_destructible"),
         (this_or_next|eq,":prop_kind","spr_mm_stakes2_destructible"),
         (this_or_next|eq,":prop_kind","spr_sandbags_destructible"),
         (this_or_next|eq,":prop_kind","spr_chevaux_de_frise_tri_destructible"),
         (this_or_next|eq,":prop_kind","spr_gabiondeploy_destructible"),
         (eq,":prop_kind","spr_mm_fence1"),
      
       (agent_get_position, pos79, ":agent_id"),
       (prop_instance_get_position, pos80, ":prop_kind"),
         (get_distance_between_positions_in_meters, ":player_distance", pos79, pos80),
       (lt, ":player_distance", 2),
       (prop_instance_receive_damage, ":prop_kind", ":agent_id", 10),
       (try_end),
 (try_end),
 ]),

The Error:
(https://www.fsegames.eu/forum/proxy.php?request=http%3A%2F%2Fimages.akamai.steamusercontent.com%2Fugc%2F266097744486981013%2F66E113DE19830777D072526D17C7FF92336F37E5%2F&hash=23b7599334faf0582fee70fe263a441d96af58c6)

Yours faithfully,
DarthKiller454 Lieutenant of the IR59
Title: Re: *Scripting Thread*
Post by: Thunderstormer on August 28, 2016, 01:39:15 am
dont have time to look through the code, but if you get an op code error, look at the # and the corresponding number in your header operations file. 
Title: Re: *Scripting Thread*
Post by: Grozni on August 28, 2016, 03:07:38 am
For start, if you use store_script_param in your script then you're supposed to pass parameter to it while calling it
 (call_script, "script_botattackbarricade", ":some_instance"), #since you passed some_instance as parameter, this would make (store_script_param, ":instance_id", 1), actually store that something into instance_id variable, whatever some_instance is, I don't see how you intend to get it from trigger

Another thing, put try_for_agents below store_script_param, as you want to call store_script_param only once, otherwise store_script_param will be performed per each agent on the map, that will cause the script to perform unneeded extra work.

Though, if I am guessing right at what you're trying to do here, you shouldn't be passing parameter and using store_script_param at all, what you want to do is loop through all the objects on the scene (there are many examples of how to do that in existing code) and then check if it is the sapper construction type, as you already do.
Title: Re: *Scripting Thread*
Post by: DarthKiller on August 28, 2016, 03:15:50 pm
Okay I fixed it thanks to your help reducing it to mission_templates_only

here is the script as a Sign of my gratitude

Quote
multiplayer_server_botbarricadeattack = (
   3, 0, 0, [(this_or_next|multiplayer_is_server),(neg|game_in_multiplayer_mode),],
   [
   (try_for_agents,":agent_id"),
      (try_begin),
         (agent_is_active, ":agent_id"),
         (agent_is_alive, ":agent_id"),
         (agent_is_human, ":agent_id"),
         (agent_is_non_player, ":agent_id"),
         (agent_get_position, pos79, ":agent_id"),
         (try_for_range,":barricade", mm_destructible_props_begin, mm_destructible_props_end),
            (scene_prop_get_num_instances, ":num_instances_of_scene_prop", ":barricade"),     
            (try_for_range, ":cur_instance", 0, ":num_instances_of_scene_prop"),
            (scene_prop_get_instance, ":cur_instance_id", ":barricade", ":cur_instance"),
            (prop_instance_is_valid,":cur_instance_id"),
            (prop_instance_get_position, pos80, ":cur_instance_id"),
            (get_distance_between_positions, ":player_distance", pos79, pos80),
            (lt, ":player_distance", 200),
            (prop_instance_receive_damage, ":cur_instance_id", ":agent_id", 1),
            (try_end),
         (try_end),
       (try_end),
   (try_end),
   ])

May not be working yet
Title: Re: *Scripting Thread*
Post by: Lilja Mariasdóttir on August 28, 2016, 04:07:16 pm
Spoiler
Okay I fixed it thanks to your help reducing it to mission_templates_only

here is the script as a Sign of my gratitude

Quote
multiplayer_server_botbarricadeattack = (
   3, 0, 0, [(this_or_next|multiplayer_is_server),(neg|game_in_multiplayer_mode),],
   [
   (try_for_agents,":agent_id"),
      (try_begin),
         (agent_is_active, ":agent_id"),
         (agent_is_alive, ":agent_id"),
         (agent_is_human, ":agent_id"),
         (agent_is_non_player, ":agent_id"),
         (agent_get_position, pos79, ":agent_id"),
         (try_for_range,":barricade", mm_destructible_props_begin, mm_destructible_props_end),
            (scene_prop_get_num_instances, ":num_instances_of_scene_prop", ":barricade"),     
            (try_for_range, ":cur_instance", 0, ":num_instances_of_scene_prop"),
            (scene_prop_get_instance, ":cur_instance_id", ":barricade", ":cur_instance"),
            (prop_instance_is_valid,":cur_instance_id"),
            (prop_instance_get_position, pos80, ":cur_instance_id"),
            (get_distance_between_positions, ":player_distance", pos79, pos80),
            (lt, ":player_distance", 200),
            (prop_instance_receive_damage, ":cur_instance_id", ":agent_id", 1),
            (try_end),
         (try_end),
       (try_end),
   (try_end),
   ])

May not be working yet
[close]
working now
Title: Re: *Scripting Thread*
Post by: Miau on September 29, 2016, 01:11:25 am
Miau started a new commander battle server called BLOODBATH. It has had a lot of peoples active on it lately. This is Miau first server, so wondering about some scripts or advice.



Any help Miau would appreciate.
Title: Re: *Scripting Thread*
Post by: Lilja Mariasdóttir on September 29, 2016, 12:29:13 pm
Trying to make it so only 1 of each Cavalry regiment can be played. No matter what I set the %'s to in the admin panel, people can always pick more cav.
The adminpanel's options are default not working for Commanderbattlemode, but it is possible to add limits to CB aswell (as you can see on the EU_Commander)
Quote
I am also wondering if it is possible to remove the default maps from the poll menu so it is only the random ones.
This is absolutly possible, however the client will be able to see all the maps in his poll menu, but when he chooses a wrong one, the server can just ignore that poll.
Quote
Can the sailor class be disabled from being able to be picked / removed?
The same like point 1.
Quote
Finally, I'm wondering if anyone knows how the EU Commander Battle server allows line regiments to have musicians and flags!
If I remember correctly, Grozni offered such scripts here in the thread, and he doesnt even want credits. https://steamcommunity.com/id/grozni
Title: Re: *Scripting Thread*
Post by: Miau on September 29, 2016, 01:38:13 pm
Thank you Kanade! I will add him and ask.
Title: Re: *Scripting Thread*
Post by: Preobraz_LG_Official on October 20, 2016, 06:18:07 pm
Hi,wanted to know,whether there is some script-module,which replace Napoleon/Wellington etc with General skins. For server I mean,not for personal use.
Title: Re: *Scripting Thread*
Post by: Johny_Nawalony on October 20, 2016, 09:08:36 pm
Hi,wanted to know,whether there is some script-module,which replace Napoleon/Wellington etc with General skins. For server I mean,not for personal use.
No, there isn't
Title: Re: *Scripting Thread*
Post by: Spoons on October 29, 2016, 07:19:11 am
Hi,wanted to know,whether there is some script-module,which replace Napoleon/Wellington etc with General skins. For server I mean,not for personal use.
No, there isn't

It would be fairly easy to make new general uniforms for a server out of existing NW uniform pieces, in the way that some servers create an 'admin uniform'. I'll happily help with this for free if it would suit your needs - just send me a message.
Title: Re: *Scripting Thread*
Post by: Mercuri on November 01, 2016, 10:32:50 am
Hello, Im looking for a working script that prevent players to spawn only in their base flags on conquest mode.
Title: Re: *Scripting Thread*
Post by: 51st Regiment Of Foot on November 08, 2016, 12:46:02 am
Hello, Im looking for a working script that prevent players to spawn only in their base flags on conquest mode.
Add me on steam 51st Sam (https://steamcommunity.com/id/51stSam/)
Title: Re: *Scripting Thread*
Post by: nukey111 on November 08, 2016, 05:42:49 pm
How would I go about disabling the anticheat in NW? I'm making a module on it and I can't add items to units without it being removed. Or how would greenlight the items?
Title: Re: *Scripting Thread*
Post by: 51st Regiment Of Foot on November 08, 2016, 06:06:09 pm
How would I go about disabling the anticheat in NW? I'm making a module on it and I can't add items to units without it being removed. Or how would greenlight the items?
You can't; the way items are assigned be default is entirely based on the client troops.txt; anything the server says that troop can't have it just doesn't give, anything the client doesn't ask for isn't given. Best bet is removing all of the agent's items when they spawn as a certain class, and manually reassigning them equipment
Title: Re: *Scripting Thread*
Post by: nukey111 on November 09, 2016, 01:31:54 am
So, the only requirement is that the clients troop.txt and the servers matches up? I think I've tried that before and it hasn't worked. I'll give it a try though and update.

UPDATE: Your method works for normal items. However, anything custom I've added in doesn't allow itself to be spawned.
Title: Re: *Scripting Thread*
Post by: Grozni on November 09, 2016, 02:31:53 am
So, the only requirement is that the clients troop.txt and the servers matches up? I think I've tried that before and it hasn't worked. I'll give it a try though and update.

UPDATE: Your method works for normal items. However, anything custom I've added in doesn't allow itself to be spawned.

Not sure if you mean add items which don't exist in original NW, or just equipping troops with existing items. Since first option is impossible to do server-side only, I'll take it you mean the second.
Client's and server's troops.txt don't have to match in terms of equipment. But the only kind of change you can make in troops.txt is removing items, while adding items doesn't work. Additionally, spawning with inappropriate clothes (or empty clothes slot) will get you kicked, and this happens because of the anti-cheat check which you can alter or remove in module system.

When adding equipment it is best to leave troops file as it is, and alter the spawning agent's equipment in agent spawn common script in module_scripts. Of course you'd need to write the checks which equip agents based on some criteria (usually based on troop class, but it can be other stuff with some interesting results).

To help you out a bit:
-Check out treasure chest code for an example of how to remove an existing piece of clothes on head slot and equip a pirate hat server-side (module_scene_props.py)
-Search module_scripts.py for "kicked_for_cheating" or something like that to locate a check which is annoying you, from there you can alter or remove it but then keep in mind some hackers could spawn with wrong equipment types
Title: Re: *Scripting Thread*
Post by: nukey111 on November 09, 2016, 02:56:22 am
Hey, sorry for that. I'm adding new, custom-made items, like chainmail armors, poleaxes, etc. I've removed any of the scripts (baring admin) referencing kicking the player, but I'm not too good with the script system and I can't get it to compile.
Title: Re: *Scripting Thread*
Post by: Grozni on November 09, 2016, 03:17:47 am
Ah, so you're building a full module that others are meant to download in order to play?
If that's the case you should edit this piece of code in module_scripts like this:
Code
     (try_begin),
       (eq,0,1), #G: this line will make sure this block of code never happens
       (eq,":must_kick",1),
       (str_store_player_username, s2, ":player_no"),
       (str_store_string, s4, "str_player_kicked_cheating_s2"),
           
       (call_script, "script_multiplayer_broadcast_message"), # Broadcast kicked message
       
       (kick_player, ":player_no"),
     (try_end),

That should work, but as for compile errors you are getting they may be caused by you messing up some other piece of code so idk, what errors are you getting exactly?
Title: Re: *Scripting Thread*
Post by: nukey111 on November 09, 2016, 02:10:28 pm
UPDATE

I've implemented the changes you've brought up, and that fixes the anti-cheat problem. However I'd like to add the items in as their own pieces and have it spawn through troops.txt, as I'm redoing whole load outs with custom items. What would the check for new items be? Or is their a coded limit in NW?
Title: Re: *Scripting Thread*
Post by: Grozni on November 10, 2016, 03:06:23 pm
Simply altering equipment in module_troops will often work good enough with a few caveats which you may run into and will have to try and fix them.

To add new items, you just add all the items into module_items.py, look at other items for examples. If your item is similar in function to some other item you can just copy/paste that other item's entry and change item ID, name and model name, along with tweeking other properties if needed. Item ID is for calling in code ("itm_new_armor"), name is the item name you see ingame, and model name is reference to model name as you named it in openBRF.

Order of the item on the list (in module_items.py) can sometimes matter, you can get unexpected bugs during game run, NW performs some checks where order of items count, I don't know them all by heart but it is best you just keep items of similar class grouped together (so for example put new pistol with old pistols), ideally add new items somewhere in the middle rather than below existing items of same class.

 If you added your items to module_items and equipped both players and bots with them in module_troops, and you still see naked people running around, check if you did rigging part properly (is your armor actually attached to the test model in 3e view of openBRF) and if not read up on some basic tutorials about adding items in NW or WB module systems.
Title: Re: *Scripting Thread*
Post by: nukey111 on November 11, 2016, 12:02:07 am
See, that's the thing. All the models are rigged properly. They're all added properly- I've done it manually AND with Morgh's tool- and they'll show up on my character in the preview screen, however, my character wont _spawn_ with them. It doesn't make any sense, however, I guess it just doesn't like me :( I'll have to just remesh existing items and change their names/stats, which while is going to be excruciatingly aggravating, I don't have much of a choice I guess. Unless I'm full on missing something, I've gone through tutorials so many times with no success.
Title: Re: *Scripting Thread*
Post by: Thunderstormer on November 11, 2016, 12:08:29 am
worse case scenario, you could go to the script that assigns you the items you spawn with, and have the game add them to you there.(or rather the troops class)   not the best way, but at least you can use the items.
Title: Re: *Scripting Thread*
Post by: Grozni on November 11, 2016, 12:39:39 am
See, that's the thing. All the models are rigged properly. They're all added properly- I've done it manually AND with Morgh's tool- and they'll show up on my character in the preview screen, however, my character wont _spawn_ with them. It doesn't make any sense, however, I guess it just doesn't like me :( I'll have to just remesh existing items and change their names/stats, which while is going to be excruciatingly aggravating, I don't have much of a choice I guess. Unless I'm full on missing something, I've gone through tutorials so many times with no success.

Well reasons can be several, can you send me your entire module_items and module_troops files? Also names of items you added to troops in module_troops. There is probably some silly mistake you're making and it might be solved fast if I see the files.
Title: Re: *Scripting Thread*
Post by: nukey111 on November 11, 2016, 01:41:45 am
https://gyazo.com/17e944214570db6e364d626548a7908f
https://gyazo.com/6801bbd84276c841d816748f8a63738a

I've redone the units and started it all fresh, so that's out of the issue now. But, it's giving me the weapon choice slide, allowing me to pick either the poleaxe or armor. How would I disable this and give it all to my troop?
Title: Re: *Scripting Thread*
Post by: Grozni on November 11, 2016, 03:11:10 am
Well I did ask for whole files for a reason, this way I can't say much except that if your poleaxe and armor are next to each other like in that sample you sent you should separate them and put them into proper places in a way I described two posts up.
Title: Re: *Scripting Thread*
Post by: nukey111 on November 11, 2016, 03:41:37 am
Hey, sorry about that, here they are:
http://www.filedropper.com/moduleitems
http://www.filedropper.com/moduletroops
Title: Re: *Scripting Thread*
Post by: Grozni on November 11, 2016, 12:46:02 pm
Just do exactly as I already said, read carefully:

Order of the item on the list (in module_items.py) can sometimes matter, you can get unexpected bugs during game run, NW performs some checks where order of items count, I don't know them all by heart but it is best you just keep items of similar class grouped together (so for example put new pistol with old pistols), ideally add new items somewhere in the middle rather than below existing items of same class.
Title: Re: *Scripting Thread*
Post by: zude on November 11, 2016, 02:32:11 pm
Is there a way to run a normal NW server, but use a script that changes everyone's ammo at the start?
Title: Re: *Scripting Thread*
Post by: Thunderstormer on November 11, 2016, 02:42:37 pm
Is there a way to run a normal NW server, but use a script that changes everyone's ammo at the start?
you can limit the amount of ammo start with, yes.   you don't need a script to do it.  i believe someone even did it by just modifying the text files.
Title: Re: *Scripting Thread*
Post by: nukey111 on November 11, 2016, 05:16:51 pm
Hey, I've redone order and played with it enough, so I've got units working, thank you :D Would you know off hand if scripts can create particles? I'd like to make a smoke grenade and smoke shell for cannons.
Title: Re: *Scripting Thread*
Post by: Grozni on November 11, 2016, 06:19:44 pm
Start by searching through module_items for "particle", you will run into a ranged broken bottle item that has a script attached for ti_on_missile_hit trigger which means that script will run on thrown bottle making an impact, and it has an example of a function which spawns particles. You'll see that the script (surrounded by []) is made to be one long line of text which saves space but is not easy to read, to fix that you can press enter to add new line after each ")," to make the script more readable, it will still work.

Just notice that first two lines are
(this_or_next|multiplayer_is_server),
(neg|game_in_multiplayer_mode)
Which means the code below will apply only to server which is what you want as the server will broadcast particle event to all clients.

But to make some more realistic effect, like smoke grenade bouncing or smoke starting with latency, coding just inside module_items entry won't cut it, you'd need to get good at writing more complex stuff in module_scripts and module_mission_templates.

Title: Re: *Scripting Thread*
Post by: nukey111 on November 11, 2016, 09:43:33 pm
Yeah, I've looked through that, seems to be the case.

How would I actually guarantee items to a unit? I've been messing with it for hours now, and I've got everything in place/order as you said, but I've still got troops spawning with gloves in inventory and whatnot. Anyway I can force it to a slot?
Title: Re: *Scripting Thread*
Post by: Rojoyerf on December 14, 2016, 01:31:03 pm
Hello, I need help with a small server side mod that changes the item the 'ze treasure' chest gives you depending on its variable number. Also would it be possible to change the "open ze treasure" to something else? Any help would be much appreciated.
Title: Re: *Scripting Thread*
Post by: Rojoyerf on December 28, 2016, 07:54:50 pm
Hello everyone, I was wondering if I could have some help with editing spawn points, I want to make it so either:
A: certain people spawn at certain entry points
or B: certain types of troop spawn at certain entry points

I have the NW module system and I have a feeling it's one of the mtef strings in module_mission_templates but I'm not sure

any help would be much appreciated :)
Title: Re: *Scripting Thread*
Post by: Gurkha on February 03, 2017, 09:05:55 am
Scripters of NW, how scriptable are conquest flags.
Title: Re: *Scripting Thread*
Post by: Grozni on February 03, 2017, 10:43:17 am
Scripters of NW, how scriptable are conquest flags.

Very scriptable, down to smallest details.
Title: Re: *Scripting Thread*
Post by: DarthKiller on February 04, 2017, 04:23:00 pm
*Notice on everyone with Item Issues in NW

Search for:
(try_for_range,":item",all_items_begin,all_items_end),

and let it look at the end somehow like this:

Spoiler
(else_try),
          (lt,":item","itm_arty_horse_howitzer_french"),  #Artillery Horse for Cannon
          (item_set_slot,":item",slot_item_multiplayer_item_class, multi_item_class_type_horse_cannon),
        (else_try),
          (lt,":item","itm_gun1"),
          (item_set_slot,":item",slot_item_multiplayer_item_class, multi_item_class_type_horse_howitzer),
      (else_try),
         (lt,":item","itm_pistol1"),
         (item_set_slot,":item",slot_item_multiplayer_item_class2, multi_item_class_type_gun),
         (item_set_slot,":item",slot_item_multiplayer_item_class, multi_item_class_type_gun),
      (else_try),
         (lt,":item","itm_hat1"),
         (item_set_slot,":item",slot_item_multiplayer_item_class2, multi_item_class_type_pistol),
      (else_try),
         (lt,":item","itm_uniform1"),
         (item_set_slot,":item",slot_item_multiplayer_item_class, multi_item_class_type_hat),
      (else_try),
         (lt,":item","itm_boot1"),
         (item_set_slot,":item",slot_item_multiplayer_item_class, multi_item_class_type_uniform),
      (else_try),
         (lt,":item","itm_glove1"),
         (item_set_slot,":item",slot_item_multiplayer_item_class, multi_item_class_type_boot),
      (else_try),
         (lt,":item","itm_shotgunbullet"),
         (item_set_slot,":item",slot_item_multiplayer_item_class, multi_item_class_type_glove),
      (else_try),
         (lt,":item","itm_items_end"),
         (item_set_slot,":item",slot_item_multiplayer_item_class, multi_item_class_type_bullet),
         (item_set_slot,":item",slot_item_multiplayer_item_class2, multi_item_class_type_gun),
        (try_end),
[close]
Make sure that all those Items are in the right order that you add. And to correctly name them. You can add billions (not really) of items in between those new ones that will not mess-up your current build of items assigned.

Also watch out that you don't copy paste this 1:1 but insert it correctly.


Why:

Because the NW Module system adds items and assigns them to these classes to make sure you exactly get what the script thinks the troop is supposed to have.
Title: Re: *Scripting Thread*
Post by: Glenn. on February 05, 2017, 03:12:18 am
Does anyone know how or know someone who writes scripts for AZW, Such as a player/admin joining and leaving the server with their GUID's in the chat?
Title: Re: *Scripting Thread*
Post by: Gurkha on February 11, 2017, 09:29:34 pm
Scripters of NW, how scriptable are conquest flags.

Very scriptable, down to smallest details.

Can you point me to the right direction on where to start? :D
Title: Re: *Scripting Thread*
Post by: Futui_tuto on February 14, 2017, 10:46:07 am
Somebody know, how to do script, when on map will be spawn arms in random places?
Title: Re: *Scripting Thread*
Post by: Yebenoso on February 18, 2017, 10:44:36 pm
Hi guys! Is it possible to allow a troop to spawn both musket and pistol?
Title: Re: *Scripting Thread*
Post by: Grozni on February 20, 2017, 11:27:22 am
Scripters of NW, how scriptable are conquest flags.

Very scriptable, down to smallest details.

Can you point me to the right direction on where to start? :D

Main part of it is in module_mission_templates.py among multiplayer_hq mission template triggers, if you scroll down along that mission template you will find several triggers which obviously relate to flag situation. Constants used such as the minimum distance to a flag needed for capture are set in header_common.py . If you find any scripts are used, they are defined in module_scripts.py and presentations are in module_presentations.py  If you are making server-side only mod you will probably stay away from presentations and only write code inside blocks of code meant for server (multiplayer_is_dedicated_server, multiplayer_is_server and such)

Title: Re: *Scripting Thread*
Post by: Hockey on April 16, 2017, 01:16:19 am
Hello. Im looking for a script that only allows sailors and partizani to spawn with certain types of weapons. If nobody can do it for free I am willing to pay.
Title: Re: *Scripting Thread*
Post by: Flappywm on May 01, 2017, 10:27:04 am
How do i script "ze tresure chest." So when you hold F on it it gives you certain items/armour.?
Title: Re: *Scripting Thread*
Post by: DarthKiller on May 04, 2017, 02:43:28 am
SOLVED
Hello lads,
Today I developed a little script piece for my own automatic guns based off the "Star Wars - Bear Force II" modification. (This part does not really relate to my problem)
As you scripters can probably figure out, my script issues a reloading player (this is done along the code when the reloading animation equals the current player's animation) to walk when he does. But, infact it does not.

Foreword:
Yes, it is implemented in module_mission_templates.py,
Yes, I have added it to the common stuff place with a wonderful "," (it isn't the last one there),
Yes, I have initialized the slot_agent_is_reloading at the on_agent_spawn_common stuff with "0".


So, I'd like to know if any of you more experienced guys got a proper solution on my problem.

Another Note:
The loop itself works fine to determine whether it reloads or not, I found out by having errors beforehand with the agent ID being the Slot value so it printed me 0 when I wasn't reloading and 1 when I was. // Edit: This was random crap being produced, I realized the errors I did here..

Here is the mentioned script:
Spoiler
sw_check_animation_reload = (0.05, 0, 0, [],
[
   (multiplayer_get_my_player, ":my_player"),
    (player_is_active,":my_player"),
    (player_is_active,":my_player"),
    (neg|player_is_busy_with_menus, ":my_player"),
   (player_get_agent_id, ":my_agent", ":my_player"),
   (agent_is_active,":my_agent"),
   (agent_is_alive, ":my_agent"),
   (agent_get_slot, ":old_speed", ":my_agent", slot_agent_base_speed_mod),
   (try_begin),
      (agent_slot_eq, ":my_agent", slot_agent_is_reloading, 0),
      (agent_get_wielded_item, ":item", ":my_agent", 0),
      (ge, ":item", 0),
      (item_slot_ge, ":item", slot_item_ranged_type, 1),
      (item_get_slot, ":reload_animation", ":item", slot_item_reload_animation),
      (agent_get_animation, ":animation", ":my_agent", 1),
      (eq, ":animation", ":reload_animation"),
      (agent_set_speed_modifier, ":my_agent", 55),
      (agent_set_slot, ":my_agent", slot_agent_base_speed_mod, 55),
      (agent_set_slot, ":my_agent", slot_agent_is_reloading, 1),
   (else_try),
      (agent_slot_eq, ":my_agent", slot_agent_is_reloading, 1),
      (agent_get_wielded_item, ":item", ":my_agent", 0),
      (ge, ":item", 0),
      (item_slot_ge, ":item", slot_item_ranged_type, 1),
      (item_get_slot, ":reload_animation", ":item", slot_item_reload_animation),
      (agent_get_animation, ":animation", ":my_agent", 1),
      (neq, ":animation", ":reload_animation"),
      (agent_set_speed_modifier, ":my_agent", ":old_speed"),
      (agent_set_slot, ":my_agent", slot_agent_base_speed_mod, ":old_speed"),
      (agent_set_slot, ":my_agent", slot_agent_is_reloading, 0),
   (try_end),
])
[close]

I changed the script to the working version. Enjoy using or improving it for your own lusts
Title: Re: *Scripting Thread*
Post by: Aternox on October 14, 2017, 09:03:58 pm
Gentlemen,

I'm an amateur scripter and would like some help with my automated anti-delaying script as shown below

As you will work out, the requirements needed (should be) for the script to go ahead to the end:
The mission template is timed @ 15 seconds because it doesn't seem to need to be triggered very often

Spoiler
multiplayer_server_antidelay = (   
   15, 0, 0, [(this_or_next|multiplayer_is_server),
              (neg|game_in_multiplayer_mode),
              (eq, "$g_round_ended", 0),
           (store_mission_timer_a, reg0),
           (gt, reg0, 180),
              ],
       [                         
         (assign,":last_player_alive_team_1",-1),
         #(assign,":last_player_alive_team_2",-1),
         (assign,":num_players_team_1",0),
         #(assign,":num_players_team_2",0),
         (try_for_range, ":player_no", "$g_player_loops_begin", multiplayer_player_loops_end),
           (player_is_active, ":player_no"),
           (player_get_agent_id,":agent_id",":player_no"),
           (agent_is_active,":agent_id"),   
           (agent_is_alive,":agent_id"),                           
           (agent_get_team,":team",":agent_id"),
             (eq,":team",0),
             (assign,":last_player_alive_team_1",":player_no"),
             (val_add,":num_players_team_1",1),
         (try_end),
      
        (try_begin),      
       (neq,":num_players_team_1",1),
                 (assign,"$counter", 0),      
        (else_try),
       (eq,":num_players_team_1",1),      
       (assign, ":agent_is_ok",1),
       
      #(try_begin),
      (try_for_range, ":player_no", "$g_player_loops_begin", multiplayer_player_loops_end), #deadbegin
                 (player_is_active, ":player_no"),
                 (player_get_agent_id,":agent_id",":player_no"),
       (agent_is_active, ":agent_id"),   
                 (neg|agent_is_alive, ":agent_id"),           
                 (agent_get_team,":team",":agent_id"),
       (eq, ":team",0), #deadend there is a dead player on the team
       (assign,":agent_is_ok", 0),
      (try_end),
         (eq, ":agent_is_ok", 0),
         (val_add,"$counter",15),      
      
      (try_begin),
       (eq, "$counter", 30),
       (str_store_string, s2, "str_slay_message_1"), #personal warning msg for slay in 90 sec to prevent delay
            (multiplayer_send_string_to_player, ":last_player_alive_team_1",multiplayer_event_show_server_message, s2),
                (else_try),
       (ge, "$counter", 120),
                 (call_script, "script_multiplayer_server_slay_player", ":last_player_alive_team_1"),
       (str_store_player_username, s3,":last_player_alive_team_1"),
       (str_store_string, s4, "str_slay_message_2"), #server msg user has been slayed
       (call_script, "script_multiplayer_broadcast_message"),
           (try_end),
        #(try_end),   
       (try_end),      
        ])
[close]
Problem is: trigger at $counter = 30 happens (possibly before 3 mins into the round, can't remember from test) and $counter >= 120 (aka slay player) never happens. The strings I know will work fine and I'm guessing it needs a store_trigger_param for the slay or something. Would be much appreciated if someone could help fix it here!
Title: Re: *Scripting Thread*
Post by: Grozni on October 14, 2017, 10:07:01 pm
"The strings I know will work fine " did you mean to say the message string gets sent in >= 120 block? Or it doesn't work at all?

In case the problem is only in calling slay script, you can try it raw:

(first, declare the (assign, "agent_id", -1), before the player loop so you don't have a scope problem.)

(agent_set_hit_points, ":agent_id", 0, 1),
(agent_deliver_damage_to_agent, ":agent_id", ":agent_id","itm_admin_kill_dummy"), #kill him

(player_get_kill_count, ":player_kill_count", ":player_no"), #adding 1 to his kill count, because he will lose 1 undeserved kill count for TKing himself
(val_add, ":player_kill_count", 1),
(player_set_kill_count, ":player_no", ":player_kill_count"),

Title: Re: *Scripting Thread*
Post by: Aternox on October 15, 2017, 12:36:08 am
With the strings I mean I know they compiled properly (the game doesn't have a problem being not able to find the string)

I have tried this now but it's the same with the $counter 30 works with the string being sent but the >=120 does nothing

Spoiler
multiplayer_server_antidelay = (   
   15, 0, 0, [(this_or_next|multiplayer_is_server),
              (neg|game_in_multiplayer_mode),
              (eq, "$g_round_ended", 0),
           (store_mission_timer_a, reg0),
           (gt, reg0, 180),
              ],
       [                         
         (assign,":last_player_alive_team_1",-1),
         #(assign,":last_player_alive_team_2",-1),
         (assign,":num_players_team_1",0),
         #(assign,":num_players_team_2",0),
     (assign, ":agent_id", -1),
         (try_for_range, ":player_no", "$g_player_loops_begin", multiplayer_player_loops_end),
           (player_is_active, ":player_no"),
           (player_get_agent_id,":agent_id",":player_no"),
           (agent_is_active,":agent_id"),   
           (agent_is_alive,":agent_id"),                           
           (agent_get_team,":team",":agent_id"),
             (eq,":team",0),
             (assign,":last_player_alive_team_1",":player_no"),
             (val_add,":num_players_team_1",1),
         (try_end),
       
        (try_begin),       
       (neq,":num_players_team_1",1),
                 (assign,"$counter", 0),       
        (else_try),
       (eq,":num_players_team_1",1),       
       (assign, ":agent_is_ok",1),
       
               (try_for_range, ":player_no", "$g_player_loops_begin", multiplayer_player_loops_end), #deadbegin
                 (player_is_active, ":player_no"),
                 (player_get_agent_id,":agent_id",":player_no"),
                 (agent_is_active, ":agent_id"),   
                 (neg|agent_is_alive, ":agent_id"),           
                 (agent_get_team,":team",":agent_id"),
                 (eq, ":team",0), #deadend there is a dead player on the team
                 (assign,":agent_is_ok", 0),
              (try_end),
         (eq, ":agent_is_ok", 0),
         (val_add,"$counter",15),     
     
        (try_begin),
          (eq, "$counter", 30),
          (str_store_string, s2, "str_slay_message_1"), #personal warning msg for slay in 90 sec to prevent delay
          (multiplayer_send_string_to_player, ":last_player_alive_team_1",multiplayer_event_show_server_message, s2),
        (else_try),
         (ge, "$counter", 120),
         (player_get_agent_id,":agent_id",":last_player_alive_team_1"),
    (agent_set_hit_points, ":agent_id", 0, 1),
    (agent_deliver_damage_to_agent, ":agent_id", ":agent_id","itm_admin_kill_dummy"), #kill him
        #(call_script, "script_multiplayer_server_slay_player", ":last_player_alive_team_1"),
         (str_store_player_username, s3,":last_player_alive_team_1"),
         (str_store_string, s4, "str_slay_message_2"), #server msg user has been slayed
         (call_script, "script_multiplayer_broadcast_message"),
         (player_get_kill_count, ":player_kill_count", ":last_player_alive_team_1"), #adding 1 to his kill count, because he will lose 1 undeserved kill count for TKing himself
    (val_add, ":player_kill_count", 1),
    (player_set_kill_count, ":last_player_alive_team_1", ":player_kill_count"),
        (try_end),   
    (try_end),     
        ])
[close]
Title: Re: *Scripting Thread*
Post by: Grozni on October 15, 2017, 01:18:57 am
I don't think this will solve your problem but just so you know this is the proper way to get the round time passed, as store_mission_timer_a gets the time from the moment the map loads and doesn't reset when rounds end, and $g_round_start_time holds mission timer value it had when the current round started.

[(this_or_next|multiplayer_is_server),
           (neg|game_in_multiplayer_mode),
           (eq, "$g_round_ended", 0),
           (store_mission_timer_a, ":current_time"),
           (store_sub, ":round_seconds_passed", ":current_time", "$g_round_start_time"),
           (gt, ":round_seconds_passed", 180),
              ],

Your code looks like it should be working, try sprinkling it with debug message broadcasts to get a better idea of what is going on, what gets triggered and what not, what is the current value of $counter etc..

Title: Re: *Scripting Thread*
Post by: Aternox on October 15, 2017, 01:28:37 am
Thanks for the help,

the timer correction is great as well thanks, I have another script with a similar incorrect timer that I can fix too now

and yeah I'll make the script to broadcast the $counter value regularly, see if it's not reaching 120
Title: Re: *Scripting Thread*
Post by: 1steivn_cas on January 27, 2018, 04:50:58 pm
Hello, I need a server side script or something that changes the item the 'ze treasure' chest gives you

I have no idea how python stuff works so i'll just ask here if anyone can help.
Title: Re: *Scripting Thread*
Post by: Thunderstormer on January 28, 2018, 01:57:31 am
Nothing really too complicated about it.   just need to change 2 lines of code if you are changing what hat they give.

Spoiler
("ze_treasure",spr_use_time(4),"chest_b","bo_ze_treasure", [
    (ti_on_scene_prop_use,
    [
      (store_trigger_param_1, ":agent_id"),
      #(store_trigger_param_2, ":instance_id"),

      #(neg|scene_prop_slot_eq, ":instance_id", scene_prop_slot_just_fired, 1), # abuse just_fired for already used.
     
      (agent_is_active,":agent_id"),
      (agent_is_alive,":agent_id"),
     
      # remove his shit.
      #(try_for_range_backwards,":equipment_slot",0,4), # ,ek_item_0,ek_head),
      #  (agent_get_item_slot, ":item_id", ":agent_id", ":equipment_slot"),
       
      #  (gt,":item_id",-1), # even have a item there?
       
      #  (agent_unequip_item, ":agent_id", ":item_id", ":equipment_slot"),
      #(try_end),
      (try_begin),
        (agent_get_item_slot, ":item_id", ":agent_id", 4), #ek_head
        (gt,":item_id",-1), # even have a item there?
        (agent_unequip_item, ":agent_id", ":item_id", 4), #ek_head
      (try_end),
     
      # add ze goodies.
      (agent_equip_item,":agent_id","itm_pirate_hat"),
      #(agent_equip_item,":agent_id","itm_french_officer_pistol"),
      #(agent_equip_item,":agent_id","itm_pistol_ammo"),
      #(agent_equip_item,":agent_id","itm_spyglass"),
      #(agent_equip_item,":agent_id","itm_french_light_cav_off_sabre"),
     
      #(agent_set_wielded_item,":agent_id","itm_french_officer_pistol"),
     
      #(scene_prop_set_slot,":instance_id",scene_prop_slot_just_fired,1),
     
      (try_for_players, ":player_no", 1),
        (player_is_active, ":player_no"),
        (multiplayer_send_3_int_to_player, ":player_no", multiplayer_event_return_agent_set_item, ":agent_id", "itm_pirate_hat", 4),
      (try_end),
    ]),
  ]),
[close]
Title: Re: *Scripting Thread*
Post by: Soda_Lover on February 07, 2018, 08:55:42 pm
How does one make teleporting doors/hatches? I have never scripted before, only made maps, but never scripted so I need a thorough answer with how to do it.
Thanks!
Title: Re: *Scripting Thread*
Post by: Thunderstormer on February 07, 2018, 09:49:55 pm
How does one make teleporting doors/hatches? I have never scripted before, only made maps, but never scripted so I need a thorough answer with how to do it.
Thanks!
on my phone.  There are already teleporting doors in the game.  Go to the scene props py file and look at how's it's done.  Should be pretty straightforward.

In the hotfix I did make one change to them, and that is on the vertical doors.  You can see the change via a video in the blog thread.
Title: Re: *Scripting Thread*
Post by: Spoons on February 17, 2018, 12:46:13 pm
I need a little help with using game chat as a trigger to set a numeric variable, basically I would like to be able to type: /left 5  and /right 6   and have it set a global that I can then use later:

(try_begin),
(eq, "$g_left", 5),


(try_begin),
(eq, "$g_right", 6),

But only so admins can use it, so maybe just checking admin chat would be the easiest (would probably help if all players could see the change).

Title: Re: *Scripting Thread*
Post by: Grozni on February 17, 2018, 07:40:50 pm
What you want requires string parsing, and module system doesn't have such capabilities so you would have to send the string to a PHP page or similar web server side script and return the reponse with info on which variable is changing and what the new value is.

If you don't want to write web scripts you can use new custom keys ability. V, B and four directional keys can be sent from client to activate server script, where you can implement some sort of menu system and have, for example, set Left variable to 5 by tapping left key five times, or have a system which increases previously selected variable by pressing right and decreases by pressing left key.

You can search through new module system files for "custom_keys:" to gather pieces of how it all works, or wait until I write a tutorial about using those and other new stuff useful for server modders.

I need a little help with using game chat as a trigger to set a numeric variable, basically I would like to be able to type: /left 5  and /right 6   and have it set a global that I can then use later:

(try_begin),
(eq, "$g_left", 5),


(try_begin),
(eq, "$g_right", 6),

But only so admins can use it, so maybe just checking admin chat would be the easiest (would probably help if all players could see the change).
Title: Re: *Scripting Thread*
Post by: Spoons on February 17, 2018, 10:00:35 pm
What you want requires string parsing, and module system doesn't have such capabilities so you would have to send the string to a PHP page or similar web server side script and return the reponse with info on which variable is changing and what the new value is.

If you don't want to write web scripts you can use new custom keys ability. V, B and four directional keys can be sent from client to activate server script, where you can implement some sort of menu system and have, for example, set Left variable to 5 by tapping left key five times, or have a system which increases previously selected variable by pressing right and decreases by pressing left key.

You can search through new module system files for "custom_keys:" to gather pieces of how it all works, or wait until I write a tutorial about using those and other new stuff useful for server modders.

I need a little help with using game chat as a trigger to set a numeric variable, basically I would like to be able to type: /left 5  and /right 6   and have it set a global that I can then use later:

(try_begin),
(eq, "$g_left", 5),


(try_begin),
(eq, "$g_right", 6),

But only so admins can use it, so maybe just checking admin chat would be the easiest (would probably help if all players could see the change).

Thanks for the info :)
Title: Re: *Scripting Thread*
Post by: Mr.xexe on February 19, 2018, 08:57:21 am
I need a little help with using game chat as a trigger to set a numeric variable, basically I would like to be able to type: /left 5  and /right 6   and have it set a global that I can then use later:

(try_begin),
(eq, "$g_left", 5),


(try_begin),
(eq, "$g_right", 6),

But only so admins can use it, so maybe just checking admin chat would be the easiest (would probably help if all players could see the change).

You can use WSE https://forums.taleworlds.com/index.php/topic,324890.0.html
Title: Re: *Scripting Thread*
Post by: pete99 on April 07, 2018, 02:31:06 pm
I noticed with servers such as bot survival they make it so you can only join team 1. Does anyone know how to do this?
Title: Re: *Scripting Thread*
Post by: Thunderstormer on April 08, 2018, 12:32:39 pm
I noticed with servers such as bot survival they make it so you can only join team 1. Does anyone know how to do this?
just speculating, but they probably have a trigger firing every second assigning those who aren't spec or team 1 to team 1.  or found another way to do basically that. 
Title: Re: *Scripting Thread*
Post by: Lilja Mariasdóttir on April 08, 2018, 01:19:27 pm
I noticed with servers such as bot survival they make it so you can only join team 1. Does anyone know how to do this?
just speculating, but they probably have a trigger firing every second assigning those who aren't spec or team 1 to team 1.  or found another way to do basically that.
That would be extremely inefficient.
The server just says no, when the client is asking to go to team 2.
Title: Re: *Scripting Thread*
Post by: Thunderstormer on April 08, 2018, 01:29:14 pm
I noticed with servers such as bot survival they make it so you can only join team 1. Does anyone know how to do this?
just speculating, but they probably have a trigger firing every second assigning those who aren't spec or team 1 to team 1.  or found another way to do basically that.
That would be extremely inefficient.
The server just says no, when the client is asking to go to team 2.
there you go pete^^  I believe kanade makes the scripts for the server, so you can try and talk to him about that in more detail should he want to.
Title: Re: *Scripting Thread*
Post by: Lilja Mariasdóttir on April 08, 2018, 01:49:15 pm
One of many possibilities:

In Script: # script_multiplayer_server_process_client_team_selection
change this
Code
#condition checks are done
      (try_begin),
        #check if available
to this
Code
#condition checks are done
      (try_begin),
        #check if available
        (neq, ":value", 1),
Title: Re: *Scripting Thread*
Post by: pete99 on April 08, 2018, 10:21:07 pm
Thanks for your help ;)
Title: Re: *Scripting Thread*
Post by: Freestyler on April 13, 2018, 03:50:28 pm
1. does anyone have a molotow cocktail script?

2. Is it possible to integrate Molotov cocktail as a weapon in the admin tool?
Title: Re: *Scripting Thread*
Post by: Freedom on April 13, 2018, 05:25:34 pm
you either have to make one by yourself or pay someone that knows how,i doubt anyone will give it for free
Title: Re: *Scripting Thread*
Post by: tired on April 20, 2018, 03:48:16 pm
1. does anyone have a molotow cocktail script?

2. Is it possible to integrate Molotov cocktail as a weapon in the admin tool?

I already replied to your other post, yes I purchased a molotov script from Caesim, he gave me his source, then I scripted in the Admin Cheats menu instead of giving a holy hand grenade, it spawned an molotov instead.
Title: Re: *Scripting Thread*
Post by: Black-Banner on May 02, 2018, 12:02:52 am
Hey guys, starting a new mod for NW, I'm looking for some (at least semi) experienced M&B Python coders :). throw me a PM and have a nice day!
Title: Re: *Scripting Thread*
Post by: Koxxus on June 17, 2018, 09:45:01 pm
//delete
Title: Re: *Scripting Thread*
Post by: King_George on October 14, 2018, 03:30:04 pm
Is there a way to run a normal NW server, but use a script that changes everyone's ammo at the start?
you can limit the amount of ammo start with, yes.   you don't need a script to do it.  i believe someone even did it by just modifying the text files.

Could you point me to the .txt file that it is? To make people start with e.g. 5 cartridges if possible :S

I am quite a newbie in scripting and basically, don't know much about it but I'm a fast learner so any help is appreciated! :)

I'm looking for the following scripting if anyone's willing to help me/make them for me:

A script which makes it so you either shoot 5 rounds with a musket without having to reload it and then have to reload and it takes a while, OR you can reload fast. As I said I'm new to the modding scene I did ask for advice; Kanade Tachibana suggested to just boost up the reload speed from the officer, but again, still don't know how to do that either...
Title: Re: *Scripting Thread*
Post by: pete99 on October 21, 2018, 07:59:37 am

A script which makes it so you either shoot 5 rounds with a musket without having to reload it and then have to reload and it takes a while.

If you wanted it to be a client and server side mod this could be pretty easy, though i'm assuming you would probably just want it server side?

OR you can reload fast. As I said I'm new to the modding scene I did ask for advice; Kanade Tachibana suggested to just boost up the reload speed from the officer, but again, still don't know how to do that either...

You can pretty easily speed up the reload speed with the module system (even to the point of making it almost semi-automatic). So if you are willing to get into that, i'd recommend getting the module system. Other than that, maybe someone else can come up with a better answer than me...
Title: Re: *Scripting Thread*
Post by: King_George on October 21, 2018, 09:21:08 am

A script which makes it so you either shoot 5 rounds with a musket without having to reload it and then have to reload and it takes a while.

If you wanted it to be a client and server side mod this could be pretty easy, though i'm assuming you would probably just want it server side?

OR you can reload fast. As I said I'm new to the modding scene I did ask for advice; Kanade Tachibana suggested to just boost up the reload speed from the officer, but again, still don't know how to do that either...

You can pretty easily speed up the reload speed with the module system (even to the point of making it almost semi-automatic). So if you are willing to get into that, i'd recommend getting the module system. Other than that, maybe someone else can come up with a better answer than me...

Yeah, if possible server side.

For the module system, I'm sort of into it but not sure what to look for as I have no clue in programming... x)
Title: Re: *Scripting Thread*
Post by: pete99 on October 21, 2018, 12:28:54 pm
First up, look for header_operations.py, as this is literally like the dictionary for modding M&B. It has all the most important commands in it.

To do what you want to do, you want to go to module_mission_templates.py. The "module" files are the main ones you normally edit. So mission_teamplates is basically covering everything to do with missions, gamemodes, and most importantly triggers. You can check out header_triggers for some triggers you can use, but normally in mission templates you will see something like this:

(1, 0, 0, [],
       [

That is the beginning part of a trigger which fires every 1 second. I put together a quick version of what you probably want, though other people can correct it if i messed something up:

Spoiler
(ti_on_agent_spawn, 0, 0, [],              #Trigger fires every time an agent spawns. (Found in header_triggers).
       [
(multiplayer_is_server),                      #Is server
(try_for_players, ":player_no", 1),       #Loop through all players on the server
(player_get_agent_id, ":player_agent_id", ":player_no"), #Get player's agent id
(agent_is_active, ":player_agent_id"),
(agent_is_alive, ":player_agent_id"),    #Check the agent is alive
(agent_set_reload_speed_modifier, ":player_agent_id", 999), #Set reload speed (between 0-1000)
(try_end),
]),
[close]

All these commands are found in the header operations file. Anyway, all you have to do then is find the right place to put this piece of code. Look through the mission templates file using the find tool and you should find different gamemodes looking like this:
Spoiler
(
    "multiplayer_bt",mtf_battle_mode,-1, #battle mode
    "You lead your men to battle.",
    [
[close]
Thats the battle mode section.  Somewhere after this bit:
Spoiler
[
      common_battle_init_banner,

      multiplayer_server_check_polls,
      multiplayer_server_bonuses,
         multiplayer_server_auto_ff,
[close]
You'll see some triggers. Just splice your code in between one of those, compile the module, and you should be done. Then you just upload you mission_templates.txt file onto your server and it will work in battle mode.

....long reply i know...but hopefully it helps get you started. Check out some of the modding tutorials in these and the taleworlds forums on modding for other stuff. The are really helpful.
Title: Re: *Scripting Thread*
Post by: King_George on October 22, 2018, 09:54:58 pm
First up, look for header_operations.py, as this is literally like the dictionary for modding M&B. It has all the most important commands in it.

To do what you want to do, you want to go to module_mission_templates.py. The "module" files are the main ones you normally edit. So mission_teamplates is basically covering everything to do with missions, gamemodes, and most importantly triggers. You can check out header_triggers for some triggers you can use, but normally in mission templates you will see something like this:

(1, 0, 0, [],
       [

That is the beginning part of a trigger which fires every 1 second. I put together a quick version of what you probably want, though other people can correct it if i messed something up:

Spoiler
(ti_on_agent_spawn, 0, 0, [],              #Trigger fires every time an agent spawns. (Found in header_triggers).
       [
(multiplayer_is_server),                      #Is server
(try_for_players, ":player_no", 1),       #Loop through all players on the server
(player_get_agent_id, ":player_agent_id", ":player_no"), #Get player's agent id
(agent_is_active, ":player_agent_id"),
(agent_is_alive, ":player_agent_id"),    #Check the agent is alive
(agent_set_reload_speed_modifier, ":player_agent_id", 999), #Set reload speed (between 0-1000)
(try_end),
]),
[close]

All these commands are found in the header operations file. Anyway, all you have to do then is find the right place to put this piece of code. Look through the mission templates file using the find tool and you should find different gamemodes looking like this:
Spoiler
(
    "multiplayer_bt",mtf_battle_mode,-1, #battle mode
    "You lead your men to battle.",
    [
[close]
Thats the battle mode section.  Somewhere after this bit:
Spoiler
[
      common_battle_init_banner,

      multiplayer_server_check_polls,
      multiplayer_server_bonuses,
         multiplayer_server_auto_ff,
[close]
You'll see some triggers. Just splice your code in between one of those, compile the module, and you should be done. Then you just upload you mission_templates.txt file onto your server and it will work in battle mode.

....long reply i know...but hopefully it helps get you started. Check out some of the modding tutorials in these and the taleworlds forums on modding for other stuff. The are really helpful.
Thanks a lot, just now managed to test it and to see it actually works! YEY :D

I am, however, curious about more things if you'd be up for further discussions about following things

1) I'd like to set starting ammo; I've looked up the header_operations.py as you suggested and found the command agent_set_ammo so I'm guessing the command would go something among the lines of:

Spoiler
(try_begin),
(try_for_players, ":player_no", 1),       #Loop through all players on the server
(player_get_agent_id, ":player_agent_id", ":player_no"), #Get player's agent id
(agent_is_active, ":player_agent_id"),
(agent_is_alive, ":player_agent_id"),    #Check the agent is alive
(agent_set_ammo, ":player_agent_id", "10"),
(try_end),
[close]

Could you check if that is actually script like ok looking?

Now even if it is correct, I have no clue where to put it... Perhaps in Scripts but still don't know where in Scripts... :S  Oh the struggles...

2) The reload speed actually works in battle mode, but I need it for conquest mode and I tried a bit with using the same script but putting in somewhere after the #headquarters mode but there's a bit more triggers there so I'm a bit stuck :S
Title: Re: *Scripting Thread*
Post by: pete99 on October 23, 2018, 12:30:30 am
For headquarters mode it should be similar. Look for the section where you see triggers written such as this for an example:

(ti_on_agent_spawn, 0, 0, [],
       [
and splice your code somewhere in that section, though check not to put it before a ]),  as that would be interrupting another trigger script. I think the agent set ammo should work, though check that the "10" doesn't have "" around it, just have a plain 10. Other than that, place it in the mission templates file same way you did for the other one.

For this code though, you may want to change a few things, as i think every time an agent spawns it will give all the players 10 ammo...which you probably don't want. Again, if i'm wrong someone can correct me, but I think it should be something like this:

Spoiler
(ti_on_agent_spawn, 0, 0, [],              #Trigger fires every time an agent spawns. (Found in header_triggers).
       [
(multiplayer_is_server),                      #Is server
(store_trigger_param_1, ":player_agent_id"),  #This stores the specific spawned agent id.

(agent_is_active, ":player_agent_id"),
(agent_is_alive, ":player_agent_id"),    #Check the agent is alive
(agent_set_ammo, ":player_agent_id", 10),
(try_end),
]),
[close]

I think this should work, as it will only take effect on the recently spawned players...though probably best to test it on the server and see how it goes since i'm not 100%. Hope this helps.
Title: Re: *Scripting Thread*
Post by: King_George on October 23, 2018, 01:09:44 pm
For headquarters mode it should be similar. Look for the section where you see triggers written such as this for an example:

(ti_on_agent_spawn, 0, 0, [],
       [
and splice your code somewhere in that section, though check not to put it before a ]),  as that would be interrupting another trigger script. I think the agent set ammo should work, though check that the "10" doesn't have "" around it, just have a plain 10. Other than that, place it in the mission templates file same way you did for the other one.

For this code though, you may want to change a few things, as i think every time an agent spawns it will give all the players 10 ammo...which you probably don't want. Again, if i'm wrong someone can correct me, but I think it should be something like this:

Spoiler
(ti_on_agent_spawn, 0, 0, [],              #Trigger fires every time an agent spawns. (Found in header_triggers).
       [
(multiplayer_is_server),                      #Is server
(store_trigger_param_1, ":player_agent_id"),  #This stores the specific spawned agent id.

(agent_is_active, ":player_agent_id"),
(agent_is_alive, ":player_agent_id"),    #Check the agent is alive
(agent_set_ammo, ":player_agent_id", 10),
(try_end),
]),
[close]

I think this should work, as it will only take effect on the recently spawned players...though probably best to test it on the server and see how it goes since i'm not 100%. Hope this helps.

Everything went according to the grand plan except that I don't get 10 but still get 30 bullets... :S   

Maybe put -20 as value so I effectively get 10?... xD

EDIT: Putting -20 doesn't work :(
Title: Re: *Scripting Thread*
Post by: Lilja Mariasdóttir on October 23, 2018, 04:46:37 pm
header:
(agent_set_ammo,<agent_id>,<item_id>,<value>),

so instead of
(agent_set_ammo, ":player_agent_id", 10),

you write (only working for musket ammunition, for other ammunition add the wanted ammo (rockets, grenades, pistolammo ...):
(agent_set_ammo, ":player_agent_id", "itm_bullets", 10),
Title: Re: *Scripting Thread*
Post by: King_George on October 24, 2018, 10:51:07 pm
Spoiler
For headquarters mode it should be similar. Look for the section where you see triggers written such as this for an example:

(ti_on_agent_spawn, 0, 0, [],
       [
and splice your code somewhere in that section, though check not to put it before a ]),  as that would be interrupting another trigger script. I think the agent set ammo should work, though check that the "10" doesn't have "" around it, just have a plain 10. Other than that, place it in the mission templates file same way you did for the other one.

For this code though, you may want to change a few things, as i think every time an agent spawns it will give all the players 10 ammo...which you probably don't want. Again, if i'm wrong someone can correct me, but I think it should be something like this:

Spoiler
(ti_on_agent_spawn, 0, 0, [],              #Trigger fires every time an agent spawns. (Found in header_triggers).
       [
(multiplayer_is_server),                      #Is server
(store_trigger_param_1, ":player_agent_id"),  #This stores the specific spawned agent id.

(agent_is_active, ":player_agent_id"),
(agent_is_alive, ":player_agent_id"),    #Check the agent is alive
(agent_set_ammo, ":player_agent_id", 10),
(try_end),
]),
[close]

I think this should work, as it will only take effect on the recently spawned players...though probably best to test it on the server and see how it goes since i'm not 100%. Hope this helps.

header:
(agent_set_ammo,<agent_id>,<item_id>,<value>),

so instead of
(agent_set_ammo, ":player_agent_id", 10),

you write (only working for musket ammunition, for other ammunition add the wanted ammo (rockets, grenades, pistolammo ...):
(agent_set_ammo, ":player_agent_id", "itm_bullets", 10),
[close]

Well thanks to both, managed to fix it with the "itm_bullets" and now it works! :D
Title: Re: *Scripting Thread*
Post by: King_George on October 31, 2018, 03:44:28 pm
For headquarters mode it should be similar. Look for the section where you see triggers written such as this for an example:

(ti_on_agent_spawn, 0, 0, [],
       [
and splice your code somewhere in that section, though check not to put it before a ]),  as that would be interrupting another trigger script. I think the agent set ammo should work, though check that the "10" doesn't have "" around it, just have a plain 10. Other than that, place it in the mission templates file same way you did for the other one.

For this code though, you may want to change a few things, as i think every time an agent spawns it will give all the players 10 ammo...which you probably don't want. Again, if i'm wrong someone can correct me, but I think it should be something like this:

Spoiler
(ti_on_agent_spawn, 0, 0, [],              #Trigger fires every time an agent spawns. (Found in header_triggers).
       [
(multiplayer_is_server),                      #Is server
(store_trigger_param_1, ":player_agent_id"),  #This stores the specific spawned agent id.

(agent_is_active, ":player_agent_id"),
(agent_is_alive, ":player_agent_id"),    #Check the agent is alive
(agent_set_ammo, ":player_agent_id", 10),
(try_end),
]),
[close]

I think this should work, as it will only take effect on the recently spawned players...though probably best to test it on the server and see how it goes since i'm not 100%. Hope this helps.

Btw, if you want to invite for 33rd conquest event today with the scripts, feel free to add me on steam and we can figure something out ;)
Title: Re: *Scripting Thread*
Post by: Freestyler on November 07, 2018, 01:16:25 pm
Guys i am Interessted at Server Side skins (Script) can any Help me?
Title: Re: *Scripting Thread*
Post by: pete99 on November 11, 2018, 01:50:42 am
What exactly are you looking for? Actual new skins, or a way to give/equip current uniforms for players?
Title: Re: *Scripting Thread*
Post by: Freestyler on November 11, 2018, 11:02:46 pm
What exactly are you looking for? Actual new skins, or a way to give/equip current uniforms for players?
a method/Script for Server Side skins (no skins)
Title: Re: *Scripting Thread*
Post by: pete99 on November 12, 2018, 12:21:40 am
I have a method using the new custom menu option if you are interested? Basically just press a key and it brings up a menu of uniforms/items you can equip.
Title: Re: *Scripting Thread*
Post by: Freestyler on November 12, 2018, 06:18:27 am
I have a method using the new custom menu option if you are interested? Basically just press a key and it brings up a menu of uniforms/items you can equip.
yes Interessted but it is possible to Change Uniforms  in the Script?
Title: Re: *Scripting Thread*
Post by: pete99 on November 12, 2018, 11:00:43 am
Yes you can change to whatever uniforms I have listed there. I have quite a few added (not all the uniforms as that would be a lot) but quite a lot of them. Here's a couple of screenshots to give you an idea of what I've done:

Press a button and menu comes up.
Spoiler
(https://i.imgur.com/E6Kdazt.jpg)
[close]
Press number for clothes tab.
Spoiler
(https://i.imgur.com/K4wtrmN.jpg)
[close]
Can click into hats, torso or legs sections.
Spoiler
(https://i.imgur.com/YJuVDyz.jpg)
[close]
Select the item you want to equip yourself with and you're done.
Spoiler
(https://i.imgur.com/KQCSqxl.jpg)
[close]
Title: Re: *Scripting Thread*
Post by: tired on December 11, 2018, 03:55:17 pm
Hey I wanted to let a head admin be able to also kick other admins. Here's what I found with the ban admin code



(else_try),
            (eq, ":event_type", multiplayer_event_admin_kick_player),
            (try_begin),
              (store_script_param, ":value", 3),
              (player_is_active, ":value"),
              #condition checks are done
             
              # Vincenzo begin
              (neg|player_is_admin, ":value"),
             
              (str_store_player_username, s2, ":player_no"), # adminname
              (str_store_player_username, s3, ":value"),
              (str_store_string, s4, "str_kick_player_s2_s3"),
              (call_script, "script_multiplayer_broadcast_message"),
              # Vincenzo end
             
              (kick_player, ":value"),
            (try_end),
          (else_try),
            (eq, ":event_type", multiplayer_event_admin_ban_player),
            (try_begin),
              (store_script_param, ":value", 3),
              #validity check
              (player_is_active, ":value"),
                     (try_begin),
                (player_get_unique_id, ":value_id", ":value"),
                (gt,":value_id", 1), # Key auth server problem protection (id 1 if wrong)
              #condition checks are done
              (try_begin),  # unmark the lines from here down to try end.   you dont need all of the lines.  feel free to only unmark as many lines as you need for admin ids.   you can add more IDs. 
                      (player_is_admin, ":value"), #lets not run the code below if player being banned is not an admin, as it would be pointless
                (player_get_unique_id, ":player_id", ":player_no"),#get their ID
                (this_or_next|eq, ":player_id", 1111111), # only these admins can ban other admins.  # 1
                (this_or_next|eq, ":player_id", 1111111),  # 2
                (eq, ":player_id", 1111111),#always make sure the last/only id you want to be able to ban admins is just eq, not this or next eq. # 3
               
                (neq, ":value_id", 1111111), # you will want to put the IDs of admins here that you dont want banned when their name is clicked.  hint, you can ban youself if you dont add your ID here
                (neq, ":value_id", 1111111), #  if an admin not approved above will not be able to ban admins.   there should be no message saying someone was banned when no one was. 
                (neq, ":value_id", 111111),
                (player_set_is_admin, ":value", 0),
             (try_end),
              (neg|player_is_admin, ":value"),
              (str_store_player_username, s2, ":player_no"), # adminname
              (str_store_player_username, s3, ":value"),
              (str_store_string, s4, "str_ban_player_s2_s3"),
              (call_script, "script_multiplayer_broadcast_message"),
             
              (ban_player, ":value", 0, ":player_no"),
              (else_try),
                (kick_player, ":value"),
              (try_end),
            (try_end),




I'm not sure exactly what to add or change to let admins kick another admin. I tried adding some code but it didn't work.
Title: Re: *Scripting Thread*
Post by: Grozni on December 11, 2018, 04:18:01 pm
That part of code is thoroughly commented and you just have to read what the comments say.

player_id is ID of player who is attempting to ban, value_id is ID of player who player_id is trying to ban.

Replace 1111111s with game IDs (the IDs shown when someone joins the server):

 - Where it says # only these admins can ban other admins.  you replace 1111111s with IDs of admin who can ban other admins.
 - Few lines below (where value_id is compared) you do the same for admins who can't be banned

You just add or remove lines depending on how many main or unbanable admins you have, while keeping in mind this_or_next, if you are not sure how this_or_next work look it up.

You can try to copy those tests into kick event as well, but that makes no sense, if it comes to that (main admin kicking lesser admin) you will want to use ban instead.
Title: Re: *Scripting Thread*
Post by: Ivkolya on December 11, 2018, 09:09:49 pm
Hello all, I'm trying to disable bots spawning as cavalry units on certain maps of team deathmatch mode. In siege mode in NW there is working restriction for bots spawning as cavalry, at least in defending team, but I didn't find script for that. Maybe someone can point me where it is? I think it can be a start for disabling AI cavalry in other modes

Also I've noticed that on my new scene attacking team has no horses (but all bots are of the same unit), and defending team has cavalry, which is strange

I created new topic, but maybe here someone will see and help me (and, I guess, help many other modders), so sorry for double-posting.

I made many attempts to find a solution. I was advised to look into this module_mission_templates code,

Spoiler
Code
      (call_script, "script_multiplayer_find_bot_troop_and_group_for_spawn", ":selected_team", ":look_only_actives"),
      (assign, ":selected_troop", reg0),
      (assign, ":selected_group", reg1),

      (team_get_faction, ":team_faction", ":selected_team"),
      (assign, ":num_ai_troops", 0),
      (try_for_range, ":cur_ai_troop", multiplayer_ai_troops_begin, multiplayer_ai_troops_end),
        (store_troop_faction, ":ai_troop_faction", ":cur_ai_troop"),
        (eq, ":ai_troop_faction", ":team_faction"),
        (val_add, ":num_ai_troops", 1),
      (try_end),
[close]

As I think, disable cavalry for certain scenes could be made by adding list of scenes as condition and excluding cavalry units from available for spawning after oriiginal line

Code
	   (try_for_range, ":cur_ai_troop", multiplayer_ai_troops_begin, multiplayer_ai_troops_end),

First of all I tried to add lines like (neg|troop_is_guarantee_horse, ":cur_ai_troop") or (neg|troop_select_type_cavalry, ":cur_ai_troop") and couple of other variants, but they didn't work, bots were dead in list of players.

In the end I changed module_constants (added infantry of all factions) after multiplayer_ai_troops_end (as this variable is referenced in original script)

Spoiler
Code
multiplayer_ai_troops_begin = "trp_british_infantry_ai"
multiplayer_ai_troops_end = multiplayer_troops_begin

multiplayer_ai_british_infantry_begin = "trp_british_infantry_ai"
multiplayer_ai_british_infantry_end = "trp_british_hussar_ai"

multiplayer_ai_french_infantry_begin = "trp_french_infantry_ai"
multiplayer_ai_french_infantry_end = "trp_french_hussar_ai"

multiplayer_ai_prussian_infantry_begin = "trp_prussian_infantry_ai"
multiplayer_ai_prussian_infantry_end = "trp_prussian_dragoon_ai"

multiplayer_ai_russian_infantry_begin = "trp_russian_foot_guard_ai"
multiplayer_ai_russian_infantry_end = "trp_russian_hussar_ai"

multiplayer_ai_austrian_infantry_begin = "trp_austrian_infantry_ai"
multiplayer_ai_austrian_infantry_end = "trp_austrian_hussar_ai"

multiplayer_ai_rhine_infantry_begin = "trp_rhine_infantry_bavaria_ai"
multiplayer_ai_rhine_infantry_end = "trp_rhine_mounted_jaeger_ai"
[close]

So my code looks like this now

Code
      (call_script, "script_multiplayer_find_bot_troop_and_group_for_spawn", ":selected_team", ":look_only_actives"),
      (assign, ":selected_troop", reg0),
      (assign, ":selected_group", reg1),

      (team_get_faction, ":team_faction", ":selected_team"),
      (assign, ":num_ai_troops", 0),
  (store_current_scene, ":cur_scene"),
      (try_begin),
   (eq, ":cur_scene", "scn_assault_on_malakoff_test"),
   (eq, "$g_multiplayer_game_type", multiplayer_game_type_team_deathmatch),
           (try_for_range, ":cur_ai_troop", multiplayer_ai_british_infantry_begin, multiplayer_ai_british_infantry_end),
           (try_for_range, ":cur_ai_troop", multiplayer_ai_french_infantry_begin, multiplayer_ai_french_infantry_end),
           (try_for_range, ":cur_ai_troop", multiplayer_ai_russian_infantry_begin, multiplayer_ai_russian_infantry_end),
           (try_for_range, ":cur_ai_troop", multiplayer_ai_prussian_infantry_begin, multiplayer_ai_prussian_infantry_end),
           (try_for_range, ":cur_ai_troop", multiplayer_ai_austrian_infantry_begin, multiplayer_ai_austrian_infantry_end),
           (try_for_range, ":cur_ai_troop", multiplayer_ai_rhine_infantry_begin, multiplayer_ai_rhine_infantry_end),
     (store_troop_faction, ":ai_troop_faction", ":cur_ai_troop"),
             (eq, ":ai_troop_faction", ":team_faction"),
             (val_add, ":num_ai_troops", 1),
  (try_end),
 
      (else_try),
   (try_for_range, ":cur_ai_troop", multiplayer_ai_troops_begin, multiplayer_ai_troops_end),
             (store_troop_faction, ":ai_troop_faction", ":cur_ai_troop"),
             (eq, ":ai_troop_faction", ":team_faction"),
             (val_add, ":num_ai_troops", 1),
      (try_end),

But bots are dead when I start team deathmach with bots.
And maybe I wrote something wrong? Maybe overall it's the right way, but I just wrote something wrong?
I really hope someone will help me.
Title: Re: *Scripting Thread*
Post by: Bloody Bayonet Gaming on December 11, 2018, 11:25:42 pm
That part of code is thoroughly commented and you just have to read what the comments say.

player_id is ID of player who is attempting to ban, value_id is ID of player who player_id is trying to ban.

Replace 1111111s with game IDs (the IDs shown when someone joins the server):

 - Where it says # only these admins can ban other admins.  you replace 1111111s with IDs of admin who can ban other admins.
 - Few lines below (where value_id is compared) you do the same for admins who can't be banned

You just add or remove lines depending on how many main or unbanable admins you have, while keeping in mind this_or_next, if you are not sure how this_or_next work look it up.

You can try to copy those tests into kick event as well, but that makes no sense, if it comes to that (main admin kicking lesser admin) you will want to use ban instead.
No I got the ban part working, I just wanted kicks to work too, because in reality I can just ban an admin from the control panel and restart server pretty quickly if something really warranted it. Just want help with kicking. I tried copying the code into the kick section but had errors with admin working properly

Sent from my SM-G930VC using Tapatalk
Title: Re: *Scripting Thread*
Post by: Swordsman on December 17, 2018, 01:31:02 am
Hello, i have a question, if someone can help me. I wan to give the player via ze_treasure vodka bottle only in server side, i know how to do that and its working, but i want to give the player like 30 bottles like the holy hand grenade.

I try to replace in modules items the config of bottle but doesnt work, any idea?
Title: Re: *Scripting Thread*
Post by: pete99 on December 17, 2018, 04:11:49 am
Sadly I don't think you can change things like that in the items file server side, unless the client player has the same mod installed. If i'm wrong someone can correct me, but I don't think it syncs properly with the player. When they have used up their four bottles the server will be telling them they have more, while their own game tells them they have no more, resulting in it glitching out and not working.
Title: Re: *Scripting Thread*
Post by: Swordsman on December 17, 2018, 11:56:21 am
Sadly I don't think you can change things like that in the items file server side, unless the client player has the same mod installed. If i'm wrong someone can correct me, but I don't think it syncs properly with the player. When they have used up their four bottles the server will be telling them they have more, while their own game tells them they have no more, resulting in it glitching out and not working.

Thanks for the reply, as you said it doesnt work. I was testing and if i change my own itemkinds1.txt it works correctly. I have another question, i see that it is possible to change for expample a hat when you enter a server, how does it work?
Title: Re: *Scripting Thread*
Post by: pete99 on December 17, 2018, 12:17:44 pm
If you mean, changing parts of your uniform and so on, there’s a lot of different ways you can go about this. You could just change the type of clothes a troop type is equipped with, in module_troops, which is an easy way. Otherwise you could look into equipping items and clothes types.

You could just create a trigger, say whenever a player spawns which could equip them with a different uniform.

Otherwise, a little more complex, in NW now they have the option to do something like this at the push  of a button. If you look up a few posts in this thread you can see a couple of screenshots of the sort of thing I did. ^

Title: Re: *Scripting Thread*
Post by: Swordsman on December 17, 2018, 12:20:23 pm
Well lets say that i want to change the hat when a player enter the server. Player choose a troop and it change the hat to a santa hat for example. I see your screens, look so cool.
Title: Re: *Scripting Thread*
Post by: pete99 on December 17, 2018, 12:44:56 pm
In that case, yes you would probably want to set a trigger in mission templates for every time a player spawns, which uneuips their hat and equips another one. If you want a really good example of how to do this take a look at Ze_treasure scene prop in module scene props, which equips a pirate hat.

Keep in mind though, it would have to be an item already in the game. If you actually wanted to see say a Santa hat (not one of the standard items)  you would need it on server and client side XD.
Title: Re: *Scripting Thread*
Post by: Swordsman on December 17, 2018, 03:02:12 pm
Hello again, thanks for the info. I change the spawn in mission templates for team deathmatch with this, i see that the troop_clear_inventory dont work, dont know if there is another way to unequip all items when spawn.

Code
      (ti_on_agent_spawn, 0, 0, [],
       [
         (store_trigger_param_1, ":agent_no"),
         (call_script, "script_multiplayer_server_on_agent_spawn_common", ":agent_no"),

         (troop_clear_inventory, "$g_player_troop"),
   
         (try_begin),
             (agent_get_item_slot, ":item_id", ":agent_no", 4), #ek_head
             (gt,":item_id",-1), # even have a item there?
             (agent_unequip_item, ":agent_no", ":item_id", 4), #ek_head
         (try_end),
     
         (agent_equip_item,":agent_no","itm_grenade"),
       
         (agent_equip_item,":agent_no","itm_pirate_hat"),
         
         (agent_set_wielded_item,":agent_no","itm_grenade",0),

         ]),

But now im getting some kind of error in my server. "Incorrect skeleton type for anim 143 Error: Incorrect skeleton type for anim 143" and the server crash.

EDIT: I was looking and the animation 143 is this. anim_equip_default = 143

Title: Re: *Scripting Thread*
Post by: Lilja Mariasdóttir on December 17, 2018, 03:16:33 pm

But now im getting some kind of error in my server. "Incorrect skeleton type for anim 143 Error: Incorrect skeleton type for anim 143" and the server crash.

EDIT: I was looking and the animation 143 is this. anim_equip_default = 143
That is a common mistake. You try to equip an item to a horse, and that will lead to a crash. You need to exclude horses from equipping stuff.
(agent_is_human, ":agent_no"),
Title: Re: *Scripting Thread*
Post by: Grozni on December 17, 2018, 04:25:39 pm
Code
 
 (troop_clear_inventory, "$g_player_troop"),

This is another mistake, tho more of an unneeded line than an error, $g_player_troop is a local variable used only by client. Also you are working with agents, not troops. Troops are templates on which agents are based.

You just have to remove agent's hat and replace it, look at treasure chest code in module_scene_props
Title: Re: *Scripting Thread*
Post by: Swordsman on December 17, 2018, 10:44:29 pm
Hello again, thanks for the replys, i've made some change, but im not sure where to set the (agent_is_human, ":agent_no"),. The question is that i want when players enter my server they have a santa hat in all troops they choose(this is working now), and they have grenades equiped as only object, so i wanna unequip default items of agents. May i have 4 unequip "try" like the code or can i have it in one only?

Code
      (ti_on_agent_spawn, 0, 0, [],
       [
         (store_trigger_param_1, ":agent_no"),
         (agent_is_human, ":agent_no"),
         (call_script, "script_multiplayer_server_on_agent_spawn_common", ":agent_no"),
   
         (try_begin),
             (agent_get_item_slot, ":item_id", ":agent_no", 4), #ek_head
             (gt,":item_id",-1), # even have a item there?
             (agent_unequip_item, ":agent_no", ":item_id", 4),#ek_head
         (try_end),

         (try_begin),
             (agent_get_item_slot, ":item_id", ":agent_no", 0),
             (gt,":item_id",-1), # even have a item there?
             (agent_unequip_item, ":agent_no", ":item_id", 0),
         (try_end),

         
         
         (agent_equip_item,":agent_no","itm_grenade", 0),
         
         (agent_equip_item,":agent_no","itm_pirate_hat"),
         
         (agent_set_wielded_item,":agent_no","itm_grenade",0),

         ]),
Title: Re: *Scripting Thread*
Post by: pete99 on December 17, 2018, 11:12:38 pm
First up, I think for equiping the hat (that is server side) in order for all the players to see the change you will also have to do a "try_for_players" operation and add this:

(multiplayer_send_3_int_to_player, ":player_no", multiplayer_event_return_agent_set_item, ":player_agent", "itm_pirate_hat", 4),


As for unequiping all items, I think you can pretty much just keep doing what you have there, just with a different slot each time:

(try_begin),
             (agent_get_item_slot, ":item_id", ":agent_no", 0),
             (gt,":item_id",-1), # even have a item there?
             (agent_unequip_item, ":agent_no", ":item_id", 0),
         (try_end),

Otherwise you could also do a loop through all player's items:

(try_for_range,":item",0,234),
(is_between, ":item", "itm_no_item", "itm_french_voltigeur_body_officer"),

(agent_unequip_item, ":agent_no", ":item"),

And that should unequip all items (except clothing).
Hope this helps


Title: Re: *Scripting Thread*
Post by: Grozni on December 18, 2018, 12:52:56 am
If you're not sure what you are doing, the best way to not mess up in regard to whether the code will run on the server and update all clients or not is by editing the multiplayer_server_on_agent_spawn_common script itself. You don't need to do sending of ints as pete99 suggested, simply doing the agent_equip_item will update all clients (assuming you removed old item with agent_unequip_item).

Take a good look at the multiplayer_server_on_agent_spawn_common  script, it has all the clues you need to come up with all sorts of agent modification upon spawning.

As for where to put your stuff, just add your own try block somewhere under these lines:
     (try_begin),
       (this_or_next|multiplayer_is_server), # only on servers.
       (neg|game_in_multiplayer_mode),
       #new code you will add:
        (try_begin),
             #your new stuff
        (try_end),
        #you have made separate try block so the rest of the code below will continue to run as normal

In your try block check for if agent_is_human as in is it not a horse, and perhaps neg|agent_is_non_player if you don't want that to happen for bots as well, then call other scripts to check for troop and rank if that matters, you will find an example few lines below.

As for what to put there, really just look at the treasure chest code, it does exactly what you want (replaces head gear).

Title: Re: *Scripting Thread*
Post by: Ivkolya on December 18, 2018, 03:03:12 pm
Spoiler
Hello all, I'm trying to disable bots spawning as cavalry units on certain maps of team deathmatch mode. In siege mode in NW there is working restriction for bots spawning as cavalry, at least in defending team, but I didn't find script for that. Maybe someone can point me where it is? I think it can be a start for disabling AI cavalry in other modes

Also I've noticed that on my new scene attacking team has no horses (but all bots are of the same unit), and defending team has cavalry, which is strange

I created new topic, but maybe here someone will see and help me (and, I guess, help many other modders), so sorry for double-posting.

I made many attempts to find a solution. I was advised to look into this module_mission_templates code,

Spoiler
Code
      (call_script, "script_multiplayer_find_bot_troop_and_group_for_spawn", ":selected_team", ":look_only_actives"),
      (assign, ":selected_troop", reg0),
      (assign, ":selected_group", reg1),

      (team_get_faction, ":team_faction", ":selected_team"),
      (assign, ":num_ai_troops", 0),
      (try_for_range, ":cur_ai_troop", multiplayer_ai_troops_begin, multiplayer_ai_troops_end),
        (store_troop_faction, ":ai_troop_faction", ":cur_ai_troop"),
        (eq, ":ai_troop_faction", ":team_faction"),
        (val_add, ":num_ai_troops", 1),
      (try_end),
[close]

As I think, disable cavalry for certain scenes could be made by adding list of scenes as condition and excluding cavalry units from available for spawning after oriiginal line

Code
	   (try_for_range, ":cur_ai_troop", multiplayer_ai_troops_begin, multiplayer_ai_troops_end),

First of all I tried to add lines like (neg|troop_is_guarantee_horse, ":cur_ai_troop") or (neg|troop_select_type_cavalry, ":cur_ai_troop") and couple of other variants, but they didn't work, bots were dead in list of players.

In the end I changed module_constants (added infantry of all factions) after multiplayer_ai_troops_end (as this variable is referenced in original script)

Spoiler
Code
multiplayer_ai_troops_begin = "trp_british_infantry_ai"
multiplayer_ai_troops_end = multiplayer_troops_begin

multiplayer_ai_british_infantry_begin = "trp_british_infantry_ai"
multiplayer_ai_british_infantry_end = "trp_british_hussar_ai"

multiplayer_ai_french_infantry_begin = "trp_french_infantry_ai"
multiplayer_ai_french_infantry_end = "trp_french_hussar_ai"

multiplayer_ai_prussian_infantry_begin = "trp_prussian_infantry_ai"
multiplayer_ai_prussian_infantry_end = "trp_prussian_dragoon_ai"

multiplayer_ai_russian_infantry_begin = "trp_russian_foot_guard_ai"
multiplayer_ai_russian_infantry_end = "trp_russian_hussar_ai"

multiplayer_ai_austrian_infantry_begin = "trp_austrian_infantry_ai"
multiplayer_ai_austrian_infantry_end = "trp_austrian_hussar_ai"

multiplayer_ai_rhine_infantry_begin = "trp_rhine_infantry_bavaria_ai"
multiplayer_ai_rhine_infantry_end = "trp_rhine_mounted_jaeger_ai"
[close]

So my code looks like this now

Code
      (call_script, "script_multiplayer_find_bot_troop_and_group_for_spawn", ":selected_team", ":look_only_actives"),
      (assign, ":selected_troop", reg0),
      (assign, ":selected_group", reg1),

      (team_get_faction, ":team_faction", ":selected_team"),
      (assign, ":num_ai_troops", 0),
  (store_current_scene, ":cur_scene"),
      (try_begin),
   (eq, ":cur_scene", "scn_assault_on_malakoff_test"),
   (eq, "$g_multiplayer_game_type", multiplayer_game_type_team_deathmatch),
           (try_for_range, ":cur_ai_troop", multiplayer_ai_british_infantry_begin, multiplayer_ai_british_infantry_end),
           (try_for_range, ":cur_ai_troop", multiplayer_ai_french_infantry_begin, multiplayer_ai_french_infantry_end),
           (try_for_range, ":cur_ai_troop", multiplayer_ai_russian_infantry_begin, multiplayer_ai_russian_infantry_end),
           (try_for_range, ":cur_ai_troop", multiplayer_ai_prussian_infantry_begin, multiplayer_ai_prussian_infantry_end),
           (try_for_range, ":cur_ai_troop", multiplayer_ai_austrian_infantry_begin, multiplayer_ai_austrian_infantry_end),
           (try_for_range, ":cur_ai_troop", multiplayer_ai_rhine_infantry_begin, multiplayer_ai_rhine_infantry_end),
     (store_troop_faction, ":ai_troop_faction", ":cur_ai_troop"),
             (eq, ":ai_troop_faction", ":team_faction"),
             (val_add, ":num_ai_troops", 1),
  (try_end),
 
      (else_try),
   (try_for_range, ":cur_ai_troop", multiplayer_ai_troops_begin, multiplayer_ai_troops_end),
             (store_troop_faction, ":ai_troop_faction", ":cur_ai_troop"),
             (eq, ":ai_troop_faction", ":team_faction"),
             (val_add, ":num_ai_troops", 1),
      (try_end),

But bots are dead when I start team deathmach with bots.
And maybe I wrote something wrong? Maybe overall it's the right way, but I just wrote something wrong?
I really hope someone will help me.

[close]

Bumping this question. How to disable cavalry bots fof team deathmatch?
Again, in siege mode in NW there are no cavalry bots, at least in one team, so cavalry bots definately can be disabled for other gamemodes.
Title: Re: *Scripting Thread*
Post by: Grozni on December 18, 2018, 03:43:49 pm
Scrap all the changes you made.

In script multiplayer_find_bot_troop_and_group_for_spawn find the line (store_random_in_range, ":random_troop_index", 0, ":available_troops_to_spawn"), and replace with your own logic (if team deathmach game mode, otherwise let the old line run instead). You'll want to think of a way to randomize resulting bot type while excluding cavalry bots.

Another way would be to look at my previous answer and modify bots upon spawning.
Title: Re: *Scripting Thread*
Post by: Grozni on December 18, 2018, 03:59:36 pm
Actually I think you're better off altering the available_troops_to_spawn variable defined above. Like, stop adding to it after the number of infantry regiments for that faction has been reached. For start you can try just setting the available_troops_to_spawn to 1 or something to test this out, it should spawn only first two types of infantry.
Title: Re: *Scripting Thread*
Post by: Ivkolya on December 18, 2018, 09:58:59 pm
Thank you, I see the logic here, I will try it
Title: Re: *Scripting Thread*
Post by: Ivkolya on December 18, 2018, 10:56:37 pm
Finally!

Thank you very much, Grozni!

So I've managed to alter available bots for team deathmatch mode and for specific map.  Here's the code, I guess there is simplier way than alter whole script, but it works. I simply excluded units with flag tf_mounted from available bots.

Spoiler
Code
  # script_multiplayer_find_bot_troop_and_group_for_spawn
  # Input: arg1 = team_no
  # Output: reg0 = troop_id, reg1 = group_id
  ("multiplayer_find_bot_troop_and_group_for_spawn",
    [
      (store_script_param, ":team_no", 1),
      (store_script_param, ":look_only_actives", 2),

      (call_script, "script_multiplayer_find_player_leader_for_bot", ":team_no", ":look_only_actives"),
      (assign, ":leader_player", reg0),

      (assign, ":available_troops_in_faction", 0),
      (assign, ":available_troops_to_spawn", 0),
      (team_get_faction, ":team_faction_no", ":team_no"),
      (store_current_scene, ":cur_scene"),

      (try_begin),
    (eq, ":cur_scene", "scn_assault_on_malakoff_test"),
    (eq, "$g_multiplayer_game_type", multiplayer_game_type_team_deathmatch),
(try_for_range, ":troop_no", multiplayer_ai_troops_begin, multiplayer_ai_troops_end),
          (neg|tf_mounted, ":troop_no"),
          (store_troop_faction, ":troop_faction", ":troop_no"),
          (eq, ":troop_faction", ":team_faction_no"),
          (store_add, ":wanted_slot", slot_player_bot_type_1_wanted, ":available_troops_in_faction"),
          (val_add, ":available_troops_in_faction", 1),
          (try_begin),
            (this_or_next|lt, ":leader_player", 0),
            (player_slot_ge, ":leader_player", ":wanted_slot", 1),
            (val_add, ":available_troops_to_spawn", 1),
          (try_end),
        (try_end),

        (assign, ":available_troops_in_faction", 0),

        (store_random_in_range, ":random_troop_index", 0, ":available_troops_to_spawn"),
        (assign, ":end_cond", multiplayer_ai_troops_end),
        (try_for_range, ":troop_no", multiplayer_ai_troops_begin, ":end_cond"),
          (store_troop_faction, ":troop_faction", ":troop_no"),
          (eq, ":troop_faction", ":team_faction_no"),
          (store_add, ":wanted_slot", slot_player_bot_type_1_wanted, ":available_troops_in_faction"),
          (val_add, ":available_troops_in_faction", 1),
          (this_or_next|lt, ":leader_player", 0),
          (player_slot_ge, ":leader_player", ":wanted_slot", 1),
          (val_sub, ":random_troop_index", 1),
          (lt, ":random_troop_index", 0),
          (assign, ":end_cond", 0),
          (assign, ":selected_troop", ":troop_no"),
        (try_end),
        (assign, reg0, ":selected_troop"),
        (assign, reg1, ":leader_player"),

      (else_try),
    (try_for_range, ":troop_no", multiplayer_ai_troops_begin, multiplayer_ai_troops_end),
          (store_troop_faction, ":troop_faction", ":troop_no"),
          (eq, ":troop_faction", ":team_faction_no"),
          (store_add, ":wanted_slot", slot_player_bot_type_1_wanted, ":available_troops_in_faction"),
          (val_add, ":available_troops_in_faction", 1),
          (try_begin),
            (this_or_next|lt, ":leader_player", 0),
            (player_slot_ge, ":leader_player", ":wanted_slot", 1),
            (val_add, ":available_troops_to_spawn", 1),
          (try_end),
        (try_end),

        (assign, ":available_troops_in_faction", 0),

        (store_random_in_range, ":random_troop_index", 0, ":available_troops_to_spawn"),
        (assign, ":end_cond", multiplayer_ai_troops_end),
        (try_for_range, ":troop_no", multiplayer_ai_troops_begin, ":end_cond"),
          (store_troop_faction, ":troop_faction", ":troop_no"),
          (eq, ":troop_faction", ":team_faction_no"),
          (store_add, ":wanted_slot", slot_player_bot_type_1_wanted, ":available_troops_in_faction"),
          (val_add, ":available_troops_in_faction", 1),
          (this_or_next|lt, ":leader_player", 0),
          (player_slot_ge, ":leader_player", ":wanted_slot", 1),
          (val_sub, ":random_troop_index", 1),
          (lt, ":random_troop_index", 0),
          (assign, ":end_cond", 0),
          (assign, ":selected_troop", ":troop_no"),
        (try_end),
        (assign, reg0, ":selected_troop"),
        (assign, reg1, ":leader_player"),
      (try_end),
 
      ]),

[close]

There is an issue though - bots spawn as first infantry unit in the list of faction's infantry bots. I even like it, it adds more reality, but I think it would be better to have variety of bots. So, my next question is - how to make bots spawn as different infantry units?
Title: Re: *Scripting Thread*
Post by: Grozni on December 19, 2018, 01:50:42 pm
You can't just do (neg|tf_mounted, ":troop_no"), as if tf_mounted is an operation, tf_mounted is a flag used for troops.

For a list of operations which you can use like that check out header_operations.py a lot of them have some sort of description as well.

The only reason this compiles without an error is because almost everything in M&B module system is a constant number, and since the compiler expects the tf_mounted, in the way you used it, to be an operation, the game will perform an operation which has the same ID number as tf_mounted flag. So it will actually do (neg|some_operation_definitely_not_what_you_expected, ":troop_no"). If curious you can see each operation ID number in header_operations.

To check if it will be mounted troop you can compare if the troop is one of the first cavalry troop per each faction, or loop through troop template inventory in look for a horse, or simply assign a correct number depending on faction (number of AI troops before cavalry start) idk there is many ways really, but I think you should start by making the code more elegant, that giant if else which repeats almost the entire script is an accident waiting to happen.
Title: Re: *Scripting Thread*
Post by: Ivkolya on December 20, 2018, 03:27:06 pm
Thank you, Grozni, right now I have no time to make this script better and for now I'm more than happy with this result. Besides, I am no coder, so I understand how to make it better, but I don't know how to write it in MBScript.
Title: Re: *Scripting Thread*
Post by: Swordsman on December 22, 2018, 03:02:58 pm
Hello guys, thanks for the help. Finally i made it, here's a screenshoot of the result. I was testing with my server and all is ok. Now i have another question, is it posible to make an object like a snowy barrel give you an item? i copy the code of ze_treasure in scene_props to the snow_barrel, and do the same in scripts changing the text but it doesnt work, any idea?

Spoiler
(https://steamuserimages-a.akamaihd.net/ugc/938336953146205520/BDE78C0B6660BA068EA8C477305BA7ACA4304EC8/)
[close]
Title: Re: *Scripting Thread*
Post by: Grozni on December 22, 2018, 03:08:40 pm
You can't turn barrel into usable object server side. But you can add custom buttons which were added in the new patch. It is an invisible button with custom text that you can have perform some code.

No one wrote a good tutorial about using them yet, but things are  self explanatory if you look around scripts and troops code. I don't have time atm for detailed explanations. Some clues you can find here https://www.fsegames.eu/forum/index.php?topic=38427.msg1677692#msg1677692
Title: Re: *Scripting Thread*
Post by: Swordsman on December 22, 2018, 03:22:17 pm
You can't turn barrel into usable object server side. But you can add custom buttons which were added in the new patch. It is an invisible button with custom text that you can have perform some code.

No one wrote a good tutorial about using them yet, but things are  self explanatory if you look around scripts and troops code. I don't have time atm for detailed explanations. Some clues you can find here https://www.fsegames.eu/forum/index.php?topic=38427.msg1677692#msg1677692

Thanks Grozni, so i can make the same but with a custom button anyway. I think it may be worth.
Title: Re: *Scripting Thread*
Post by: pete99 on December 23, 2018, 12:20:40 am
You can also add a particular use text for the buttons too, e.g “Get Santa Hat.” Basically just have to enable a certain number of custom strings in scripts file, change the name of one of the “custom string” troops in module troops. And then change the var1 number as I remember on the prop when you place it to the number of string you changed. E.g changed custom string 1, change prop var1 also to 1.
Title: Re: *Scripting Thread*
Post by: Ivkolya on December 24, 2018, 02:18:32 am
You can't just do (neg|tf_mounted, ":troop_no"), as if tf_mounted is an operation, tf_mounted is a flag used for troops.

For a list of operations which you can use like that check out header_operations.py a lot of them have some sort of description as well.

The only reason this compiles without an error is because almost everything in M&B module system is a constant number, and since the compiler expects the tf_mounted, in the way you used it, to be an operation, the game will perform an operation which has the same ID number as tf_mounted flag. So it will actually do (neg|some_operation_definitely_not_what_you_expected, ":troop_no"). If curious you can see each operation ID number in header_operations.

To check if it will be mounted troop you can compare if the troop is one of the first cavalry troop per each faction, or loop through troop template inventory in look for a horse, or simply assign a correct number depending on faction (number of AI troops before cavalry start) idk there is many ways really, but I think you should start by making the code more elegant, that giant if else which repeats almost the entire script is an accident waiting to happen.

Oddly enough, if I delete this line
Code
           (neg|tf_mounted, ":troop_no"),
Bots still spawn as first infantry unit with no variety and no cavalry. So, basically, if I just specify gamemode and map and leave code untouched - it still spawns bots only as first infantry. Which is strange, as code is without changing.
Title: Re: *Scripting Thread*
Post by: Grozni on December 24, 2018, 11:00:43 am
Not very odd as that line wasn't doing anything in the first place. Lack of variety is due to some mistake you made somewhere else, I would advice you to start over with new module system.
Title: Re: *Scripting Thread*
Post by: Ivkolya on January 02, 2019, 06:45:26 pm
I have a new question - how to make a troop to change it's uniform depending on current multiplayer map (or, for example, if it is winter in singleplayer)?
I'm trying to write this code as I understand it, but there are many errors in compilator, mainly something about errors in dialog lines and unused global variables. Here's my code

Spoiler
Code
#Multiplayer ai troops
  # MM
  (try_begin),
    (store_current_scene, ":cur_scene"),
    (eq, ":cur_scene", "scn_assault_on_malakoff_test"),
    ["british_infantry_ai","Line Infantry","19th Regiment of Foot",tf_guarantee_all,0,0,fac_britain,
     [itm_brit_93rd,itm_brit_19th_hat,itm_british_brown_bess,itm_bullets],
     def_attrib|level(20),wpex(50,5,130,5,120,5),knows_common|knows_ironflesh_3|knows_power_strike_3|knows_athletics_3,russian_face_middle_1, russian_face_old_2],
  (else_try),
    ["british_infantry_ai","Line Infantry","19th Regiment of Foot",tf_guarantee_all,0,0,fac_britain,
     [itm_brit_19th,itm_brit_19th_hat,itm_british_brown_bess,itm_bullets],
     def_attrib|level(20),wpex(50,5,130,5,120,5),knows_common|knows_ironflesh_3|knows_power_strike_3|knows_athletics_3,russian_face_middle_1, russian_face_old_2],
  (try_end),
[close]
Title: Re: *Scripting Thread*
Post by: Glenn. on February 07, 2019, 12:43:57 am
Does any one know how to script for the Anglo Zulu War mod? Things like welcome messages for users joining and leaving. Server announcements every so often. Admin ID Whitelisting and the ability to prevent more than 2 people spawning as a Zulu player. Also to stop players being able to vote bots into the British Faction? If so please contact me, this would come in quite handy and I know they all work in NW just sadly AZW hasn't been updated to the latest NW Patch...
Title: Re: *Scripting Thread*
Post by: Windflower on May 30, 2019, 04:39:00 pm
Thought I might ask a question here to avoid getting someone else to do it for me,
would anyone know the basic scripting for changing the damage done from kicks & punches?
Title: Re: *Scripting Thread*
Post by: pete99 on May 31, 2019, 03:02:16 am
Thought I might ask a question here to avoid getting someone else to do it for me,
would anyone know the basic scripting for changing the damage done from kicks & punches?

The way I would normally do it is using this trigger:

Spoiler
ti_on_agent_hit          = -28.0 #can only be used in module_mission_templates triggers
# Trigger Param 1: damage inflicted agent_id
# Trigger Param 2: damage dealer agent_id
# Trigger Param 3: inflicted damage
# Trigger Param 4: hit bone
# Trigger Param 5: missile item kind no
# Register 0: damage dealer item_id
# Position Register 0: position of the blow
#                      rotation gives the direction of the blow
# Trigger result: if returned result is greater than or equal to zero, inflicted damage is set to the value specified by the module.
[close]

I simply check that the player has no item equipped (for punches, not sure about kicking since it can be done while holding a weapon). Then change the damage using:

(set_trigger_result, [new damage]),

Since you can get the original damage with # Trigger Param 3: inflicted damage, you can either adjust this, or just create a standard amount of damage you want done, e.g. (set_trigger_result, 10),

Title: Re: *Scripting Thread*
Post by: Coldstreamer on December 04, 2019, 03:51:48 pm
Anyone have an idea on how to re-named and replace the marches for nations?  I'm trying to re-name some of them and add my own marches to them..
Title: Re: *Scripting Thread*
Post by: Woeski on December 16, 2019, 03:54:55 pm
Anyone have an idea on how to re-named and replace the marches for nations?  I'm trying to re-name some of them and add my own marches to them..

Can you be a bit more specific, like you mean the marches that musicians can play or the ones that play when a team wins the round?
Title: Re: *Scripting Thread*
Post by: No0B on March 10, 2020, 03:54:50 am
Anyway to disable team 2, on a server in NW, Even pointing me to the right files is a huge help thanks.
Title: Re: *Scripting Thread*
Post by: Lilja Mariasdóttir on March 11, 2020, 02:35:33 pm
Anyway to disable team 2, on a server in NW, Even pointing me to the right files is a huge help thanks.
Maybe not the most beautiful solution, but the most easy to do yourself without any prior experience:

Follow this instructions to get and set up the module system of MB (if you dont have already):
https://www.fsegames.eu/forum/index.php?topic=11836.0
Edit: but download the module system from here, the one in the thread is old: https://www.taleworlds.com/en/Games/NapoleonicWars (click "+Downloads" and get "Module Source:"

then open module_scripts.py
and replace this line:
Code
(call_script, "script_cf_multiplayer_team_is_available", ":player_no", ":value"),
with:
Code
(neq, ":value", 1),
(1 is the value for team 2)
Title: Re: *Scripting Thread*
Post by: Wellesley on March 12, 2021, 12:12:56 pm
Hello, im tryng to make compatible Baillie's Immersion Mod with the new patch, i changed the vanilla game_missile_launch line with Baillie's one, and i have the old effects in game, but i dont know why i hear voices (i think they are from tutorial) in battle, any idea of tho solve this?
Title: Re: *Scripting Thread*
Post by: Coldstreamer on July 30, 2021, 11:11:23 pm
If anyone knows where to find some scripts for bot survival (like the ones on BBG Bot Survival) or changing uniforms (Tropical Paradise), please let me know!!  Also, I know how to add weapons for units, but not sure how to make it server-side only..