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.
He means the system the 91st has on groupfight, if you know that.
Interesting to know how one installs these server plugins...
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...
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 :)
Hm ok... I think I could write a Script like this if you don't find it..
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.
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.
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?
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.
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.
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
You right click with the spy-glass and Eureka it's usable. ;)
You right click with the spy-glass and Eureka it's usable. ;)
(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),
module_info.py
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.
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.
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. :)
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. :)
(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"),
(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
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?
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!
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.
(multiplayer_send_string_to_player, ":player_no", multiplayer_event_show_server_message, "str_intro_msg"),
("intro_msg","This is an example message that will be displayed to the player when joining the server!"),
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?
itp_type_pistol|itp_merchandise|itp_primary|itp_cant_reload_while_moving_mounted ,itcf_shoot_pistol|itcf_reload_pistol|itcf_carry_pistol_front_left
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.Codeitp_type_pistol|itp_merchandise|itp_primary|itp_cant_reload_while_moving_mounted ,itcf_shoot_pistol|itcf_reload_pistol|itcf_carry_pistol_front_left
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?
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.pyCode(multiplayer_send_string_to_player, ":player_no", multiplayer_event_show_server_message, "str_intro_msg"),
module_strings.pyCode("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 :)
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
(multiplayer_send_string to player, ":player_no", multiplayer_event_send_admin_chat, "str_admin_msg"),
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.)?Taken from Saxingers OSP scripts. Haven't tried it myself, but I guess it should work.
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"),
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),
])
("server_message_1", "Type you first Serveranouncement"),
(eq, "$counter", 300),300 = 5 mins, so in your case 10 mins would be 600.
lol guys, pls just a little help -.-
NopeDear 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)
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
Is there a way to associate a specific py file with a specific map?
(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
Omg wow thanks, I'll play around with theseIs there a way to associate a specific py file with a specific map?
This would work in module_scripts and module_mission_templatesCode(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 endOr 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.
(call_script,"script_multiplayer_server_play_sound_at_position",":sound_id"),
Anyone got a script that would add Musicians / other things to commander battle in NaS.Is that even possible?
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 neutrali 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.
(neg|agent_is_human, ":dead_agent_no"),
(agent_get_rider, ":dead_horse_rider", ":dead_agent_no),
(neq, ":dead_horse_rider, -1), #even has a rider?
(agent_get_team, ":killer_team", ":killer_agent_no"),
(agent_get_team, ":dead_team", ":dead_horse_rider"),
(eq, ":killer_team", ":dead_team"),
(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"),
(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"),
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?^^
(eq, neg|agent_is_non_player, ":dead_agent_no"),
(neg|agent_is_non_player, ":dead_agent_no"),
(eq, agent_is_non_player, ":agent_no"),
(agent_is_non_player, ":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),
(agent_get_item_id, ":horse_agent", ":agent_no"),
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.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
on the bright side, i improved the heal function.(imo.) healing a player(not all) now heals the horse they are riding.
Actually you being salty is the reason I'm banned.SpoilerUnlike 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]
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.
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.
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.
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?
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)
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.
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.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.
nvm, figured this out the other day. had to make the changes client side to get it to show up.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).
i made it so this is now possible on na1.
multiplayer_server_botbarricadeattack = (
3, 0, 0, [],
[
(call_script, "script_botattackbarricade"),
])
("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),
]),
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),
])
working nowSpoilerOkay I fixed it thanks to your help reducing it to mission_templates_only
here is the script as a Sign of my gratitudeQuotemultiplayer_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]
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)
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.
Can the sailor class be disabled from being able to be picked / removed?The same like point 1.
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
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
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
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/)
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
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.
(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),
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.
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.
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.
Scripters of NW, how scriptable are conquest flags.
Scripters of NW, how scriptable are conquest flags.
Very scriptable, down to smallest details.
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
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.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.
Thanks!
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).
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).
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).
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.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.
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.That would be extremely inefficient.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.
The server just says no, when the client is asking to go to team 2.
#condition checks are done
(try_begin),
#check if available
#condition checks are done
(try_begin),
#check if available
(neq, ":value", 1),
1. does anyone have a molotow cocktail script?
2. Is it possible to integrate Molotov cocktail as a weapon in the admin tool?
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.
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...
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...
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.Thanks a lot, just now managed to test it and to see it actually works! YEY :D
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:Thats the battle mode section. Somewhere after this bit:Spoiler(
"multiplayer_bt",mtf_battle_mode,-1, #battle mode
"You lead your men to battle.",
[[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.Spoiler[
common_battle_init_banner,
multiplayer_server_check_polls,
multiplayer_server_bonuses,
multiplayer_server_auto_ff,[close]
....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.
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.
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),
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.
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)
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?
(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),
(try_for_range, ":cur_ai_troop", multiplayer_ai_troops_begin, multiplayer_ai_troops_end),
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"
(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),
That part of code is thoroughly commented and you just have to read what the comments say.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
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.
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.
(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),
]),
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.
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
(troop_clear_inventory, "$g_player_troop"),
(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),
]),
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,SpoilerCode(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 lineCode(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)SpoilerCodemultiplayer_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 nowCode(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.
# 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),
]),
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
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.
(neg|tf_mounted, ":troop_no"),
#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),
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?
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..
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:
(call_script, "script_cf_multiplayer_team_is_available", ":player_no", ":value"),
(neq, ":value", 1),