Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Wait, what? I'm going to assume that you want a different message color for each faction. If so, you can just use faction_get_color, except you're using cultures. Easy enough to change that in module_factions, or just fetch the current patrol faction via store_faction_of_party. Also, your code has many errors. You're not comparing the cultures 1 through 6 to anything in particular, so by default all of those statements are true. If you want to check each of those separately, use (else_try). Otherwise, if the first check fails, then none of the code below that will be run. Using try_begin, else_try, try_end will allow each of those cases to be validated.
 
Jezze said:
Code:
        (eq, ":party_type", spt_patrol),
		(assign, ":party_template", "pt_patrol_party"),
		(try_begin),
		      (eq, "fac_culture_1"),
		      (display_message,"@Patrol created for {s7}.", 0xff0000),
		(else_try),
		      (eq, "fac_culture_2"),
		      (display_message,"@Patrol created for {s7}.", 0x808000),	
		(else_try),
		      (eq, "fac_culture_3"),
		      (display_message,"@Patrol created for {s7}.", 0xff3300),	
		(else_try),
		      (eq, "fac_culture_4"),
		      (display_message,"@Patrol created for {s7}.", 0x095bc9),
		(else_try),
		      (eq, "fac_culture_5"),
		      (display_message,"@Patrol created for {s7}.", 0xd2ee11),	
		(else_try),
		      (eq, "fac_culture_6"),
		      (display_message,"@Patrol created for {s7}.", 0xff6633),
		(try_end),	
     (else_try),
For the colors, do as Somebody said.
 
Fixed it with some help, it works too in this way,

  (eq, ":party_type", spt_patrol),
      (assign, ":party_template", "pt_patrol_party"),
      (try_begin),
      (eq, "fac_kingdom_1", ":faction_no"),
      (display_message,"@Patrol created for {s7}.", 0xff0000),
  (else_try),
      (eq, "fac_kingdom_2", ":faction_no"),
      (display_message,"@Patrol created for {s7}.", 0x808000), 
  (else_try),
      (eq, "fac_kingdom_3", ":faction_no"),
      (display_message,"@Patrol created for {s7}.", 0xff3300), 
  (else_try),
      (eq, "fac_kingdom_4", ":faction_no"),
      (display_message,"@Patrol created for {s7}.", 0x095bc9),
  (else_try),
      (eq, "fac_kingdom_5", ":faction_no"),
      (display_message,"@Patrol created for {s7}.", 0xd2ee11), 
  (else_try),
      (eq, "fac_kingdom_6", ":faction_no"),
      (display_message,"@Patrol created for {s7}.", 0xff6633),       
      (try_end),
    (else_try),

There was already a (store_script_param_1, ":faction_no"), in the script, so I only had to add that it checks with the ":faction_no".

Thanks for all the help!
 
Hi, I'm getting pretty frustrated of this problem.
I out of a clue where i made a mistake so i wanted to ask on the forum for an answer.

I edited the module_scripts file and added some strings, in the scripts i say i want to send an message to a player and to an url.
The message that is send to the url needs to send a constantly the same unique id, but he dousn't. So i hope someone knows what i done wrong.

module_scripts:
Code:
  #script_multiplayer_server_player_joined_common
  # INPUT: arg1 = player_no
  # OUTPUT: none
  ("multiplayer_server_player_joined_common",
   [
     (store_script_param, ":player_no", 1),
     (try_begin),
       (this_or_next|player_is_active, ":player_no"),
       (eq, ":player_no", 0),
       (call_script, "script_multiplayer_init_player_slots", ":player_no"),
       (store_mission_timer_a, ":player_join_time"),
       (player_set_slot, ":player_no", slot_player_join_time, ":player_join_time"),
       (player_set_slot, ":player_no", slot_player_first_spawn, 1),
       #fight and destroy only
       (player_set_slot, ":player_no", slot_player_damage_given_to_target_1, 0),
       (player_set_slot, ":player_no", slot_player_damage_given_to_target_2, 0),
       #fight and destroy only end
       (try_begin),
         (multiplayer_is_server),
         (assign, ":initial_gold", multi_initial_gold_value),
         (val_mul, ":initial_gold", "$g_multiplayer_initial_gold_multiplier"),
         (val_div, ":initial_gold", 100),
         (player_set_gold, ":player_no", ":initial_gold"),
         (call_script, "script_multiplayer_send_initial_information", ":player_no"),
		 #001 begin
		 (player_get_unique_id, ":player_unique_id", ":player_no"),
		 (str_store_string, reg0, ":player_no"),
		 (str_store_string, reg1, ":player_unique_id"),
		 (str_store_player_username, s0, ":player_no"),
		 (server_add_message_to_log, "str_members_join"),
		 (send_message_to_url, "str_members_join"),
		 #001 end
       (try_end),
     (try_end),
     ]),

