Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Thanks Dragon!

Okay, another question: How to remove personality clashes and matches between NPC's? And the morality thingymajig (where they complain about looting villages etc)?
 
Jarvisimo said:
Okay, another question: How to remove personality clashes and matches between NPC's?

open up module_scripts and find "initialize_npcs" which is a script that deals with everything that sets NPCs apart. to stop complaints, make an NPC you'll never see and get everyone to hate him. although I think you might be able to set it to any troop (get them all to hate quick jimmy, for example) - haven't tested it though.

And the morality thingymajig (where they complain about looting villages etc)?

look at module_strings and there is a section on NPC morality. they all complain about something different, which is set in module_scripts.py by their "troop_morality_type" and "troop_2ary_morality type" in some cases. the solution is simply to reduce their "morality_value" to 0. they'll complain, but not affect relations.
 
The_dragon said:
jacobhinds said:
Make it above ground, then select all the objects and shift them underground.

I was thinking about that too, but if i make a small mistake, how would i fix it? cuz it will be insanly hard to reselect all the stuffs and move them above the ground, then fix the thing and then move them down again...is that how pw maps are made?

EDIT: i found it...i need to spawn first, and then open edit mode. if the edit mode is opened when you are spectator, you will can't fly underground.
Don't put rooms underground--you can't fire bolts or arrows if you're under the terrain. What you do is you make the building behind a large hill--anywhere out of the view of the player(s). It can even be outside the map edge.
 
Hey guys, I would have a little question:

In the presentation.py, how can I get the value of a text box in a variable/slot ?

Code:
(create_simple_text_box_overlay, "$g_my_text_box"),
(position_set_x, pos3, 170),
(position_set_y, pos3, ":cur_y"),
(overlay_set_position, "$g_my_text_box", pos3),
(overlay_set_text, "$g_my_text_box", s0),
(val_add, ":cur_y", escape_menu_item_height),

I just would need the value entered of $g_my_text_box . Thanks  :smile:.
 
Specular_shader_noskin_bump_high if it's unrigged like a weapon or helmet, and specular_shader_skin_bump_high if it's rigged like armour or boots. You'll also need to type 720 (specular and blending) into that little box labelled "flags". To find out how to use the others, just look at their uses in commonres.
 
Somebody said:
Parameter s0 within ti_on_presentation_event_state_change

Yep', that's what I have been trying to do, but no success.
Here is what I did:

