Multiplayer troops that cost money??

Users who are viewing this thread

Abdmzn

Recruit
anybody knows how that can be done?? I posted this a few days ago on modding Q&A thread but got no replies..
 
Im not sure what u are talking about.. whats ti_on_agent_spawn??
what I want is, In multiplayer, some better classes can be used if you have enough money for them, for example a better swadian knight that costs 10k to play.

Edit: Now I remember what mod I saw it on, it was full invasion 2.

 
Abdmzn said:
Im not sure what u are talking about.. whats ti_on_agent_spawn??

this  means that you need to learn how to code MBScript (Mount Blade Scripting Language), so you can change the game rules and add your own (like, as a example, tiers for troops and a cash cost to use some of them).

all of this is possible, but not that easy, if you never coded MB. And you will need to learn how to code for MP (to handle the client/server paradigm).

If you are willing to invest the many many hours into this check the sticky threads for how to begin.

Cheers
 
Im already working on scripting the game, and I added a new unit, and want it to cost money to use, but Im not sure where to find that "ti_on_agent_spawn" thingy...
 
Abdmzn said:
kalarhan said:
https://forums.taleworlds.com/index.php/board,12.0.html

read the basic guides, then check header_triggers.py

I read the first 3 parts, and I saw many outdated information, that could be a problem..

The real problem is that you seem to not even try to find needed information on your own. Even if we help you now you will probably make thread  to ask for advice every time you encounter anything that cant be fixed out right. Lets hope it wont be case. Trust me, all you need is in forge threads or sub forums. But to not look like a sshole I will try to help you in detail this time. Dont really know how much you learned, so some information can be obvious.


To make something happen during game your best bet is setting triggers. You have many of them for different occasions (even more with wse). Lets open header_triggers.py that's surely located in your module system folder. You should find this one:

Code:
ti_on_agent_spawn             = -25.0 # A new agent has been spawned on the scene.
    # trigger param 1 = agent_id of spawned agent


Triggers must be placed inside body of mission template (mission_templates.py) in which you want stuff to happen. I will place it in deathmatch in this case.


Code:
(
    "multiplayer_dm",mtf_battle_mode,-1, #deathmatch mode #MARK DEATHMATCH
    "You lead your men to battle.",
    [
      (0,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (1,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (2,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (3,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (4,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (5,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (6,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (7,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),

      (8,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (9,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (10,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (11,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (12,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (13,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (14,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (15,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),

      (16,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (17,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (18,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (19,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (20,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (21,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (22,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (23,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),

      (24,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (25,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (26,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (27,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (28,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (29,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (30,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (31,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),

      (32,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (33,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (34,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (35,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (36,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (37,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (38,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (39,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),

      (40,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (41,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (42,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (43,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (44,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (45,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (46,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (47,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),

      (48,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (49,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (50,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (51,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (52,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (53,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (54,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (55,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),

      (56,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (57,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (58,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (59,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (60,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (61,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (62,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (63,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
     ],
    [
##################################    YOUR TRIGGER     ######################################################	
		(ti_on_agent_spawn, 0, 0, [],
		[
			(store_trigger_param_1, ":agent_no"),
			
		]),
		
########################################################################################		
	
	  #multiplayer_server_check_belfry_movement,      
     
      multiplayer_server_check_polls,

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

      (ti_server_player_joined, 0, 0, [],
       [
         (store_trigger_param_1, ":player_no"),
         (call_script, "script_multiplayer_server_player_joined_common", ":player_no"),
         ]),

      (ti_before_mission_start, 0, 0, [],
       [
         (assign, "$g_multiplayer_game_type", multiplayer_game_type_deathmatch),
         (call_script, "script_multiplayer_server_before_mission_start_common"),
         
         (multiplayer_make_everyone_enemy),

         (call_script, "script_multiplayer_init_mission_variables"),
         (call_script, "script_multiplayer_remove_destroy_mod_targets"),
         (call_script, "script_multiplayer_remove_headquarters_flags"), # close this line and open map in deathmatch mod and use all ladders firstly 
         ]),                                                            # to be able to edit maps without damaging any headquarters flags ext. 

      (ti_after_mission_start, 0, 0, [], 
       [
         (set_spawn_effector_scene_prop_kind, 0, -1), #during this mission, agents of "team 0" will try to spawn around scene props with kind equal to -1(no effector for this mod)
         (set_spawn_effector_scene_prop_kind, 1, -1), #during this mission, agents of "team 1" will try to spawn around scene props with kind equal to -1(no effector for this mod)

         (call_script, "script_initialize_all_scene_prop_slots"),
         
         (call_script, "script_multiplayer_move_moveable_objects_initial_positions"),

         (assign, "$g_multiplayer_ready_for_spawning_agent", 1),
         ]),


Code inside that trigger will be executed every time something spawns. Lets say you want to take money from player if he spawns as super swadian knight.

Code:
(ti_on_agent_spawn, 0, 0, [],
		[
			(store_trigger_param_1, ":agent_no"),    #get spawned agent
			
			(agent_is_active, ":agent_no"),               # check if agent exists. Just to be sure...
                        (agent_get_troop_id, ":troop", ":agent_no"),  #check if spawned agent is super swadian knight
			(eq, ":troop", "trp_super_swadian_knight"),
                        
                        (neg|agent_is_non_player, ":agent_no"),  #check if that bastard if even a living player

   
			(agent_get_player_id, ":player", ":agent_no"),   #if yes get player who controlling freshly spawned agent...
                        (player_is_active, ":player"),               # check if player exists. Just to be 100% sure...
			
                        (player_get_gold, ":gold", ":player"), #...and substract 500 gold from said player
			(val_sub, ":gold", 500),
			(player_set_gold, ":player", ":gold", 99999999),
			
		]),

If its still not enough explanation for you Im afraid there is not much more we can do unless you read basic tutorials.
 
Thanks for the help.
But really, my experience is nothing, I only learned modding basics or less, but I really tried my best to find information on the forums and even tried to figure out things by my self but with no luck. even the basic tutorials the guy sent me, I wanted to read more but I was afraid I might get outdated information and get confused afterwards.
So I just asked for help, figuring that there will be some people who are willing to give up 5 mins of their time to help me get the information I need.
Thanks again.
 
There arent any outdated to "not usable" degree information here. Same version of module system was used for years (until recent trash warband update at least...but it didnt changed much in terms of modding). As I said, everything you need is in forge threads. Also you can examine original code for  examples. There  are many sticked and normal good tutorials. Even if you wont find one for your particular problem, there is 99,99901% probability that someone had same problem and made thread about it. You can try to find answer in Q&A thread, however its litter bin sometimies so can be hard to search here. Seriously man, learn to search.
 
You have all the information you need. My Advice to you is to open up Header operations, header triggers, mission templates, and module scripts. Now i know this is a lot but lets take a look at our mission template file. Here is where all the game missions you can see that inside the missions there are triggers. Those triggers call scripts or checks. Triggers are things that trigger when something returns true. when an agent spawns the trigger, ti_on_agent_spawn will trigger.
and lets say we make a script and call it inside that trigger then that script will run every time that trigger fires. Header operations are like functions that you use in your scripts.

Now that you understand the relations between these files take a deep breath and dont get overwhelmed. Start by creating a small script maybe something like Printing hello world in chat. take it step by step eventually you will learn enough to do what you want. good luck to you
 
Back
Top Bottom