Code:
  #script_multiplayer_server_on_agent_killed_or_wounded_common
  # INPUT: arg1 = dead_agent_no, arg2 = killer_agent_no
  # OUTPUT: none
  ("multiplayer_server_on_agent_killed_or_wounded_common",
   [
     (store_script_param, ":dead_agent_no", 1),
     (store_script_param, ":killer_agent_no", 2),

     (call_script, "script_multiplayer_event_agent_killed_or_wounded", ":dead_agent_no", ":killer_agent_no"),
     #adding 1 score points to agent which kills enemy agent at server
     (try_begin),
       (multiplayer_is_server),
       (try_begin), #killing myself because of some reason (friend hit, fall, team change)
         (lt, ":killer_agent_no", 0),
         (ge, ":dead_agent_no", 0),
         (neg|agent_is_non_player, ":dead_agent_no"),
         (agent_get_player_id, ":dead_agent_player_id", ":dead_agent_no"),
         (player_is_active, ":dead_agent_player_id"),
         (player_get_score, ":dead_agent_player_score", ":dead_agent_player_id"),
         (val_add, ":dead_agent_player_score", -1),
         (player_set_score, ":dead_agent_player_id", ":dead_agent_player_score"),
       (else_try), #killing teammate
         (ge, ":killer_agent_no", 0),
         (ge, ":dead_agent_no", 0),
         (agent_get_team, ":killer_team_no", ":killer_agent_no"),
         (agent_get_team, ":dead_team_no", ":dead_agent_no"),
         (eq, ":killer_team_no", ":dead_team_no"),
         (neg|agent_is_non_player, ":killer_agent_no"),
         (agent_get_player_id, ":killer_agent_player_id", ":killer_agent_no"),
         (player_is_active, ":killer_agent_player_id"),
         (player_get_score, ":killer_agent_player_score", ":killer_agent_player_id"),
         (val_add, ":killer_agent_player_score", -1),
         (player_set_score, ":killer_agent_player_id", ":killer_agent_player_score"),
         #(player_get_kill_count, ":killer_agent_player_kill_count", ":killer_agent_player_id"),
         #(val_add, ":killer_agent_player_kill_count", -2),
         #(player_set_kill_count, ":killer_agent_player_id", ":killer_agent_player_kill_count"),
		 #002 begin
		 (player_get_unique_id, ":player_unique_id", ":killer_agent_player_id"),
		 (str_store_string, reg0, ":killer_agent_player_id"),
		 (str_store_string, reg1, ":player_unique_id"),
		 (multiplayer_send_message_to_player, ":killer_agent_player_id", multiplayer_event_show_server_message, "@Do not teamkill!"),
		 (server_add_message_to_log, "str_members_kill"),
		 (send_message_to_url, "str_members_kill"),
		 #002 end
       (else_try), #killing enemy
         (ge, ":killer_agent_no", 0),
         (ge, ":dead_agent_no", 0),
         (agent_is_human, ":dead_agent_no"),
         (agent_is_human, ":killer_agent_no"),
         (try_begin),
           (eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
           (try_begin),
             (eq, "$g_battle_death_mode_started", 1),
             (neq, ":dead_agent_no", ":killer_agent_no"),
             (call_script, "script_calculate_new_death_waiting_time_at_death_mod"),
           (try_end),
         (try_end),
         (try_begin),
           (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
           (eq, "$g_multiplayer_game_type", multiplayer_game_type_destroy),
           (agent_get_player_id, ":dead_player_no", ":dead_agent_no"),
           (try_begin),
             (ge, ":dead_player_no", 0),
             (player_is_active, ":dead_player_no"),
             (neg|agent_is_non_player, ":dead_agent_no"),         
             (try_for_agents, ":cur_agent"),
               (agent_is_non_player, ":cur_agent"),
               (agent_is_human, ":cur_agent"),
               (agent_is_alive, ":cur_agent"),
               (agent_get_group, ":agent_group", ":cur_agent"),
               (try_begin),
                 (eq, ":dead_player_no", ":agent_group"),
                 (agent_set_group, ":cur_agent", -1),                 
               (try_end),
             (try_end),
           (try_end),
         (try_end),
         (neg|agent_is_non_player, ":killer_agent_no"),
         (agent_get_player_id, ":killer_agent_player_id", ":killer_agent_no"),
         (player_is_active, ":killer_agent_player_id"),
         (player_get_score, ":killer_agent_player_score", ":killer_agent_player_id"),
         (agent_get_team, ":killer_agent_team", ":killer_agent_no"),
         (agent_get_team, ":dead_agent_team", ":dead_agent_no"),
         (try_begin),
           (neq, ":killer_agent_team", ":dead_agent_team"),
           (val_add, ":killer_agent_player_score", 1),
         (else_try),
           (val_add, ":killer_agent_player_score", -1),
         (try_end),
         (player_set_score, ":killer_agent_player_id", ":killer_agent_player_score"),
       (try_end),
     (try_end),

     (call_script, "script_add_kill_death_counts", ":killer_agent_no", ":dead_agent_no"),
     #money management
     (call_script, "script_money_management_after_agent_death", ":killer_agent_no", ":dead_agent_no"),
     ]),

Code:
  ("game_receive_url_response",
    [
      #here is an example usage
##      (store_script_param, ":num_integers", 1),
##      (store_script_param, ":num_strings", 2),
##      (try_begin),
##        (gt, ":num_integers", 4),
##        (display_message, "@{reg0}, {reg1}, {reg2}, {reg3}, {reg4}"),
##      (try_end),
##      (try_begin),
##        (gt, ":num_strings", 4),
##        (display_message, "@{s0}, {s1}, {s2}, {s3}, {s4}"),
##      (try_end),
		#003 begin
		(server_add_message_to_log, "@{reg0}, {reg1}, {reg2}, {reg3}"),
		(try_begin),
		  (multiplayer_is_server),
		  (try_begin),
			(eq, reg0, 0),
			(try_begin),
			  (eq, reg2, 1),
			  (kick_player, reg1),
			(else_try),
			  (eq, reg2, 2),
			  (ban_player, reg1, 1, 0),
			(try_end),
		  (else_try),
			(eq, reg0, 1),
			(try_begin),
			  (eq, reg2, 2),
			  
			(else_try),
			  (eq, reg2, 1),
			  
			(try_end),
		  (try_end),
		(try_end),
		#003 end
      ]),

module_strings:
Code:
  #004 begin
  ("members_join", "http://www.anonumous.nl/teamkill.php?action=join&id={reg0}&uid={reg1}&name={s0}"),
  ("members_kill", "http://www.anonumous.nl/teamkill.php?action=kill&id={reg0}&uid={reg1}"),
  #004 end

You probably already noticed it are only server side scripts, thats true.
This script checks for team-killing and registers the kill with the unique player id, at-least thats what it's supposed to do.
When I'm trying it out on a dedicated server the server log returns this when i join:
Code:
 16:00:26 - OLL_Jerkuh has joined the game with ID: 392652 
 16:00:27 - http://www.anonymous.nl/teamkill.php?action=join&id=100&uid=1&name=OLL_Jerkuh 
 16:00:28 - 9, 1, 100, 3 
 16:00:53 - OLL_Jerkuh <img=ico_crossbow> Rhodok Crossbowman 
 16:00:53 - http://www.anonymous.nl/teamkill.php?action=kill&id=-1&uid=1 
 16:00:54 - 8, 0, -1, 0

After checking the rgl he shows this error:
Code:
SCRIPT ERROR ON OPCODE 2320: Invalid Register ID: -1; LINE NO: 19: 
 At script: multiplayer_server_player_joined_common.
 
In script_multiplayer_server_player_joined_common, change this:
#001 begin
(player_get_unique_id, ":player_unique_id", ":player_no"),
(str_store_string, reg0, ":player_no"),
(str_store_string, reg1, ":player_unique_id"),
(str_store_player_username, s0, ":player_no"),
(server_add_message_to_log, "str_members_join"),
(send_message_to_url, "str_members_join"),
#001 end
to this:
#001 begin
(player_get_unique_id, ":player_unique_id", ":player_no"),
(assign, reg0, ":player_no"),
(assign, reg1, ":player_unique_id"),
(str_store_player_username, s0, ":player_no"),
(server_add_message_to_log, "str_members_join"),
(send_message_to_url, "str_members_join"),
#001 end
 
Have I missed where I can find a list of commands/triggers/etc for the module system? Searches for "list triggers commands" etc have turned up nothing...perhaps I'm not using the correct terms.

I know some are in the header_ files, but is there a compiled list of "agent_get_..." type commands, etc?  Thanks in advance.
 
What's the difference between fac_culture_1 and fac_kingdom_1, fac_culture_2 and fac_kingdom_2, etc?  They seem to do the same thing when I set the player to join them.  Also, dumb newbie coder question, what's the best way to put them in scope for module_game_menus.py?  I'm assuming that's the problem because if I use their numeric values they work OK but if I try "fac_culture_1" or "$fac_culture_1" it doesn't work.
 
Well, basically, culture is just a kingdoms culture. Like it's troops, buildings, lords etc I guess. Not the same thing as the kingdom itself. Sorry for a dumb explanation : P
 
GetAssista said:
Big_Mac said:
Could someone please tell me how to change the starting wars between factions?
change script_randomly_start_war_peace
Sorry, but that's not what I'm after, although it is useful.

What I want is to start Faction A at war with Faction B.
 
Had a look at banners_kingdoms.dds, how would I be able to make it so that all my kingdoms have banners (I have 12 ._.)? Thanks :smile:
 
mr.master said:
Well, basically, culture is just a kingdoms culture. Like it's troops, buildings, lords etc I guess. Not the same thing as the kingdom itself. Sorry for a dumb explanation : P
I don't understand.  If I want to cause a player to join a faction, should I have him join the culture or the kingdom?  And what happens if I have him join the wrong one?

edit: Actually, more general question: what does script_player_join_faction even do besides change relationship values with that faction and its enemies?  It doesn't seem to make you a vassal or give you a banner or make your character show up on the faction's list in the in-game character list or anything.
 
Alright, culture setup basically allows a meta-faction of sorts to exist. For example, if the Kingdom of Swadia is wiped out, their culture (Swadian) still exists in their original villages and towns, etc. The culture is not a kingdom - just a placeholder of sorts for the basic tier1-5 troops, town walkers, etc, for now. Make sure you join the actual fac_kingdom_1-6.

Have you tried looking at it in module_scripts? Basically it resets a bunch of ai stuff, a bunch of variables relating to when you swore an oath, resets relations, rearranges center ownership, cancels quests, moves your wife around, free any companion prisoners to your new faction, etc,

Lord_Cheap said:
Had a look at banners_kingdoms.dds, how would I be able to make it so that all my kingdoms have banners (I have 12 ._.)? Thanks :smile:
You don't need to use banners_kingdoms.dds. Any banner will suffice, as long as you have the correct scene props, banner meshes, and mesh shields/projections, (map icons exist but aren't used). Those are just higher resolution than the regular banners. What you can do is modify the first 6 texture, and then make another copy, modifying the last 6 texture, and then copy the necessary meshes and make them use your new material.
 
Status
Not open for further replies.
Back
Top Bottom