Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Hey guys, my stuff compiles all nice and fluffy, but when I run my mod, while loading Settings Data it crashes and i get a Visual C++ Runtime Library error saying This application has requested the Runtime to terminate in an unusual way..

I was working on creating two new start game locations. That should not be a problem because I already added another new start game location.
 
Art of Justice said:
What's the safest way to remove all the pretenders from the mod completely? Except for commenting every single line and script mentioning them.

make them spawn in the 4 ways inn or some other reduntant scene.
 
I have a big question about the world map:

I understood that the player travel between vertexes on the map. My problem is, for passage, how exactly does that work, let's say, in a valley? In the picture below I have colored two routes, the red one i think is possible while i have serious doubts about the blue one. So, is it possible to travel on "border" vertexes? vertexes that are on the border between passable and impassable terrain?

route.jpg

Thanks.

PS. for anyone out there using SCULPTRIS to work on their world maps, as I do, remember you have to UVW you model before you'll be able to import it back into the Mount&Blade Map Editor. In 3D Max i simply set an UVW plane at world scale and that was it. Also, for some reason Sculptris scaled down my map 100 000 times (the map i exported from the Editor to polish up)
 
I've been working on a little mod that swaps some equipment of some troops and a bit of renaming and I was wondering why does it make my character level 32 whenever I start the game?
 
With the addition of the "can_crouch = 1" flag in module.ini and the code posted by Dunde and Sebastion (?) it seems as if you can add crouching into Warband.  What I wanted to know is if it's possible to force reloading of crossbows to involve standing up first.  I guess the ideal would be to automatically stand, load crossbow and then crouch again just by clicking to reload but I'm guessing that would require a new full crossbow reload animation?  Forcing someone to manually stand before reloading a crossbow might be possible via a trigger, but the AI wouldn't cope and all crouching crossbow-wielding NPCs would just sit there after firing once I'm guessing -- so automatic would be better.

Even better would be a new flag that the AI takes into account eg. itp_cant_reload_while_crouched.

Sorry, I've not worked on my mod for well over a year and barely remember any of this now so I may be asking a dumb question.
 
I was wondering if someone could point me in the right direction into how I would code it so that troops spawned in certain "special" locations only attack the player when he is close to them. Any help is much appreciated  :grin:
 
Hi, when using Nord Champion's exellent faction creating tutorial... http://forums.taleworlds.com/index.php/topic,128647.0.html

I succesfully created 5 new factions using this tutorial but now I want to create 1-2 cultures that are available for the player kindom to chose from. I do not want this new faction to appear as a regular faction, only if the player choses that culture should it exist. So...
Which steps should I avoid except the obvious town and lord steps?

I would appreciate some quick help.  :smile:
 
La Grandmaster said:
I was wondering if someone could point me in the right direction into how I would code it so that troops spawned in certain "special" locations only attack the player when he is close to them. Any help is much appreciated  :grin:

first add a new constant in the module_constants file right after "slot_agent_duel_start_time        = 22"...
you can make it slot_agent_special_spawn  =23

then check if that agent is spawned in that "special" location(idk how...)
then if it is yes,use (agent_set_slot,<agent_id>,<slot_no>,<value>), operation and put value 1,else put value 0.

(were agent_id is the id of the spawned agent,slot_no will be slot_agent_special_spawn(in our case) and the value will be 1 if it is spawned in that location,or 0)

