Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Please teach me how to decipher this error. I understand most, but not all:

Code:
 SCRIPT ERROR ON OPCODE 1570: Invalid Item Kind ID: -1; LINE NO: 3: 
 At Mission Template mst_town_center trigger no: 17 consequences. At Mission Template mst_town_center trigger no: 17 consequences.

So I know the error is re: an item_get_type (opcode 1570), but how do I know which trigger?

Trigger 17... does that mean I count from the first trigger in module_triggers.py?
 
I want to know the answer to the above question as well. The MST triggers do count down in order, but it's hard to tell when one begins and one stops. Where is the 1st trigger.

My question: I would like to force the use of melee for my archers and slingers. Currently about 50% spawn without melee weapons. Slingers and bandits are the main culprits. They use fists in close combat. It seems the punchers don't have a sidearm.

In header_troops:
I've seen tf_guarantee_ranged. I've tf_guarantee_polearm in Viking Conquest. How can I do tf_guarantee_ some kind of one-handed melee weapon?
Polearms seem like overkill for low level troops.
 
Ok, I understand my issue now..

[(key_is_down, key_left_mouse_button), (eq, "$cam_mode", 1)],
[(get_player_agent_no, ":player_agent"),
(eq, ":player_agent","$cam_current_agent"),
(agent_get_wielded_item,":weapon","$cam_current_agent",0),
(item_get_type, ":type", ":weapon"),
(this_or_next|eq,":type",itp_type_bow),
(this_or_next|eq,":type",itp_type_crossbow),
(eq,":type",itp_type_thrown),(assign, "$cam_mode", 0),
(assign,"$shoot_mode",1),
(mission_cam_set_mode, "$cam_mode")])

agent_get_wielded_item returns a -1 when unarmed...

so (item_get_type, ":type", -1) yields "item_type not found", when left mouse button is clicked when unarmed!

Any suggestions on how to fix this? Perhaps use try_begin, checking if it is -1, assign it something else?

Thanks in advance
 
I'd like for the main menu to play main menu songs randomly rather than just one song.

The only lead I have is the module_music.py and this is the music that plays:
("mount_and_blade_title_screen", "mount_and_blade_title_screen.ogg", mtf_start_immediately|mtf_sit_main_title|mtf_module_track, 0),

How can I add more songs, and make them be chosen randomly in that particular file?
 
HyperCharge said:
Why unexpected indent error shows up in module_dialogs ?

Code:
[anyone|plyr, "tavern_traveler_talk", [(eq, "$refused_navigator_quest", 1),
                                         (neg|check_quest_finished, "qst_find_navigator")],
  "About that explorer you're talking about...", "ask_agan", []],

[anyone, "ask_agan", [],
   "Yes?", "tavern_traveler_quest", []],

I added these and does give unexpected indent error to this;

Code:
[anyone, "ask_agan", [],
^

Any ideas ?
 
Remove one sentence of the code and test if it works do until you got the bad code removed.
When you have the bad code sentence in a new file do the same with it try to remove conditions etc until you find the wrong part thats the part you need to edit

# no problem :grin: this is just how i do it
#2 have you found the bad part?
 
builder of the gods said:
Remove one sentence of the code and test if it works do until you got the bad code removed.
When you have the bad code sentence in a new file do the same with it try to remove conditions etc until you find the wrong part thats the part you need to edit

Ok, thanks. :smile:
 
HyperCharge said:
builder of the gods said:
Remove one sentence of the code and test if it works do until you got the bad code removed.
When you have the bad code sentence in a new file do the same with it try to remove conditions etc until you find the wrong part thats the part you need to edit

Ok, thanks. :smile:

Well would you mind tell me what didnt work when you found and elimnated the problem just curious
 
@Khamukkamu
Put (neq, ":weapon", -1), before getting the type, because you are not interested if you are unarmed in your code. Something like this:
[(key_is_down, key_left_mouse_button), (eq, "$cam_mode", 1)],
[(get_player_agent_no, ":player_agent"),
(eq, ":player_agent","$cam_current_agent"),
(agent_get_wielded_item,":weapon","$cam_current_agent",0),
(neq, ":weapon", -1),
(item_get_type, ":type", ":weapon"),
(this_or_next|eq,":type",itp_type_bow),
(this_or_next|eq,":type",itp_type_crossbow),
(eq,":type",itp_type_thrown),(assign, "$cam_mode", 0),
(assign,"$shoot_mode",1),
(mission_cam_set_mode, "$cam_mode")])
 
Thanks The_Dragon. I remember seeing that in VC, and dismissed it. Then I woke up this morning and thought, why did I dismiss that :smile:

Just comes to tell you that coding requires one to 'fresh' and not too tired...



Another question: This is my first time writing a trigger. Could anyone please tell me if my code is correct? It's not firing, unfortunately :sad:

Code:
(1, 0, ti_once,
    [(map_free,0),
     (this_or_next|eq, "$player_looks_like_an_orc",                1),
     (             eq, "         $players_kingdom",      "fac_dwarf"),]
    [(dialog_box, "@test.", "@test")]),

From what I understand..

