Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.

troycall

Squire
WB
- I have no idea how to 'validate' those slots. I also can't find where I would check where those slots are being called, etc, in relation to troop_id; the recruitment scripts don't mention troop_id, as far as I can see.
What I assume he means by validation is to ensure that you aren't trying to recruit yourself to the party, you can do this with a simple neq check.
You can diagnose the slots by assigning them to a reg and then displaying the message, courtesy of kalarhan here is some code you can use:
#troop_get_slot                          =  520  # (troop_get_slot, <destination>, <troop_id>, <slot_no>),
Code:
(troop_get_slot, ":destination", "trp_name", ":slot_id"),
          #BEGIN DEBUG
          (assign, reg10, ":destination"), #Assign troop slot to display message
          (str_clear, s10), #Clear s10
          (str_store_string, s10, "@Troop: {reg10}"),
          (display_message, s10), #Display the data
          #END DEBUG

- After checking module_constants, I found a few overlapping ones which I switched out to different numbers, which didn't seem to fix anything. I'm not sure how far I can go with assigning numbers to new constants, or when constants stop having the potential to 'overlap' - it SEEMS to be the big commented title breaks, but I'm not too sure.
There are several slots with the same constants number, this is  not a problem, and you don't need a new number for every single constant, things like factions and parties for instance can have same constant number 1 to 100, they shouldn't cause issues as far as I am aware.

Really lost on this one.

Maybe I need to start from scratch, fresh Diplomacy module system, and use slot_faction_tier_X_troop and derivations thereof, instead of doing what I did. I haven't added THAT much genuinely unique code that I can't easily copy from my current module system to use in the new one, and it would mean not messing with game_start to the extent that I have (although I would be making slot_faction_tier_X_troop_female, I suppose, so still messing with a lot of things, MORE things looking at how many times slot_faction_tier_X_troop shows up by the looks of it).
As always keep backups and diagnose, retreat backwards in a binary search form if you have too many backups and can't figure a solution out.

@Kalarhan, don't worry I might have more requests for assistance at some point to ask the master guru helper himself in this thread at some point, if you ever need help with something I may be of assistance, feel free to let me know, thanks a lot for all the help yet again Kalarhan, greatly appreciate it, just incase you are wondering why I haven't asked anything lately.


 

kalarhan

Python Saint
Count
WBNWVCWF&S
TheCaitularity said:
- After checking module_constants, I found a few overlapping ones which I switched out to different numbers, which didn't seem to fix anything. I'm not sure how far I can go with assigning numbers to new constants, or when constants stop having the potential to 'overlap' - it SEEMS to be the big commented title breaks, but I'm not too sure.

I will add a few things to @Troycall answer:

1) Remember that this kind of change requires a new game, so you shouldn't test it with a old save.
^ this is a simplification, not really true on all cases, but by following this rule you avoid tech issues until you learn more about the modsys

2) To understand slots you need to learn about arrays.

:arrow: https://forums.taleworlds.com/index.php/topic,142422.0.html

You can do a google search on the subject if you need more details. Arrays are not a Warband thingy
https://en.wikipedia.org/wiki/Array_programming

3) Slots have no restriction on access. So a coding bug can easily modify the wrong value, hence why you should learn how to validate them.

4) Debug messages are your friends. Best friends. Learn about them  :smile:
https://forums.taleworlds.com/index.php/topic,347990.msg8335287.html#msg8335287
 

Ramaraunt

Hey, the character background slots are what category? player slots? Figured it out by looking at module_game_menus.py


I added a new menu to the game start, where credits for the mod i'm making are listed. However, its causing a wierd bug,where after character face and skill creation, it restarts the game menus from the begenning. Also, it never asks which kingdom you want to start in, and the starting quest doesn't happen. Instead, you spawn in a random loaction in the world map and the game starts. Any way to fix this? I can't figure out how menu_game_phase_2 is called up... Its nowhere.
 

HyperCharge

Section Moderator
M&BWBWF&SNWVC
Ramaraunt said:
Hey, the character background slots are what category? player slots? Figured it out by looking at module_game_menus.py


I added a new menu to the game start, where credits for the mod i'm making are listed. However, its causing a wierd bug,where after character face and skill creation, it restarts the game menus from the begenning. Also, it never asks which kingdom you want to start in, and the starting quest doesn't happen. Instead, you spawn in a random loaction in the world map and the game starts. Any way to fix this? I can't figure out how menu_game_phase_2 is called up... Its nowhere.

