Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Patta said:
Server Event
Code:
	 (eq,":event_type", multiplayer_event_armor_send_to_player),
This is bad design: the player clients should never be triggering the change of armor with only a network message, as this means anyone can tweak their client a bit to give themselves (or  anyone else) any armor or item at all. Instead, you should either use a scene prop trigger or a simple "input" message from the client to the server, and then the server would check that the player is allowed to change armor, decide the item to use in some way, run agent_equip_item on the server so the combat calculations are correct, then loop over all players (from 1 to max players, since the server is already set) sending the network message to update the visual mesh.
 
Sayd Ûthman said:
Oh thank's phoenix, i will try this, but what i was intending to do is to make the trigger check this every friday aka the 5th day. so it check every 5 day, and the re-arm interval is to jump saturday and sunday. it is the correct way to do it ??
I believe so.
 
can I use (str_store_party_name, s0, "pt_player_supporters_faction_reinforcements_a"),
or I have to spawn the party template everytime I want to check?
 
ok, I'm doing it like this:

(spawn_around_party,"p_main_party",reg5),
(str_store_party_name, s2, reg0),
(remove_party, reg0),

reg5 is the party template I want to get the name
 
thanks for your help! I did everything the way you told me to, yet it didn't work, unfortunately. However, when I changed the terrain code (made the map smaller) it did work. Now I just have to check if I can still modify everything..

Thanks again for your help!
 
What is code to make Heroes of Enemy Party to talk to us after enemy party defeated?  :???:

I had used "tc_hero_defeated" code like below.
Code:
[anyone, "start",
  [ (eq, "$g_talk_troop", "trp_hadrian", 1),
    (eq,"$talk_context",tc_hero_defeated),
  ],
  "You! You must be Joseph Man! Emperor will kill Joseph because of The Betray of his Oath!", "hadrian_defeated",
  []],

[anyone|plyr, "hadrian_defeated",
  [
(eq, "$g_talk_troop", "trp_hadrian", 1),
  ],
  "No, Emperor will not kill Joseph. Because I will kill you first.", "hadrian_no",
  []],

[anyone, "hadrian_no",
  [ (eq, "$g_talk_troop", "trp_hadrian", 1),
  ],
  "No! Don't You Dare!", "hadrian_no1",
  []],

[anyone|plyr, "hadrian_no1",
  [
(eq, "$g_talk_troop", "trp_hadrian", 1),
  ],
  "Guard! Kill Him!", "close_window",
  [(assign, "$g_leave_encounter", 1),
   (play_sound,"snd_man_die"),
   (assign, "$g_in_joseph_quest", 0),
   (assign, "$g_joseph_quest_sukses_belum_dikasih_hadiah", 1),]],

[anyone|plyr, "hadrian_no1",
  [
(eq, "$g_talk_troop", "trp_hadrian", 1),
  ],
  "Alas, Taste My Sword!", "close_window",
  [(assign, "$g_leave_encounter", 1),
   (play_sound,"snd_man_die"),
   (assign, "$g_in_joseph_quest", 0),
   (assign, "$g_joseph_quest_sukses_belum_dikasih_hadiah", 1),
   ]],
But Heroes of Enemies Party after the battle, The Heroes is doesn't talk to me.

Whats wrong?
 
your code must be before the native one, because the game reads the file up-to-down, so if all conditioons check from native and it is before yours, the native one will apear
 
Vornne said:
Patta said:
Server Event
Code:
	 (eq,":event_type", multiplayer_event_armor_send_to_player),
This is bad design: the player clients should never be triggering the change of armor with only a network message, as this means anyone can tweak their client a bit to give themselves (or  anyone else) any armor or item at all. Instead, you should either use a scene prop trigger or a simple "input" message from the client to the server, and then the server would check that the player is allowed to change armor, decide the item to use in some way, run agent_equip_item on the server so the combat calculations are correct, then loop over all players (from 1 to max players, since the server is already set) sending the network message to update the visual mesh.


OK, thx for that, but well, our Problem is that it just does not work as we have it, but it should work or not? I can't find any errors in the code. And for what you said: The whole thing is triggered with a chat message (/adminarmor or something like that, i don't know exactly what it is what Gotha made) and triggers only if you are an admin. I do not need the armor change directly, what i need is syncing sounds and anims, but yes, we decided to work together and get at least one thing to work, as editing the code to work for sounds and so on should not be hard then.
 
