Modding Q&A [For Quick Questions and Answers]

Currently viewing this thread:

Status
Not open for further replies.

Nate

Knight at Arms
M&BWB
For the present I was going to ignore it--that's pretty much the plan until I get good enough w/ the MS to excise the SP-only code. I had been afraid that this would cause some interference somehow even for MP, but your assertion makes me more confident that this sort of thing wouldn't be problematic.

By the way, for naming slots, are you restricted to using the vanilla naming convention? For example, in naming slots that are meant to be used for dummy troops, does slot_troop_ have to go before it, or is this a technically unnecessary naming convention? I guess the underlying question is how the game/engine determines a slot's type. Is it the naming convention or the combination of position and numbering in module_constants?
 

DarkNord

Sergeant
https://forums.taleworlds.com/index.php?topic=50086.0 can i use these models in warband and is there more topics like this with osps for warband?
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Nate said:
s this a technically unnecessary naming convention?

look at scripts.txt, ... Do you see the names in there? Nope, because they only use the number (value), so the name is up to you

Naming convention is good, but as you will soon find out Native modules are not keen on following even their own rules  :mrgreen:. Its not what we would call pretty code, but at least it works (most of the time)

If you can do better it will make your life easier. If you want to learn more check books on clean code.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Nate said:
What is the maximum number of parameters you can pass with call_script?

Test it  :wink:

If you have more than 3 parameters you should stop and think: "Why am I doing this?"
--> you are already going too far

If you have 5 or more: "guess I had too much ale"
--> lost your way a couple miles back

If you have 10 or more: "weed and coding don't match"
--> GPS is just broken

(Native has one script "set_items_for_tournament_new" with 10, but you already knew that, because you looked at the code before posting here, right?)
 

Nate

Knight at Arms
M&BWB
kalarhan said:
Test it  :wink:

Well, I did some research, but I was more interested in this question b/c I'm anticipating a lot of call_script use in the future, and I thought it would be a good fact to know. I did review some of the scripts, but not comprehensively. In a post from early July you wrote, "TLDR: only use parameters if you need them . . .  they are optional," and this squared up w/ the other stuff I read about generally preferring informal to formal params for scripts.
 

K.A.

Sergeant at Arms
WBWF&SVC
Hi. I need to align a scene prop to another one while it's animating. I was able to align to z angle but i can't align it to x. Practically this scene prop should gradually adapt to the position of the other one while is animating. The result is the scene prop will be perpendicular to the other one (already done) and will be in front of it.
 

K.A.

Sergeant at Arms
WBWF&SVC
Well, there isn't a specific code for that because i can't figure how i can do it. I was able to make the scene prop reach the other one perpendicularly but not aligned to x axis. I want to achieve something similar to what the siege towers do. The siege towers move gradually to the final position.
 

_Sebastian_

Punkbuster 2.0
Baron
NWWBVC
What's so difficult to achieve that?

Set up the target position of the main prop and then move the position localy by a specific offset on each axis (depending where the sub prop should be located).
Then just animate both to their target positions.
 

_Sebastian_

Punkbuster 2.0
Baron
NWWBVC
K.A. said:
Do you mean convert the target to local position with position_transform_position_to_local ?
Nope.
Code:
position_move_x                             =  720  # (position_move_x, <position>, <movement>, [value]),
                                                    # Moves position along X axis. Movement distance is in cms. Optional parameter determines whether the position is moved along the local (value=0) or global (value=1) X axis (i.e. whether the position will be moved to it's right/left, or to the global east/west).
Locally, so [value] stays 0.
 

K.A.

Sergeant at Arms
WBWF&SVC
Ah, ok. Let's see if i understood correctly. I get the position of target prop to pos1, for example. Then using (position_move_x, pos1, 40, 0) this will move the prop to target prop of 40 cms. Right ?
 
What is that problem, armor stretched.I get this error sometimes.
3oXzl0.jpg
cwe osp
 

fladin

Baron
M&BWBWF&SNWVC
Question 1 : (bug) 1000 denars to upgrade  a mid tier troop (an unique case, all others upgrades are fine)

6eJ35xk.jpg
73zYXZm.jpg
Wz207x3.jpg
has someone  already came upon the same problem?

Question 2 : in single player, is it  possible to force the  first person view (R key) during mission  ?

Thank you
 
  # script_game_get_upgrade_cost
  # This script is called from game engine for calculating needed cost upgrade
  # Input:
  # param1: troop_id,
  # Output: reg0 = needed cost for upgrade
  ("game_get_upgrade_cost",
    [
      (store_script_param_1, ":troop_id"),
     
      (store_character_level, ":troop_level", ":troop_id"),
     
      (try_begin),
        (is_between, ":troop_level", 0, 6),
        (assign, reg0, 10),
      (else_try),
        (is_between, ":troop_level", 6, 11),
        (assign, reg0, 20),
      (else_try),
        (is_between, ":troop_level", 11, 16),
        (assign, reg0, 40),
      (else_try),
        (is_between, ":troop_level", 16, 21),
        (assign, reg0, 80),

      (else_try),
        (is_between, ":troop_level", 21, 26),
        (assign, reg0, 120),
      (else_try),
        (is_between, ":troop_level", 26, 31),
        (assign, reg0, 160),
      (else_try),
        (assign, reg0, 200),
      (try_end),
     
      (set_trigger_result, reg0),
  ]),
 
Status
Not open for further replies.
Top Bottom