Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Still is happening same thing. Anybody else know my problem?
Codes(scripts:
(troop_set_slot, "trp_ct_inf_1", slot_troop_name, "str_ct_inf_1_name"),
      (troop_set_slot, "trp_ct_inf_1", slot_troop_desc, "str_ct_inf_1_desc"),

Codes:sad:prnst)

(troop_get_slot, ":n", "$chosen_unit", slot_troop_name),
      (troop_get_slot, ":d", "$chosen_unit", slot_troop_desc),
      (str_store_string, s1, ":n"),
      (str_store_string, s2, ":d"),

Test Codes:
(display_message, "@Unit's name is {s1}."),
      (display_message, "@Unit's description is {s2}"),
 
Kortlcha said:
But I want to set a string as local variable. I want to do this.

guess I was not clear. I was not asking how you were doing it (as it doesn't work anyway), but the idea behind it (the why, description, design). Not code.

anyway @Leonion is showing above one way to do that may work for your case. If you need further help, then try to answer my earlier question.

Remember that when working with strings you are using a index. Module_strings.py/strings.txt has strings, quick_strings.txt has the quick strings. Different types of strings. One uses this format "str_my_string_name", the other "@something_here".

Cheers
 
Sorry for my bad english, I understood as like "send codes". I want to set a description to a unit like RTW1. I tried to do that with slots. I want to set a desc to unit, than get that desc and show it in the text overlay. I tried both quick and game strings. Almost copy pasted game's codes. But the game always says "no string".

Edit:
When I enter it first, not selected any combo buttons, codes working correctly. Maybe codes of this trigger can help you guys;
Code:
(ti_on_presentation_event_state_change,
     [
      (store_trigger_param_1, ":object"),
      (store_trigger_param_2, ":val"),

      (try_begin),
      (eq, ":object", "$set_which_unit_to_select"),
      (assign, "$chosen_unit", ":val"),
      (presentation_set_duration, 0),
      (start_presentation, "prsnt_custom_unit_sceen_a"),
      (else_try),
      (eq, ":object", "$cik_su_prnstdan_test"),
      (presentation_set_duration, 0),
      (try_end),
      ]),
 
Kortlcha said:
Sorry for my bad english, I understood as like "send codes". I want to set a description to a unit like RTW1. I tried to do that with slots. I want to set a desc to unit, than get that desc and show it in the text overlay. I tried both quick and game strings. Almost copy pasted game's codes. But the game always says "no string".
You're using a global variable "$chosen_unit".
Make sure it actually has data in it and this data is actually a proper troop's id.

Because no_string means string 0, which in turn means the particular slot of a chosen troop is empty.

Kortlcha said:
Edit:
When I enter it first, not select any combo buttons, codes working correctly.
Then I bet your combo buttons overwrite "$chosen_unit".

Kortlcha said:
(store_trigger_param_2, ":val"),
(assign, "$chosen_unit", ":val"),
AFAIR, ":val" is not troop's id, merely an object's value (like 0-...).
You need to assign a proper id yourself using ":val" as an offset.
Like
(store_add, ":troop_id", ":val", my_troops_begin),
 
kalarhan said:
HyperCharge said:
How can I make some sort of gravity

you can spawn a entity and push it

you can spawn a static entity and animate movement from X to Y

first is easier, but lacks control of destination
second is harder to make look good, but you can easily choose destination

see header_operations.py

Here is what I've done:

Code:
(0,0,0,#ball gravity
      [
	  (call_script, "script_cf_ball_gravity", "$fired_rock"),
      ],
      []),
				

    (0.01, 0, 0,
    [       #firing the rock
         #(prop_instance_enable_physics, "$fired_rock", 1),
      (gt, "$fire_sequence", 0),
            (prop_instance_get_position,pos1,"$fired_rock"),		###### missile flight
			 (copy_position,pos2,pos1),
			 (position_get_z,":z_missile",pos1),
			 (position_set_z_to_ground_level, pos2),
			 (position_get_z,":z_ground",pos2),
			 (val_sub,":z_missile",":z_ground"),
			 (try_begin),
			 (gt,":z_missile",50),							###### when ground is far away, fly the missile
			 (try_begin),
			     (eq, reg60, 1), #power
				(position_move_x,pos1,100),#changed from Y *was wrong side
				#(position_move_z,pos1,1),
			 (else_try),
			     (eq, reg60, 2),
				(position_move_x,pos1,20),		
			 (else_try),
			     (eq, reg60, 3),
				(position_move_x,pos1,30),	
			 (else_try),
			     (eq, reg60, 4),
				(position_move_x,pos1,40),	
			 (else_try),
			     (eq, reg60, 5),
				(position_move_x,pos1,50),	
			 (else_try),
			     (eq, reg60, 6),
				(position_move_x,pos1,60),	
			 (else_try),
			     (eq, reg60, 7),
				(position_move_x,pos1,70),	
			 (else_try),
			     (eq, reg60, 8),
				(position_move_x,pos1,80),	
			 (else_try),
			     (eq, reg60, 9),
				(position_move_x,pos1,90),	
			 (else_try),
			 (is_between, reg60, 10, 15),
              #(val_max,":cur_z_speed",1700),
			               #(val_sub,":cur_z_speed", 160), 
				(position_move_x,pos1,150),	
				(position_move_z,pos1,150),
            #(position_move_z,pos1,-80),
			 (else_try),
			 (is_between, reg60, 15, 20),
				(position_move_x,pos1,200),	
			 (else_try),
			 (is_between, reg60, 20, 25),
				(position_move_x,pos1,300),	
			 (else_try),
			 (is_between, reg60, 25, 30),
				(position_move_x,pos1,400),	
			 (else_try),
			 (is_between, reg60, 30, 35),
				(position_move_x,pos1,600),	
			 (try_end),	
				#(position_move_x,pos1,-300),#changed from Y *was wrong side
				#(position_rotate_x,pos1,1),
				(prop_instance_get_position,pos6,"$fired_rock"),
				(prop_instance_animate_to_position,"$fired_rock",pos1,10),#was 10
			(try_end),
			#(position_get_distance_to_ground_level, ":destination", pos1),
        #(else_try),#or crashed? #moved to another trigger
       #firing the rock ends
       ],
    []),

Code:
("cf_ball_gravity", [
    (store_script_param_1, "$fired_rock"),
    (prop_instance_get_position,pos1,"$fired_rock"),
    #(reset_mission_timer_a), #no need.
              (eq, "$is_fired", 1),
              (store_mission_timer_a, ":a"), #start a timing (I think this starts a timing? Am I wrong?)
              (try_begin),
         (gt, ":a", 1),#If one second passed after release the ball
         (assign, ":gravity", -50),#then set the base gravity
         (try_begin),
                  (gt, ":a", 2),#if 2 second passed
             (val_add, ":gravity", -180),#increase the gravity
           (position_move_z, pos1, ":gravity"),#move the ball with new gravity
         (try_end),
              (else_try),
                  #do nothing unless time is 3!
              (try_end),
           (prop_instance_animate_to_position, "$fired_rock", pos1, 10),
           
    ]),

I can't see any reason to not fall... The ball keeps to gain height and stops at certain point at air:

Z9Wk0a.jpg
 
HyperCharge said:
I can't see any reason to not fall... The ball keeps to gain height and stops at certain point at air:

like I said you either uses physics or a animated movement. You are using a animated movement. You just used the wrong (inverted) value for your height axis.
 
kalarhan said:
Iron Sight said:
I have, over and over. That's how I came to the conclusion to call the slots that I have so far, to no avail.
call the script, simple as that.

if you have a specific issue you will need to show us ...

The specific issue was that the random castle wasn't always given to the player but I found out why and it was simple and dumb really.
I was storing the random castle reference at the menu and not in the script itself.
It seems you can assign a variable outside of a script and still use it inside of called scripts but you can't (or at least I couldn't) store and pass a random variable!?
Anywho, live and learn. Thanks.
 