It is called from engine.
 

TurkicKhan

Grandmaster Knight
WBWF&S
I am having a deformation problem with textures after saving them as DDS files. It is not that visible at the picture but especially when i got far from object, texture starts to tingle heavily. I use GIMP as converter and i save them as DXT1. I was using paint.net before GIMP andi had the same problem. Can someone help please?

25us7lt.png

 

Ramaraunt

Having an issue with character creation. Yes I got permission to modify the OSP.

https://youtu.be/3xe6E5oCaLY
 

wrwlf

Sergeant
Ramaraunt said:
I'm wondering how physics props work. I want to make a head prop that spawns after you get decapitated. Just paste the code, thanks!

Also how do you make an invisible helmet?

If I remember correctly, I just assigned a non-existent mesh to it and made sure to set the itp_covers_head flag.

I tried something similar in the past:

 

kalarhan

Python Saint
Count
WBNWVCWF&S
Ramaraunt said:
Having an issue with character creation. Yes I got permission to modify the OSP.

https://youtu.be/3xe6E5oCaLY

Presentations have 5 main triggers.

- load: first draw of your screen, before dynamic events
- run: updates every frame (so changes stuff after load)
- event driven ones (see below)

Code:
# PRESENTATION TRIGGERS (used in module_presentations)

ti_on_presentation_load               = -60.0 # Presentation has been loaded by the engine. Use this trigger to initialize the presentation and it's overlays.

ti_on_presentation_run                = -61.0 # This trigger is activated every frame while the presentation is running. Use it to handle real-time behavior within the presentation.
    # trigger param 1 = how much time has passed since presentation has been started (in milliseconds)

ti_on_presentation_event_state_change = -62.0 # Some overlay has changed it's state (button clicked, checkbox switched state, slider moved, list has it's active element changed etc).
    # trigger param 1 = overlay_id of the object that initiated the event
    # trigger param 2 = new overlay value (if appropriate)

ti_on_presentation_mouse_enter_leave  = -63.0 # Reports that mouse cursor has entered or left an overlay.
    # trigger param 1 = overlay_id of the object that mouse enters/leaves
    # trigger param 2 = 0 if mouse enters, 1 if mouse leaves

ti_on_presentation_mouse_press        = -64.0 # A mouse click has been detected on one of presentation overlays.
    # trigger param 1 = overlay_id of the object that mouse is pressed on
    # trigger param 2 = 0: left mouse button, 1 right mouse button, 2 middle mouse button

In short: you need to capture the event (like a new value for the combobox, a mouse click, etc) and update your global, which will then be read on the next run frame and change what you see in the screen.

Make sure you are doing those steps.
 

emir512

Recruit
I used wreck with ms 1143, modmerger with additions , freelancer mm source

bfr adding freelancer files, compilation succeeded every time but after adding, it failed. See this. :cry:

*** Warband Refined & Enhanced Compiler Kit (W.R.E.C.K.) version 1.0.0 ***
Please report errors, problems and suggestions at http://lav.lomskih.net/wreck/

Loading module...C:\Documents and Settings\SALEH KAKAR\Desktop\ModSys\Module_sys
tem 1.143\util_scripts.py:84: UserWarning: Error injecting code into: party_give
_xp_and_gold
  warnings.warn("Error injecting code into: %s" % (cur_directive[1]) )