Code:
(create_simple_text_box_overlay, "$g_my_text_box"),
(position_set_x, pos3, 170),
(position_set_y, pos3, ":cur_y"),
(overlay_set_position, "$g_my_text_box", pos3),
(overlay_set_text, "$g_my_text_box", s30),
(val_add, ":cur_y", escape_menu_item_height),
...
(ti_on_presentation_event_state_change,
[(store_trigger_param_1, ":object"),
(store_trigger_param_2, s30),
(str_store_string, text_box_content, s30),

But then, a: (str_store_string, s0, text_box_content), in scripts.py outputs nothing.
I also tried putting my variable in a global variable, I get a 'NO_STRING!' back.

Thanks.
 
Can someone explain how to use cast_ray operation with WSE?
(when i'm trying to use it, i receive the error that "unrecognized opcode bla bla.. at mission template bla bla...") (That's my bad, I should run game with wseloader if I want to use it's operations.)

I'm trying operations in WSE. I put this under deathmatch mt but nothing happens. (even not spawned on 0000x0000 coordinates)
Code:
(0, 0, 0, [(key_clicked,key_v),],
       [
           (get_camera_position, pos1),
           (cast_ray, ":instance_id", pos2, pos1, 10000),
           (set_spawn_position, pos2),
           (spawn_scene_prop, "spr_fire_big"),
         ]),
 
I've been trying to add an invader faction, everything seems to be fine after starting the game, the characters aren't on the map and the faction page is blank.

But when I trigger them (using a button I added in camp menu), no parties spawn and the king is reset to the generic lord title I've given the faction, within a few ingame days I get a popup saying the faction has been defeated, I'm not quite sure what's wrong: Here are the relevant sections from my .py files.

## Invasion check
  (1,
    [
      (eq,"$invaded",0),
      (ge,"$setting_invasion_time",1),
      (store_current_hours,":time"),
      (ge,":time","$setting_invasion_time"),
      (assign,"$invaded",1),
      (call_script, "script_change_troop_faction", "trp_kingdom_istria_lord", "fac_kingdom_istria"),
      (call_script, "script_change_troop_faction", "trp_istria_lord1", "fac_kingdom_istria"),
      (call_script, "script_change_troop_faction", "trp_istria_lord2", "fac_kingdom_istria"),
      (call_script, "script_change_troop_faction", "trp_istria_lord3", "fac_kingdom_istria"),
      (call_script, "script_change_troop_faction", "trp_istria_lord4", "fac_kingdom_istria"),
      (call_script, "script_change_troop_faction", "trp_istria_lord5", "fac_kingdom_istria"),
      (call_script, "script_change_troop_faction", "trp_istria_lord6", "fac_kingdom_istria"),
      (call_script, "script_change_troop_faction", "trp_istria_lord7", "fac_kingdom_istria"),
 
  (try_begin),
(store_random_in_range,":rand",0,1),
      (try_begin),
        (eq,":rand",0),
        (assign, ":center_no", "p_town_10"),
        (set_relation, "fac_kingdom_3", "fac_kingdom_istria", -40),
        (str_store_faction_name,s1,"fac_kingdom_3"),
      (else_try),
    (eq,":rand",1),
        (assign, ":center_no", "p_town_12"),
        (set_relation, "fac_kingdom_4", "fac_kingdom_istria", -40),
        (str_store_faction_name,s1,"fac_kingdom_4"),
      (try_end),
  (str_store_faction_name,s3,"fac_player_supporters_faction"),
 
  (else_try), 
          # player is unattached
          (neq, "$players_kingdom", "fac_kingdom_1"),
          (neq, "$players_kingdom", "fac_kingdom_2"),  
          (neq, "$players_kingdom", "fac_kingdom_3"),
          (neq, "$players_kingdom", "fac_kingdom_4"),
          (neq, "$players_kingdom", "fac_kingdom_5"),
          (neq, "$players_kingdom", "fac_kingdom_6"),
      (store_random_in_range,":rand",0,1),
      (try_begin),
        (eq,":rand",0),
        (assign, ":center_no", "p_town_10"),
        (set_relation, "fac_kingdom_3", "fac_kingdom_istria", -40),
        (set_relation, "fac_kingdom_2", "fac_kingdom_istria", -40),
        (str_store_faction_name,s1,"fac_kingdom_3"),
        (str_store_faction_name,s3,"fac_kingdom_2"),
      (else_try),
    (eq,":rand",1),
        (assign, ":center_no", "p_town_12"),
        (set_relation, "fac_kingdom_4", "fac_kingdom_istria", -40),
        (set_relation, "fac_kingdom_2", "fac_kingdom_istria", -40),
        (str_store_faction_name,s1,"fac_kingdom_4"),
        (str_store_faction_name,s3,"fac_kingdom_2"),
      (try_end), 


      (str_store_faction_name,s2,"fac_kingdom_istria"),
      (display_log_message, "@{s2} has declared war against {s1}."),
      (display_log_message, "@{s2} has declared war against {s3}."),
  (troop_set_slot, "trp_kingdom_istria_lord", slot_troop_age, 30),
      (call_script, "script_create_kingdom_hero_party_istria", "trp_kingdom_istria_lord", ":center_no"),
  (troop_set_slot, "trp_istria_lord1", slot_troop_age, 37),
      (call_script, "script_create_kingdom_hero_party_istria", "trp_istria_lord1", ":center_no"),
  (troop_set_slot, "trp_istria_lord2", slot_troop_age, 31),
      (call_script, "script_create_kingdom_hero_party_istria", "trp_istria_lord2", ":center_no"),
  (troop_set_slot, "trp_istria_lord3", slot_troop_age, 26),
      (call_script, "script_create_kingdom_hero_party_istria", "trp_istria_lord3", ":center_no"),
  (troop_set_name, "trp_istria_lord4",  "@Seer Uriel Khaldun"),
  (troop_set_slot, "trp_istria_lord4", slot_troop_age, 43),
      (call_script, "script_create_kingdom_hero_party_istria", "trp_istria_lord4", ":center_no"),
  (troop_set_slot, "trp_istria_lord5", slot_troop_age, 22),
      (call_script, "script_create_kingdom_hero_party_istria", "trp_istria_lord5", ":center_no"),
  (troop_set_slot, "trp_istria_lord6", slot_troop_age, 52),
      (call_script, "script_create_kingdom_hero_party_istria", "trp_istria_lord6", ":center_no"),
  (troop_set_slot, "trp_istria_lord7", slot_troop_age, 36),
      (call_script, "script_create_kingdom_hero_party_istria", "trp_istria_lord7", ":center_no"),
      (call_script, "script_update_all_notes"),
  (call_script, "script_appoint_faction_marshall", "fac_kingdom_istria", "trp_kingdom_istria_lord"), 
    (faction_set_slot, "fac_kingdom_istria", slot_faction_ai_state, sfai_attacking_center),
        (faction_set_slot, "fac_kingdom_istria", slot_faction_ai_object, ":center_no"),


      (party_set_faction,"p_main_party","fac_player_faction"), #This is a bug fix for a bug that sometimes does and sometimes does not show up - Jinnai
      (jump_to_menu, "mnu_istria_invasion_start_warning"),
  ]),

  # script_create_kingdom_hero_party_istria
  # Input: arg1 = troop_no, arg2 = center_no
  # Output: $pout_party = party_no
  ("create_kingdom_hero_party_istria",
    [
      (store_script_param, ":troop_no", 1),
      (store_script_param, ":center_no", 2),
   
      (store_troop_faction, ":troop_faction_no", ":troop_no"),

      (assign, "$pout_party", -1),
      (try_begin),
  (set_spawn_radius, 2),
  (try_end),
      (spawn_around_party, ":center_no", "pt_kingdom_hero_party"), 
      (assign, "$pout_party", reg0),
     
      (party_set_faction, "$pout_party", ":troop_faction_no"),
      (party_set_slot, "$pout_party", slot_party_type, spt_kingdom_hero_party),
      (call_script, "script_party_set_ai_state", "$pout_party", spai_undefined, -1),
      (troop_set_slot, ":troop_no", slot_troop_leaded_party, "$pout_party"),
      (party_add_leader, "$pout_party", ":troop_no"),
      (str_store_troop_name, s5, ":troop_no"),
      (party_set_name, "$pout_party", "str_s5_s_party"),
     
      (party_set_slot, "$pout_party", slot_party_commander_party, -1), #we need this because 0 is player's party!

      #Setting the flag icon
      #normal_banner_begin
      (troop_get_slot, ":cur_banner", ":troop_no", slot_troop_banner_scene_prop),
      (try_begin),
        (gt, ":cur_banner", 0),
        (val_sub, ":cur_banner", banner_scene_props_begin),
        (val_add, ":cur_banner", banner_map_icons_begin),
        (party_set_banner_icon, "$pout_party", ":cur_banner"),
      #custom_banner_begin
      #(troop_get_slot, ":flag_icon", ":troop_no", slot_troop_custom_banner_map_flag_type),
      #(try_begin),
      #  (ge, ":flag_icon", 0),
      #  (val_add, ":flag_icon", custom_banner_map_icons_begin),
      #  (party_set_banner_icon, "$pout_party", ":flag_icon"),
      (try_end),

      (try_begin),
        #because of below two lines, lords can only hire more than one party_template(stack) at game start once a time during all game.
        (troop_slot_eq, ":troop_no", slot_troop_spawned_before, 0),
        (troop_set_slot, ":troop_no", slot_troop_spawned_before, 1),
        (assign, ":num_tries", 20),
        (try_begin),
          (store_troop_faction, ":troop_kingdom", ":troop_no"),
          (faction_slot_eq, ":troop_kingdom", slot_faction_leader, ":troop_no"),
          (assign, ":num_tries", 50),
        (try_end),

        #(str_store_troop_name, s0, ":troop_no"),
        #(display_message, "{!}str_debug__hiring_men_to_party_for_s0"),

        (try_for_range, ":unused", 0, ":num_tries"),
          (call_script, "script_hire_men_to_kingdom_hero_party", ":troop_no"),
        (try_end),
       
        (assign, ":mad:p_rounds", 0),

        (game_get_reduce_campaign_ai, ":reduce_campaign_ai"),
        (try_begin),
          (this_or_next|eq, ":troop_faction_no", "$players_kingdom"),
          (eq, ":troop_faction_no", "fac_player_supporters_faction"),
          (assign, ":mad:p_rounds", 0),
        (else_try),
          (eq, ":reduce_campaign_ai", 0), #hard
          (assign, ":mad:p_rounds", 2),
        (else_try),
          (eq, ":reduce_campaign_ai", 1), #moderate
          (assign, ":mad:p_rounds", 1),
        (else_try),                       
          (eq, ":reduce_campaign_ai", 2), #easy
          (assign, ":mad:p_rounds", 0),
        (try_end),         

        (troop_get_slot, ":renown", ":troop_no", slot_troop_renown),
        (store_div, ":renown_xp_rounds", ":renown", 100),
        (val_add, ":mad:p_rounds", ":renown_xp_rounds"),
        (try_for_range, ":unused", 0, ":mad:p_rounds"),
          (call_script, "script_upgrade_hero_party", "$pout_party", 4000),
        (try_end),
      (try_end),     
  ]),
 
minnakodunum said:
I'm trying operations in WSE. I put this under deathmatch mt but nothing happens. (even not spawned on 0000x0000 coordinates)
IIRC the camera "looks" towards the up axis, so you might have to rotate that position (by 90 or -90 degrees over x, don't remember which one) before you pass it to cast_ray.
 
cmpxchg8b said:
minnakodunum said:
I'm trying operations in WSE. I put this under deathmatch mt but nothing happens. (even not spawned on 0000x0000 coordinates)
IIRC the camera "looks" towards the up axis, so you might have to rotate that position (by 90 or -90 degrees over x, don't remember which one) before you pass it to cast_ray.
Tried but couldn't managed it. This time, game creates the scene prop on 0000x0000 coordinates. Even if I'm in an interior scene prop. (surrounded by walls). I think cast_ray never got a position of an intersect. So game created scene prop on default coordinates.
 
Used "mission_cam_get_position" instead of "get_camera_position" and it worked. But there is still a little trouble, it creates the fire about 100 pixels left from the center of the screen. (scene prop's origin is right there).
 
Is there a way to change projectile speed throught scripting (outside the module_items.py)?

I want to make ranged weapons unable to shoot so far during bad weather conditions, like fog, rain, or snow. The only way I know to reduce range is to reduce the projectile speed...
 
Ra'Jiska said:
Code:
(create_simple_text_box_overlay, "$g_my_text_box"),
(position_set_x, pos3, 170),
(position_set_y, pos3, ":cur_y"),
(overlay_set_position, "$g_my_text_box", pos3),
(overlay_set_text, "$g_my_text_box", s30),
(val_add, ":cur_y", escape_menu_item_height),
...
(ti_on_presentation_event_state_change,
[(store_trigger_param_1, ":object"),
(store_trigger_param_2, s30),
(str_store_string, text_box_content, s30),

But then, a: (str_store_string, s0, text_box_content), in scripts.py outputs nothing.
I also tried putting my variable in a global variable, I get a 'NO_STRING!' back.
It doesn't work because you're mixing types. Unless you actually have text_box_content mapped a dedicated string register, none of those will work. You also can't get it as a trigger parameter (only the object param is valid) - s0 is already filled with the content, so do a str_store_string_reg (although str_store_string will probably work).

cucas said:
Is there a way to change projectile speed throught scripting (outside the module_items.py)?

I want to make ranged weapons unable to shoot so far during bad weather conditions, like fog, rain, or snow. The only way I know to reduce range is to reduce the projectile speed...
Consider what you're trying to accomplish and whether it's feasible or not - are you able to predict the weather system? It is possible to intercept when ranged weapons are shot, and you are able to modify the shoot speed so the projectile falls straight down. While you can use add_missile to create your custom projectile, the AI won't know that unless you create duplicate versions of every item for the player and AI - these are some of the obvious ramifications with over-engineering this feature, considering there already is a penalty for crossbow types during rain hardcoded in the engine.
 
Status
Not open for further replies.
Back
Top Bottom