Triggers in 1 in-game hour, does not re-arm, and it only happens once.
Condition: Player has to be on the map (no open screens,etc). Player has to look like an orc (TLD specific) OR player has to be from Fac_Dwarf.
Consequence: Fire Dialog Box
 
It does not fire.

Previously, I had a try_begin, and it fired, however it fired for all factions (which I did not want).

Code:
(1, 0, ti_once,
    [(map_free,0),
     (try_begin),
            (this_or_next|eq, "$player_looks_like_an_orc",                1),
            (             eq, "         $players_kingdom",      "fac_dwarf"),
     (try_end),
    ],
    [(dialog_box, "@test.", "@test")]),
 
Khamukkamu said:
Another question: This is my first time writing a trigger. Could anyone please tell me if my code is correct? It's not firing, unfortunately :sad:

Code:
(1, 0, ti_once,
    [(map_free,0),
     (this_or_next|eq, "$player_looks_like_an_orc",                1),
     (             eq, "         $players_kingdom",      "fac_dwarf"),]
    [(dialog_box, "@test.", "@test")]),

From what I understand..

Triggers in 1 in-game hour, does not re-arm, and it only happens once.
Condition: Player has to be on the map (no open screens,etc). Player has to look like an orc (TLD specific) OR player has to be from Fac_Dwarf.
Consequence: Fire Dialog Box

For reference: You have a trigger just for that, check your header_triggers.py. Its for a simple trigger
Code:
ti_on_switch_to_map           = -75.0
Avoid adding too many of those (1,0,ti_once), they are easy to break and lag your laggame with bugs down the road. A global (switch), a script and a test on that trigger will prevent that, as it only fires once when you go to world map, and not every single ingame hour.

(map_free) doesn't require that 0

You are missing a comma between the condition/consequence block [] []

Add display_message to test if your tests are passing




Khamukkamu said:
It does not fire.

Previously, I had a try_begin, and it fired, however it fired for all factions (which I did not want).

Code:
     (try_begin),
            (this_or_next|eq, "$player_looks_like_an_orc",                1),
            (             eq, "         $players_kingdom",      "fac_dwarf"),
     (try_end),

That is the equivalent of saying: do nothing, ignore this code, and just keep going.



Khamukkamu said:
Trigger 17... does that mean I count from the first trigger in module_triggers.py?
18th trigger on your mission template listed in the error "town_center" (0, 1, ..., 17). Module_mission_templates.py. Check your .txt file for it, and try to count on your .py file



troycall said:
I'd like for the main menu to play main menu songs randomly rather than just one song.
Add the music call to the presentation, main menu is controlled by this:
Code:
presentations = [
  ## mainmenu chief
  ("game_start",prsntf_read_only,0,[
Its called when you switch to it (when you launch the game, when you quit to main menu, etc). See VC code for a example of usage.
 
Ok,

Re: Missing comma - yea, it was only when I was formatting the code here in the forums :smile: Wasnt on my code.
Re: try_begin issue - Had a late night, wasnt thinking :smile:
Re: (map_free,0) - I first had no 0 as Lav's ops didnt say i needed one, then saw other code which had 0s... so I of course doubted myself..

Re:
A global (switch), a script and a test on that trigger will prevent that, as it only fires once when you go to world map, and not every single ingame hour.

Do you mean a test on (ti_on_switch_to_map), which I'll write in Simple Triggers.py?

Thanks again
 
Khamukkamu said:
Do you mean a test on (ti_on_switch_to_map), which I'll write in Simple Triggers.py?

Like I said this is the best place for this kind of code, as it only gets executed once per map switch.

Its for a quest/etc that you have no idea when the player will do. It could be on day 1, or day 1000, or never. Imagine you have 100 cases like this. All of them now testing every ingame hour ... that kind of stuff is not good. Now imagine you break one of those triggers. Your game suddenly is very lag and you will have no idea why (good luck finding out  :mrgreen:). Just a heads up.

Its much better to have stuff like this:

Code:
(ti_on_switch_to_map,[

# try block for quest 1: check if active, then do stuff with it

# try block for special case: check if global "$tutorial_box_1" was never displayed

# etc

]),

VC, as a example, has a huge trigger to update old savegames, with several tests. It also has a cool mechanism for tutorials, using bitnum masks, if you want try that out. Look for stuff like this: (store_and, reg0, "$first_time", first_time_food_store),
 
I see. That method is still better even if my goal was to only show it once, the whole game?

Basically, my goal is to show this box once, no more, no less :smile:

Aren't simple triggers more for those that are repeated?

Thanks in advance.
 
Question bump before I start a thread:
My question: I would like to force the EQUIPPING of melee weapons for my archers and slingers (for close combat). Currently about 50% spawn without melee weapons. Slingers and bandits are the main culprits. They use fists in close combat. It seems the punchers don't have a sidearm.

In header_troops:
I've seen tf_guarantee_ranged. I've tf_guarantee_polearm in Viking Conquest. How can I do tf_guarantee_ some kind of one-handed melee weapon?
Polearms seem like overkill for low level troops.
 
Status
Not open for further replies.
Back
Top Bottom