Patta said:
OK, thx for that, but well, our Problem is that it just does not work as we have it, but it should work or not? I can't find any errors in the code. And for what you said: The whole thing is triggered with a chat message (/adminarmor or something like that, i don't know exactly what it is what Gotha made) and triggers only if you are an admin. I do not need the armor change directly, what i need is syncing sounds and anims, but yes, we decided to work together and get at least one thing to work, as editing the code to work for sounds and so on should not be hard then.
It seems like you are using the WSE for a chat command to be recognisable, and in that case, why are you trying to have it trigger the armor change from a client? The easiest and only sensible way is to handle the "/adminarmor" command and then run agent_equip_item on the server, then send the update message to active player ids from 1 to max players. Even with sounds and animations you should only be sending messages from the server (called from inside triggers or whatever), otherwise players could spam any sound they wanted or force any player to do an animation of their choice, with a little bit of client side modding - but for those two cases, custom network messages are actually not necessary: just run agent_play_sound or agent_set_animation on the server, and all clients will be synchronized automatically.
 
That was what i tried but it did not seem to work. But maybe i did not send it from the sever, i don't know any more. I'll take a look.
 
Could anyone tell how to make a siege tower move? I've got all the entry points laid out with 110 at the start and 119 under it at the wall, yet it doesn't seem to be working when I run the siege map.

and, how do I make the teams switch sides after a round (in a siege) so the attackers become defenders and the defenders become attackers?
 
I've been trying  to make a stripped down version of 'diplomacy_start_war_between_kingdoms' (as well as peace and alliance) and then tried creating a script that runs through all the kingdoms and calls either one of them depending on relations between two kingdoms.

The stripped down version of diplomacy_start_war_between_kingdoms:
Code:
  ("diplomacy_start_war_between_kingdoms_silent", #sets relations between two kingdoms and their vassals.
    [
      (store_script_param, ":kingdom_a", 1),
      (store_script_param, ":kingdom_b", 2),
      (store_script_param, ":initializing_war_peace_cond", 3), #1 = after start of game

      (store_relation, ":relation", ":kingdom_a", ":kingdom_b"),

      (try_begin), 
        (eq, "$players_kingdom", ":kingdom_a"),
        (store_relation, ":relation", "fac_player_supporters_faction", ":kingdom_b"),
        (call_script, "script_set_player_relation_with_faction", ":kingdom_b", ":relation"),
      (else_try),
        (eq, "$players_kingdom", ":kingdom_b"),
        (store_relation, ":relation", "fac_player_supporters_faction", ":kingdom_a"),
        (call_script, "script_set_player_relation_with_faction", ":kingdom_a", ":relation"),
      (try_end),

        (str_store_faction_name_link, s1, ":kingdom_a"),
        (str_store_faction_name_link, s2, ":kingdom_b"),
        (display_log_message, "@DEBUG: {s1} is at war with {s2}."), 
		
        (call_script, "script_update_faction_notes", ":kingdom_a"), 
        (call_script, "script_update_faction_notes", ":kingdom_b"),
        (assign, "$g_recalculate_ais", 1),
      (try_end),
	]),

And the scripts that tries to run through all kingdoms and make the call_script
Code:
  # script_set_kingdoms_interaction_from_relations
  ("set_kingdoms_interaction_from_relations",
	[
		(try_for_range, ":faction_no_1", npc_kingdoms_begin, npc_kingdoms_end),
			(assign, ":kingdom_a", ":faction_no_1"),
			(try_for_range, ":faction_no_2", npc_kingdoms_begin, npc_kingdoms_end),
				(assign, ":kingdom_b", ":faction_no_2"),
					(try_begin),
						(neq, ":kingdom_a", ":kingdom_b"),
						(store_relation, ":relation", ":kingdom_a", ":kingdom_b"),
						(try_begin),
							(lt, ":relation", 0),
							(call_script, "script_diplomacy_start_war_between_kingdoms_silent", ":kingdom_a", ":kingdom_b", 0),
						(else_try),
							(eq, ":relation", 0),
							(call_script, "script_diplomacy_start_peace_between_kingdoms_silent", ":kingdom_a", ":kingdom_b", 0),
						(else_try),
							(gt, ":relation", 1),
							(call_script, "script_diplomacy_start_alliance_between_kingdoms_silent", ":kingdom_a", ":kingdom_b", 0),
						(else_try),
							(str_store_faction_name, s1, ":kingdom_a"),
							(str_store_faction_name, s2, ":kingdom_b"),
							(display_log_message, "@DEBUG: Failed to set peace/war/alliance for {s1} and {s2}"),
						(try_end),
					(try_end),
			(try_end),
		(try_end),
	
	]),

