Multiplayer Reinforcement Waves

正在查看此主题的用户

raeborga

Recruit
I'm new to the forums, but I've been developing a mod that adds single player battle features to multiplayer without adding any new resources outside of Native. So far it's gone very smoothly, and most of the troops that are present in SP are now available in MP, and I've set up a very easy method for importing characters. While this alone is very fun and creates a more cooperative style of gameplay, I realized during a particularly large battle that I was missing something important.

My question is this: Would it be possible to add waves to multiplayer bots? I've read into and experimented with the Invasion code, but I'm still stumped. I don't want anything fancy, just a method of easing a large number of bots into a battle so my friends and I are not immediately overwhelmed by 100 Swadian Knights. I have no need for unique waves or anything of the sort.

Any help is appreciated. It seems to me that it could be added to battle mode with a bit of trickery.
 
First of all, welcome to the forum!

Secondly, this sounds very interesting. Sadly, I can`t help though :/
 
Depends on how you're storing the troops to be added. The basic spawning code is this (taken from deathmatch)
插入代码块:
           (call_script, "script_multiplayer_find_spawn_point", ":selected_team", 0, ":is_horseman"), 
           (store_current_scene, ":cur_scene"),
           (modify_visitors_at_site, ":cur_scene"),
           (add_visitors_to_current_scene, reg0, ":selected_troop", 1, ":selected_team", -1),
The parameters for script_multiplayer_find_spawn_point are described in module_scripts. The last line is the most important - look at the parameters for this operation in header_operations, and modify according to your needs.

The singleplayer wave code is this
插入代码块:
      (1, 0, 5, [(lt,"$defender_reinforcement_stage",2),
                 (store_mission_timer_a,":mission_time"),
                 (ge,":mission_time",10),
                 (store_normalized_team_count,":num_defenders", 0),
                 (lt,":num_defenders",6)],
           [(add_reinforcements_to_entry,0,7),(val_add,"$defender_reinforcement_stage",1)]),
      
      (1, 0, 5, [(lt,"$attacker_reinforcement_stage",2),
                 (store_mission_timer_a,":mission_time"),
                 (ge,":mission_time",10),
                 (store_normalized_team_count,":num_attackers", 1),
                 (lt,":num_attackers",6)],
           [(add_reinforcements_to_entry,3,7),(val_add,"$attacker_reinforcement_stage",1)]),
I obviously cut off some stuff, but basically after 10 seconds in, if the wave number is less than 2 and the number of "normalized" team members are fetched (no idea if this works in multiplayer, you may need a try_for_agents loop), and if they are less than 6 (again, not necessarily 6 agents), it adds in reinforcements from the respective parties and adds 1 to the wave number. add_reinforcements_to_entry is a hardcoded operation, which serves pretty much the same purpose as the first code snippet. You need to combine the two, depending on how you're storing the troop information.
 
Thank you for the reply. I'll look into what you suggested, assuming I can weave myself around the M&B way of things. To clarify what I was looking to accomplish:

Two factions enter multiplayer mode with "100" troops each. These troops are limited to waves of "25" men per unit. Once the number of troops on either side drops below "5", it would send another "25" out, and so on until either faction is exhausted. Ideally I'd be spawning random troop types from the respective faction the way that Battle mode does at the beginning of each round, without the need to store units of troops anywhere beyond the multi_ai section of Troops.py. At this point, with nearly every NPC from single player integrated into multiplayer in one way or another, it seems like the only logical (or non-masochistic) way of doing it.

I'm still on my first week of modding though, and I'm still getting used to the way M&B is built, so maybe I'll figure something out. Still it can't possibly hurt to butt heads with people who are far more experienced than I am.

Thanks again.
 
后退
顶部 底部