1 more question, and then I will advance in modding. With these codes:
Code:
("custom_unit_sceen_a", 0, mesh_load_window, [
    (ti_on_presentation_load,
     [
      (presentation_set_duration, 999999),
      (set_fixed_point_multiplier, 1000),#create_text_overlay

#      (str_clear, s1),
#      (str_clear, s2),
#      (str_clear, s3),
#      (str_clear, s4),

      (assign, "$unit_helm_1", -1),
      (assign, "$unit_helm_2", -1),
      (assign, "$unit_helm_3", -1),
      (assign, "$unit_helm_4", -1),

      (assign, "$unit_armor_1", -1),
      (assign, "$unit_armor_2", -1),
      (assign, "$unit_armor_3", -1),
      (assign, "$unit_armor_4", -1),

      (assign, "$unit_one_handed_weapon_1", -1),
      (assign, "$unit_one_handed_weapon_2", -1),

      (assign, "$unit_two_handed_weapon_1", -1),
      (assign, "$unit_two_handed_weapon_2", -1),

      (assign, "$unit_polearm_1", -1),
      (assign, "$unit_polearm_2", -1),

      (assign, "$unit_shield_1", -1),
      (assign, "$unit_shield_2", -1),
      (assign, "$unit_shield_3", -1),

      (assign, "$unit_choose_arm_type", -1),
      (assign, "$unit_set_name", -1),
      (assign, "$unit_set_desc", -1),
      (assign, "$set_which_unit_to_select", -1),
      (assign, "$unit_write_name", -1),
      (assign, "$unit_name", -1),
      (assign, "$unit_desc", -1),

      (troop_get_slot, ":n", "$chosen_unit", slot_troop_name),
      (troop_get_slot, ":d", "$chosen_unit", slot_troop_desc),
      (str_store_string, s1, ":n"),
      (str_store_string, s2, ":d"),

      (create_combo_button_overlay, "$set_which_unit_to_select"),
      (position_set_x, pos1, 500),
      (position_set_y, pos1, 800),
      (overlay_set_size, "$set_which_unit_to_select", pos1),
      (position_set_x, pos1, 250),
      (position_set_y, pos1, 650),
     (overlay_set_position, "$set_which_unit_to_select", pos1),
       (try_for_range, ":selected_troop", "trp_ct_inf_1", "trp_traveller"),
        (str_store_troop_name, s0, ":selected_troop"),
        (overlay_add_item, "$set_which_unit_to_select", s0),
#      (try_for_range, ":selected_troop", "trp_ct_inf_1", "trp_traveller"),
#      (overlay_set_val, "$set_which_unit_to_select", ":selected_troop"),
#      (str_store_troop_name, s12, ":selected_troop"),
      (overlay_set_val, "$set_which_unit_to_select", "$chosen_unit"),
      (try_end),

     (create_text_overlay, "$unit_name", "@{s1}", tf_scrollable),
      (position_set_x, pos1, 850),
      (position_set_y, pos1, 850),
      (overlay_set_size, "$unit_name", pos1),
      (position_set_x, pos1, 500),
      (position_set_y, pos1, 650),
      (overlay_set_position, "$unit_name", pos1),
      (position_set_x, pos1, 360),
      (position_set_y, pos1, 130),
      (overlay_set_area_size, "$unit_name", pos1),

      (create_text_overlay, "$unit_desc", "@{s2}", tf_scrollable),
      (position_set_x, pos1, 850),
      (position_set_y, pos1, 850),
      (overlay_set_size, "$unit_desc", pos1),
      (position_set_x, pos1, 800),
      (position_set_y, pos1, 650),
      (overlay_set_position, "$unit_desc", pos1),
      (position_set_x, pos1, 200),
      (position_set_y, pos1, 130),
      (overlay_set_area_size, "$unit_desc", pos1),

      (create_in_game_button_overlay, "$cik_su_prnstdan_test", "@Done"),
#      (overlay_set_color, "$", 0x68eb4e),
      (position_set_x, pos1, 800),
      (position_set_y, pos1, 200),
      (overlay_set_position, "$cik_su_prnstdan_test", pos1),
      (position_set_x, pos1, 100),
      (position_set_y, pos1, 100),
      (overlay_set_size, "$cik_su_prnstdan_test", pos1),
      (display_message, "@Unit's name is {s1}."),
      (display_message, "@Unit's description is {s2}"),
      ]),
    (ti_on_presentation_event_state_change,
     [
      (store_trigger_param_1, ":object"),
      (store_trigger_param_2, ":val"),

      (try_begin),
      (eq, ":object", "$set_which_unit_to_select"),
      (store_add, "$chosen_unit", ":val", custom_unit_troops_begin),
#      (assign, "$chosen_unit", ":val"),
      (presentation_set_duration, 0),
      (start_presentation, "prsnt_custom_unit_sceen_a"),
      (else_try),
      (eq, ":object", "$cik_su_prnstdan_test"),
      (presentation_set_duration, 0),
      (try_end),
      ]),
    ]),