then make a trigger wich will check the distance between you and every agent
it should be something like this:
Code:
(1,0,0,[],
[
(try_for_agents, ":cur_agent"),
   (agent_is_non_player, ":cur_agent"),
     (agent_is_alive,":cur_agent"),
       (try_begin),
          (agent_get_slot,":spawned_special",":cur_agent",slot_agent_special_spawn),
            (eq,":spawned_special",1),
            (try_begin),
              (agent_get_position,pos1,":cur_agent"),
              (agent_get_position,pos2,":my_agent"), #  (note that my agent is the agent id of the player...)
              (get_distance_between_positions,":dist",pos1,pos2),
              (lt,":dist", 100),  # (100 or less is the distance that will trigger the atack target,you can change it...100 means 1 meter)
                   (agent_set_look_target_agent, ":cur_agent", ":my_agent"),  #i am not 100% sure that this operation will make it to atack
            (try_end),
       (try_end),
(try_end),
]

in the code above you also need to specifie the player agent id....
i hope that this will help you...
 
The_dragon said:
do you mean when you are in the free map(single player) or in a battle/siege?

The scenes I would use it in would be similar to the bandit camp scenarios in native just I would make it so that enemy troops only move and attack the player once he is close to them (or within range or whatever). Is their a way of disabling their ai until the player is within range? or I suppose I could possibly just decrease their speed to 0 until the player is within range (although this is far from ideal as ranged units would still attack ect)
 
I've a very queer bug. I've added an entry point to the scene and once I reloaded it, the lord moved from his usual location into the fireplace (where there's no AI mesh). Then I removed that entrypoint I added before and tried to get back to initial state of the scene. But the lord just keeps standing there. What the hell? There's no entrypoint under him, I even deleted fireplace but he's still there everytime I start new game and check the scene.
ZvvCiO1.jpg
 
The_dragon, I altered your code a bit.  This probably still isn't right, but it's a start.

module_mission_templates.py add this trigger to any scene you want to use this in:
Code:
# Run through this every second.  You don't want to do this in scenes with tons of agents.
(1,0,0,[],
[
(try_for_agents, ":cur_agent"),
    (agent_is_non_player, ":cur_agent"),
    (agent_is_alive,":cur_agent"),
    (try_begin),
        # Get (supposedly) the spawn location of agent selected by our loop.
        # Not sure this will work as is, might have to add a spawn trigger to set this manually as it is set in another (potentially unrelated) trigger.
        (agent_get_slot,":spawn_loc",":cur_agent", slot_agent_spawn_entry_point),
        # Replace <number> with the spawn location that is your "special spawn location" number.
        (eq,":spawn_loc", <number>),
            (try_begin),
                # Position of agent currently selected by our loop.
                (agent_get_position,pos1,":cur_agent"),
                # Position of player.
                (agent_get_position,pos2,":my_agent"),
                # Get distance between agent and player.
                (get_distance_between_positions,":dist", pos1, pos2),
                # Check to see if agent is in aggro range.
                # <aggro range> is the range the player has to be under before the NPC decides to attack.  100 = 1m, so 1000 = 10m.
                (lt,":dist", <aggro range>),
                # Check to see if agent can "see" player. You don't want them spotting you through buildings.
                (agent_is_in_line_of_sight, ":my_agent", pos1), # rotation of the position register is not used.
                # Agent can see player and is in range, set player as their enemy.
                # You may need a spawn trigger to make sure all NPC agents spawned in this location have relation to player set as 0 (neutral).
                (agent_add_relation_with_agent, ":cur_agent", ":my_agent", -1), #-1 = enemy, 0 = neutral (no friendly fire at all), 1 = ally
                # You may need a spawn trigger to make sure all NPC agents spawned in this location have alarmed set to 0.
                (agent_set_is_alarmed, ":cur_agent", 1), # 1 for enable, 0 for disable
            (try_end),
        (try_end),
    (try_end),
]
 
@derek_custer & the_dragon, thanks a lot, I managed to get most of it working myself but I couldnt get the attack part to work, I was using the agent set team operation when they had discovered the player which meant that all other units would also attack this unit as he was now on a different team. Never thought to use agent_add_relation_with_agent.    Thanks alot anyway  :grin:
 
Good day, i added some custom maps to my mod. But the pictures displayed in the selection menu are the default random ones. They do work in game, but all I need is adding a new mesh to the maps selection menu. I tried to add them at the same way they did in Native with the latest patch for Canyon and Desert Town, but i get this error.




So.. how can i replace a default picture attached to a newly added map in the Multiplayer selection menu?

EDIT: Fixed thanks to Shredzorz: I forgot to add files to the BRF.
 
La Grandmaster said:
@derek_custer & the_dragon, thanks a lot, I managed to get most of it working myself but I couldnt get the attack part to work, I was using the agent set team operation when they had discovered the player which meant that all other units would also attack this unit as he was now on a different team. Never thought to use agent_add_relation_with_agent.    Thanks alot anyway  :grin:
So it's working now then?  Brilliant!  Happy to have helped even in a small way. :smile:
 
in my mod barezan the salt merchant should give his comeback but i have problems to change the price of the salt that he sells.

Code:
  (
    "salt_mine", mnf_auto_enter,
    "You enter the salt mine.",
    "none",
    [
		(reset_price_rates,0),
## Tocan
		#(set_price_rate_for_item, "itm_salt", 50),
		(call_script, "script_game_get_item_buy_price_factor", "itm_salt"),
		(assign, reg0, 50),

		(troop_clear_inventory, "trp_salt_mine_merchant"),
        (store_random_in_range, ":rand", 9, 21),
        (gt, ":rand", 0),
        (troop_add_items,"trp_salt_mine_merchant", "itm_salt",":rand"),
## Tocan end
	],
    [
      ("enter",[],"Enter.",[(set_jump_mission,"mt_town_center"),(jump_to_scene,"scn_salt_mine"),(change_screen_mission)]),
      ("leave",[],"Leave.",[(leave_encounter),(change_screen_return)]),
    ]
  ),
 
in m&b it was no problem -> (set_price_rate_for_item, "itm_salt", 50),
i hope someone can help me...
 
Status
Not open for further replies.
Back
Top Bottom