Now what I have in module_triggers.py is a bunch of set_relation between the factions. The trigger is run periodically and contains more then 5 factions, but this is just to show how it is set up.

Code:
            # Kingdom 1
            (set_relation,"fac_kingdom_1", "fac_kingdom_2", 1), 
            (set_relation,"fac_kingdom_1", "fac_kingdom_3", 0), 
            (set_relation,"fac_kingdom_1", "fac_kingdom_4", 0),
            (set_relation,"fac_kingdom_1", "fac_kingdom_5", -1),
            # Kingdom 2
            (set_relation,"fac_kingdom_2", "fac_kingdom_3", -1),
            (set_relation,"fac_kingdom_2", "fac_kingdom_4", 0),
            (set_relation,"fac_kingdom_2", "fac_kingdom_5", 0),
            # Kingdom 3
            (set_relation,"fac_kingdom_3", "fac_kingdom_4", 1),
            (set_relation,"fac_kingdom_3", "fac_kingdom_5", 0),
            # Kingdom 4
            (set_relation,"fac_kingdom_4", "fac_kingdom_5", 1),
            
            (call_script, "script_set_kingdoms_interaction_from_relations"),

When the script is called the debug message seems to indicate that the different war/peace and alliance script fire correctly. But, the problem is that the AI lords ignores each other and only raid villages and siege stuff and completely ignore each other.

If I instead add a call_script for the actual war/peace/alliance scripts, the AI behaves as it usually does.

(Could contain spelling errors, etc. I don't have the exact code to copy/paste atm.)
Code:
            # Kingdom 1
            (set_relation,"fac_kingdom_1", "fac_kingdom_2", 1), 
                  (call_script, "diplomacy_start_alliance_between_kingdoms_silent", "fac_kingdom_1", "fac_kingdom_2"),
            (set_relation,"fac_kingdom_1", "fac_kingdom_3", 0), 
                  (call_script, "diplomacy_start_peace_between_kingdoms_silent", "fac_kingdom_1", "fac_kingdom_3"),
            (set_relation,"fac_kingdom_1", "fac_kingdom_4", 0),
                  (call_script, "diplomacy_start_peace_between_kingdoms_silent", "fac_kingdom_1", "fac_kingdom_4"),
            (set_relation,"fac_kingdom_1", "fac_kingdom_5", -1),
                  (call_script, "diplomacy_start_war_between_kingdoms_silent", "fac_kingdom_1", "fac_kingdom_5"),

and so on in absurdum...

The script_set_kingdoms_interaction_from_relations is my first try at a try_range script so it may very well be incorrect.

Does anyone see what I've done incorrectly, and/or could explain if I need to call other scripts/set other stuff to get it to work as intended?
 
backstrom said:
Does anyone see what I've done incorrectly, and/or could explain if I need to call other scripts/set other stuff to get it to work as intended?
(else_try),
(gt, ":relation", 1),
(call_script, "script_diplomacy_start_alliance_between_kingdoms_silent", ":kingdom_a", ":kingdom_b", 0),
(else_try),
This value should be 0. Also, you don't need to make a copy of the loop variable. The point of using store_relation in diplomacy_start_war_between_kingdoms_silent is so that you can decrease it - right now you are simply fetching the player's relation and then setting it to the same value. You've also got an extra try_end at the end of the script.
 
Hi everyone! Maybe my English is horrible. Sorry, sorry  :oops: :cry: I'm not from English-speaking country.

I have a problem. I would like to add new banners to the game.
I ordered them in the meshes, icons, scene_props. Accordingly made all meshes, which I wrote there. I added the banner before 'mesh_banner_f21' (which was already at the bottom).
In other words, banners are required to be between the constants 'banner_meshes_begin' and 'banner_meshes_end_minus_one'.
But! The biggest problem! In the presentation of banners are just 8 pages! What determines Number of pages?
After all, they should automatically be added, depending on the number of banners, as is evident from the operations in the presentation.
No matter what I do - always 8 pages. By the way, the Lords can use the new banners and banners are displayed properly!
In a SoD mod somehow mod-makers managed to add 15 pages of banners!
Who realties can tell me how add more pages of banners?
 
I have searched the forom and found several old posts indicating that the command "stop_all_sounds" does not work.  I can't get it to work.  How do you stop a sound once it starts?
 
Status
Not open for further replies.
Back
Top Bottom