2 text overlay is not appearing. I copy pasted game's vanilla codes but still not appearing. I tried to test by deleting -" assign but still not appearing. How can I solve this problem?
 
I have added new lords , but i know i need to increase their number in some script/scripts. So question to everyone....Do anyone knows what is/are the script/scripts?
 
Hernanxd16 said:
KnightV said:
I have added new banners , new lords but in game appears errors which tell me that not enough banners for heroes. Help

http://forums.taleworlds.com/index.php/topic,334271.0.html
I was doing as in the tutorial as well but don't work. Besides appear error....usage of unassigned variable as in tutorial...:num_kingdom_lords
 
KnightV said:
I was doing as in the tutorial as well but don't work. Besides appear error....usage of unassigned variable as in tutorial...:num_kingdom_lords

No, that tutorial works fine. I create the new factions for my mod following all the steps from there and I don't have any problems (At least, no with banners).

Check your local variables. Probably you don't use the same name in both. For example, you write :num_kingdom_7_lords in the first line and  :num_kingdom_lords in the second, etc.
 
KnightV said:
Code:
ERROR: Usage of unassigned local variable: ::num_lords_assigned


(assign, ":num_khergit_lords_assigned", 0),
      (assign, ":num_sarranid_lords_assigned", 0),
      (assign, ":num_other_lords_assigned", 0),
      (assign, ":num_lords_assigned", 0),
           
      (try_for_range, ":kingdom_hero", active_npcs_begin, active_npcs_end),
        (this_or_next|troop_slot_eq, ":kingdom_hero", slot_troop_occupation, slto_kingdom_hero),
        (troop_slot_eq, ":kingdom_hero", slot_troop_occupation, slto_inactive_pretender),
       
        (store_troop_faction, ":kingdom_hero_faction", ":kingdom_hero"),
        (neg|faction_slot_eq, ":kingdom_hero_faction", slot_faction_leader, ":kingdom_hero"),
        (try_begin),
          (eq, ":kingdom_hero_faction", "fac_kingdom_3"), #Khergit Khanate
          (store_add, ":kingdom_3_banners_begin", banner_scene_props_begin, khergit_banners_begin_offset),
          (store_add, ":banner_id", ":kingdom_3_banners_begin", ":num_khergit_lords_assigned"),
          (troop_set_slot, ":kingdom_hero", slot_troop_banner_scene_prop, ":banner_id"),
          (val_add, ":num_khergit_lords_assigned", 1),
        (else_try),
          (eq, ":kingdom_hero_faction", "fac_kingdom_6"), #Sarranid Sultanate
          (store_add, ":kingdom_6_banners_begin", banner_scene_props_begin, sarranid_banners_begin_offset),
          (store_add, ":banner_id", ":kingdom_6_banners_begin", ":num_sarranid_lords_assigned"),
          (troop_set_slot, ":kingdom_hero", slot_troop_banner_scene_prop, ":banner_id"),
          (val_add, ":num_sarranid_lords_assigned", 1),
        (else_try),
