Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Hi all,

I've been trying to add family relations to kings but so far it hasn't been successful. The game ignores children, spouses and any family relation. I can't actually figure out why, as I thought the kings were treated as troops like the other lords. What gives? Is this hardcoded?
 
Figured out what was the problem. If anyone has this doubt in the future, just search for this section in module_script.py and change all instances of lords_begin to kings_begin.

Code:
 #Family notes
      (try_begin),
        (this_or_next|is_between, ":troop_no", lords_begin, kingdom_ladies_end),
        (eq, ":troop_no", "trp_player"),
        (neg|is_between, ":troop_no", pretenders_begin, pretenders_end),
        (assign, ":num_relations", 0),

        (try_begin),
          (call_script, "script_troop_get_family_relation_to_troop", "trp_player", ":troop_no"),
          (gt, reg0, 0),
          (val_add, ":num_relations", 1),
        (try_end),
        (try_for_range, ":aristocrat", lords_begin, kingdom_ladies_end),
          (call_script, "script_troop_get_family_relation_to_troop", ":aristocrat", ":troop_no"),
          (gt, reg0, 0),
          (val_add, ":num_relations", 1),
        (try_end),
        (try_begin),
          (gt, ":num_relations", 0),
          (try_begin),
            (eq, ":troop_no", "trp_player"),
            (str_store_string, s49, "str__family_"),
          (else_try),
            (troop_get_slot, reg1, ":troop_no", slot_troop_age),
            (str_store_string, s49, "str__age_reg1_family_"),
          (try_end),
          (try_begin),
            (call_script, "script_troop_get_family_relation_to_troop", "trp_player", ":troop_no"),
            (gt, reg0, 0),
            (str_store_troop_name_link, s12, "trp_player"),
            (val_sub, ":num_relations", 1),
            (try_begin),
              (eq, ":num_relations", 0),
              (str_store_string, s49, "str_s49_s12_s11_end"),
            (else_try),
              (str_store_string, s49, "str_s49_s12_s11"),
            (try_end),
          (try_end),
          (try_for_range, ":aristocrat", lords_begin, kingdom_ladies_end),
            (call_script, "script_troop_get_family_relation_to_troop", ":aristocrat", ":troop_no"),
            (gt, reg0, 0),
            (try_begin),
              (neg|is_between, ":aristocrat", kingdom_ladies_begin, kingdom_ladies_end),
              (eq, "$cheat_mode", 1),
              (str_store_troop_name_link, s12, ":aristocrat"),
              (call_script, "script_troop_get_relation_with_troop", ":aristocrat", ":troop_no"),
              (str_store_string, s49, "str_s49_s12_s11_rel_reg0"),
            (else_try),
              (str_store_troop_name_link, s12, ":aristocrat"),
              (val_sub, ":num_relations", 1),
              (try_begin),
                (eq, ":num_relations", 0),
                (str_store_string, s49, "str_s49_s12_s11_end"),
              (else_try),
                (str_store_string, s49, "str_s49_s12_s11"),
              (try_end),
            (try_end),
          (try_end),
        (try_end),
      (try_end),
 
Hi


I'm back to ask you some help.
This is my question:

I arranged the code to recruit different recruits to a village. But I would like it to show the cost of new recruits that is different from standard recruits.
The game displays the same cost for all recruits

What should I change, I tried various things but without success.

Volunteer recruit: 10 denars
Aventurier: 100 denars
Aventuriere: 50 denars

152501099844977173.jpg





Thank you.
Have a good day.
 
lolitablue said:
I arranged the code to recruit different recruits to a village. But I would like it to show the cost of new recruits that is different from standard recruits.

the price is being displayed by using {reg6}. So use two more variables (registers) for your calculation and display

Code:
Recruit them as {s3} ({reg6} denars).",
Or recruit them as Aventurier ({reg6} denars)."
 
kalarhan said:
lolitablue said:
I arranged the code to recruit different recruits to a village. But I would like it to show the cost of new recruits that is different from standard recruits.

the price is being displayed by using {reg6}. So use two more variables (registers) for your calculation and display

Code:
Recruit them as {s3} ({reg6} denars).",
Or recruit them as Aventurier ({reg6} denars)."

Hi kalarhan

Is it a line like the one I need to create?

  (store_mul, reg6, ":volunteer_amount", 10),#10 denars per man

For example:

  (store_mul, reg6, ":aventurier_amount", 100),#100 denars per man
 
lolitablue said:
Is it a line like the one I need to create?

  (store_mul, reg6, ":volunteer_amount", 10),#10 denars per man

For example:

  (store_mul, reg6, ":aventurier_amount", 100),#100 denars per man

yes and no.

yes you need to add new calculation for each group cost.
no you cant use the same register. Each register can only have one value at time. If you re-use reg6 then all costs will be for your third option. Use {reg6}, {reg7} and {reg8} as a example. Dont forget to use those same registers on your scripts to retrieve the cost.

Code:
  (store_mul, reg6, ":volunteer_amount", 10),#10 denars per man
  (store_mul, reg7, ":aventurier_amount", 100),#100 denars per man
  (store_mul, reg8, ":third_option_amount", 1000),#1000 denars per man

remember that registers are global, so you can use them on your script like this