DONE.
Loading plugins... DONE.
Checking module syntax... DONE.
Allocating identifiers... DONE.
Compiling module... FAILED.
MODULE simple_triggers AGGREGATOR ERROR:
failed to compile simple trigger #111
  command [1530, 2, <trp.player[#360287970189639680]>, 'itm_trade_bread'] compil
ation fails in simple_trigger(#111).repeat_trigger(1.0) on line 14
    failed to parse operand 'itm_trade_bread' for operation troop_add_item in si
mple_trigger(#111).repeat_trigger(1.0) on line 14
      illegal reference `itm.trade_bread`


COMPILATION FAILED.

The following warnings were generated during compilation:
  duplicate entity found: itm.tutorial_sword
  duplicate entity found: itm.tutorial_axe
  duplicate entity found: itm.tutorial_spear
  duplicate entity found: itm.tutorial_club
  duplicate entity found: itm.tutorial_battle_axe
  duplicate entity found: itm.tutorial_arrows
  duplicate entity found: itm.tutorial_bolts
  duplicate entity found: itm.tutorial_short_bow
  duplicate entity found: itm.tutorial_crossbow
  duplicate entity found: itm.tutorial_throwing_daggers
  duplicate entity found: itm.tutorial_saddle_horse
  duplicate entity found: itm.tutorial_shield
  duplicate entity found: itm.tutorial_staff_no_attack
  duplicate entity found: itm.tutorial_staff
  duplicate entity found: itm.voulge
  duplicate entity found: s.npc2_kingsupport_2
  duplicate entity found: s.npc4_turn_against
  duplicate entity found: s.comment_you_were_defeated_allied_unfriendly
  duplicate entity found: s.comment_you_were_defeated_allied
  duplicate entity found: s.rebellion_agree_pitiless
  duplicate entity found: s.rebellion_agree_cunning
  duplicate entity found: s.rebellion_agree_sadistic
  duplicate entity found: s.rebellion_agree_goodnatured
  duplicate entity found: s.rebellion_agree_upstanding
  duplicate entity found: s.score
  duplicate entity found: s.routed
  duplicate entity found: s.wife
  duplicate entity found: s.husband
  duplicate entity found: s.father
  duplicate entity found: s.mother
  duplicate entity found: s.daughter
  duplicate entity found: s.son
  duplicate entity found: s.sister
  duplicate entity found: s.brother
  duplicate entity found: s.trade_explanation_dates
  duplicate entity found: s.s15
  duplicate entity found: s.he
  duplicate entity found: s.she
  duplicate entity found: s.s12
  duplicate entity found: s._family_
  duplicate entity found: s.whereabouts_unknown
  duplicate entity found: s.betrothed

Press any key to continue . . .

please help me out.
not the problem of wreck as it is also failing if I try with ordinary build module.bat  :twisted:

Plus if someone has free time, will he merge ms 1143 with freelancer just to test what's the problem, mm source freelancer is available at moddb.com
Thnx if u help me and no prblm if u don't.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
emir512 said:
I used wreck with ms 1143,

1) why are you using old 1.143? Most recent version is 1.166/1.168. Wreck already comes with a new version of modsys (and converted to the tool syntax)

2) if all you want is to merge diplomacy with native, why not look for the diplomacy mod source? 4.2 or 4.3 (check mod forum)
 

Ramaraunt

Where would I get diplo 4.3? I could only find 4.2 on the foums.


Also, my mod is going good, but I want to disable the multiplayer button. Where is the main menu presentation?
 

Proton

Sergeant Knight
WBWF&SNWVC
Ramaraunt said:
Also, my mod is going good, but I want to disable the multiplayer button. Where is the main menu presentation?

I have no clue when it comes to modding, but isn't there just a text file called "presentations"?
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Ramaraunt said:
Also, my mod is going good, but I want to disable the multiplayer button. Where is the main menu presentation?

game_variables.txt

this file defines the hardcoded values (code is inside the engine, we don't have it on modsys) for several screens, like the starting one (that has the MP button). You can simple move the button out the way and reduce the font size to zero :XD

there is a tutorial somewhere if you check the tutorial section

ps.: you can edit more things, so check the entire file for inspiration (dialogs, inventory, party screen, etc)
 

Nate

Knight at Arms
M&BWB
What is squared distance (versus regular distance)? I've been trying to figure out the difference between get_distance_between_positions and get_sq_distance_between_positions, but I think this is some concept of math that I'm unfamiliar with. When I tested this a bit, it seemed like the squared distance was not merely the value of the regular distance times itself.
 

wrwlf

Sergeant
Nate said:
What is squared distance (versus regular distance)? I've been trying to figure out the difference between get_distance_between_positions and get_sq_distance_between_positions, but I think this is some concept of math that I'm unfamiliar with. When I tested this a bit, it seemed like the squared distance was not merely the value of the regular distance times itself.

Distance squared can be calculated quicker, which means for comparisons etc it is better to use distance sq.
(at least that's what I remember from Calc III).

Looks like wikipedia backs that up....
 
Status
Not open for further replies.
Top Bottom