(else_try),
          (eq, ":kingdom_hero_faction", "fac_dark_knights"), #Invaders
          (store_add, ":kingdom_7_banners_begin", banner_scene_props_begin, kingdom_7_banners_begin_offset),
          (store_add, ":banner_id", ":kingdom_7_banners_begin", "::num_lords_assigned"),
          (troop_set_slot, ":kingdom_hero", slot_troop_banner_scene_prop, ":banner_id"),
          (val_add, ":num_lords_assigned", 1),
        (else_try),

Code:
          (store_add, ":banner_id", ":kingdom_7_banners_begin", "::num_lords_assigned"),

You have two ":" in the variable.
 
Hernanxd16 said:
KnightV said:
Code:
ERROR: Usage of unassigned local variable: ::num_lords_assigned


(assign, ":num_khergit_lords_assigned", 0),
      (assign, ":num_sarranid_lords_assigned", 0),
      (assign, ":num_other_lords_assigned", 0),
      (assign, ":num_lords_assigned", 0),
           
      (try_for_range, ":kingdom_hero", active_npcs_begin, active_npcs_end),
        (this_or_next|troop_slot_eq, ":kingdom_hero", slot_troop_occupation, slto_kingdom_hero),
        (troop_slot_eq, ":kingdom_hero", slot_troop_occupation, slto_inactive_pretender),
       
        (store_troop_faction, ":kingdom_hero_faction", ":kingdom_hero"),
        (neg|faction_slot_eq, ":kingdom_hero_faction", slot_faction_leader, ":kingdom_hero"),
        (try_begin),
          (eq, ":kingdom_hero_faction", "fac_kingdom_3"), #Khergit Khanate
          (store_add, ":kingdom_3_banners_begin", banner_scene_props_begin, khergit_banners_begin_offset),
          (store_add, ":banner_id", ":kingdom_3_banners_begin", ":num_khergit_lords_assigned"),
          (troop_set_slot, ":kingdom_hero", slot_troop_banner_scene_prop, ":banner_id"),
          (val_add, ":num_khergit_lords_assigned", 1),
        (else_try),
          (eq, ":kingdom_hero_faction", "fac_kingdom_6"), #Sarranid Sultanate
          (store_add, ":kingdom_6_banners_begin", banner_scene_props_begin, sarranid_banners_begin_offset),
          (store_add, ":banner_id", ":kingdom_6_banners_begin", ":num_sarranid_lords_assigned"),
          (troop_set_slot, ":kingdom_hero", slot_troop_banner_scene_prop, ":banner_id"),
          (val_add, ":num_sarranid_lords_assigned", 1),
        (else_try),
(else_try),
          (eq, ":kingdom_hero_faction", "fac_dark_knights"), #Invaders
          (store_add, ":kingdom_7_banners_begin", banner_scene_props_begin, kingdom_7_banners_begin_offset),
          (store_add, ":banner_id", ":kingdom_7_banners_begin", "::num_lords_assigned"),
          (troop_set_slot, ":kingdom_hero", slot_troop_banner_scene_prop, ":banner_id"),
          (val_add, ":num_lords_assigned", 1),
        (else_try),

Code:
          (store_add, ":banner_id", ":kingdom_7_banners_begin", "::num_lords_assigned"),

You have two ":" in the variable.
I see it , thanks for help
 
I am having difficulty adding items to my game. When I firs started adding items to my game I found spak items an osp that had everything you needed to add the items easily. I was then able to use Morphs editor to easily adjust items in terms of cost and power. later I was shown https://forums.taleworlds.com/index.php/topic,336185.msg7971277.html#msg7971277. This mod doesn't have item kinds in it and I am having hard time figuring out how to add them into the game. The main reason is No item kind doc. The main problem I am having is how to make Item kind for each of the items.
 
Status
Not open for further replies.
Back
Top Bottom