Code:
("village_recruit_personal",
   (assign, ":gold_cost", reg7), # a example, check your variables

you can do the same for the quantity. No need to do the math twice.
 
Hi,




kalarhan said:
lolitablue said:
Is it a line like the one I need to create?

  (store_mul, reg6, ":volunteer_amount", 10),#10 denars per man

For example:

  (store_mul, reg6, ":aventurier_amount", 100),#100 denars per man

yes and no.

yes you need to add new calculation for each group cost.
no you cant use the same register. Each register can only have one value at time. If you re-use reg6 then all costs will be for your third option. Use {reg6}, {reg7} and {reg8} as a example. Dont forget to use those same registers on your scripts to retrieve the cost.

Code:
  (store_mul, reg6, ":volunteer_amount", 10),#10 denars per man
  (store_mul, reg7, ":aventurier_amount", 100),#100 denars per man
  (store_mul, reg8, ":third_option_amount", 1000),#1000 denars per man

remember that registers are global, so you can use them on your script like this

Code:
("village_recruit_personal",
   (assign, ":gold_cost", reg7), # a example, check your variables

you can do the same for the quantity. No need to do the math twice.

I tried several things but without success, I still have the built_module that sends me "unassigned variable"!




Can you explain to me what is the red number in the "Conditions" list (30, 31, 32)? Thank you
Is it an example?


Code:
    

#--------------------------------------------------------------------------
# CONDITION OPERATIONS
#--------------------------------------------------------------------------

ge           = 30  # greater than or equal to -- (ge,<value>,<value>),
eq           = 31  # equal to		      -- (eq,<value>,<value>),
gt           = 32  # greater than	      -- (gt,<value>,<value>),

is_between   = 33  # (is_between,<value>,<lower_bound>,<upper_bound>), #greater than or equal to lower bound and less than upper bound

   
 
@up what do you  exactly not understand ?


If the condition does not come true, the script will  die.Or if you added else_try, the script will try the next block.




Its posible to use equal to operation with strings? For example get welcome message  , and compare it with another string. If they diffrent die script.im just wondering how to give server owners chance to disable client side script.
 
lolitablue said:
Can you explain to me what is the red number in the "Conditions" list (30, 31, 32)? Thank you
Is it an example?


Code:
    

#--------------------------------------------------------------------------
# CONDITION OPERATIONS
#--------------------------------------------------------------------------

ge           = 30  # greater than or equal to -- (ge,<value>,<value>),
eq           = 31  # equal to		      -- (eq,<value>,<value>),
gt           = 32  # greater than	      -- (gt,<value>,<value>),

is_between   = 33  # (is_between,<value>,<lower_bound>,<upper_bound>), #greater than or equal to lower bound and less than upper bound

   

The Warband engine doesn’t speak English. It only deals with numbers. Each operation has a number so the engine knows which operation has been called. It’s just an identifying sequence number. When you get compilation error messages, they give the problem operation number, which can be looked up in header_operations.py to see where the engine is stuck.

Edit - operations numbers are refered to in error reports in the rgl.log rather than the compilation report :oops:
 
NPC99 said:
... ... It’s just an identifying sequence number. When you get compilation error messages, they give the problem operation number, which can be looked up in header_operations.py to see where the engine is stuck.

I always wondered what these numbers were in the compilation...

Ok, now I understand. Thank you very much!

 
lolitablue said:
Ok, I send you the compil... I'm lost

Code:
(assign, "aventurier_amount", 0)

unrecognized tag means the compiler cant understand what you are trying to say. As you can see above, you forgot the tag mark for a local variable ":mad:xxxx"

you can copy the compiler log (the text), you dont need to take a screenshot
 
kalarhan said:
lolitablue said:
Ok, I send you the compil... I'm lost

Code:
(assign, "aventurier_amount", 0)

unrecognized tag means the compiler cant understand what you are trying to say. As you can see above, you forgot the tag mark for a local variable ":mad:xxxx"

you can copy the compiler log (the text), you dont need to take a screenshot

For the first time I compil since some days I haven't any error when compil end but...

In game this is what is displayed:

1525100049675378657.jpg


0 denars !
... but if I click on "Aventurier" I pay 40 denars (2x20 denars as to recruit swadians)!
 
lolitablue said:
... but if I click on "Aventurier" I pay 40 denars (2x20 denars as to recruit swadians)!

again show the code  :mrgreen:, cant guess what you have there

your last post had this equation

x = 0
y = x * 50 :: y = 0

(you forgot to fill the x value, or ":aventurier_amount")
 
kalarhan said:
lolitablue said:
... but if I click on "Aventurier" I pay 40 denars (2x20 denars as to recruit swadians)!

again show the code  :mrgreen:, cant guess what you have there

your last post had this equation

x = 0
y = x * 50 :: y = 0

(you forgot to fill the x value, or ":aventurier_amount")

This my modified code...

 
kalarhan said:
lolitablue said:
This my modified code...

x = 0
y = x * 100
There are some changes but it is not yet that....

I have to multiply the price by the number of recruitable men ie. 100*2


Edit:
Hey man, I think that I had found the solution:
(assign, ":aventurier_amount", ":volunteer_amount",),

I will try to do the same with the third option!

Yes, I succeeded... Thank to you, kalarhan!  :razz:
and you, NPC99 and all the other who help me...  :grin:
Merci pour tout! Thanks for all your help!

You triggered my reflection I am only a beginner and it shows

152510741961145002.jpg


 
Status
Not open for further replies.
Back
Top Bottom