Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Somebody said:
It could also be tableau code (script_troop_put_picture_on_menu/script_set_center_picture) or background presentations refreshing after selecting a menu option, but that's unlikely since you've already checked those.
I think those are the only two things that can be executed between menu conditions and consequences (apart from URL response code, but that probably isn't the case here). Make sure to check the code in module_tableau_materials as well, not just the scripts that create the tableau.
 
cmpxchg8b said:
I think those are the only two things that can be executed between menu conditions and consequences (apart from URL response code, but that probably isn't the case here). Make sure to check the code in module_tableau_materials as well, not just the scripts that create the tableau.
Thanks, that's a clue.
Ok, I tried all ways to find what's wrong. I tried  assigning the reg5 value to reg37, and use the reg37 instead on menu option consequence block, and it worked. So, the problem is my reg5.
I switched back to reg5, and I commented those lines :
  (call_script, "script_troop_put_picture_on_menu", "trp_player", 70, 5, 75),
  (call_script, "script_set_center_picture"),
It worked again.

And uncommented the (call_script, "script_troop_put_picture_on_menu", "trp_player", 70, 5, 75),  line bring back the error.
Yeah, that's it. Tracing back to native  module_tableau_materials codes and it used no reg5. But then I realized that the troop picture on menu will also load heraldic code if I wear heraldic armor. That's it. It's custom banner's heraldic drawing that used reg1 to reg5.
Thanks to cmpxchg8b, somebody, and MadVader for the helps.
 
Two questions:

1: When the guild master gives you a quest to deliver Ale, does he just randomly choose a town, or is his options defined somewhere? With a map 4x larger than native, the player often has to go insane distances for a very small reward.

2: Is there an OSP script somewhere to have cattle follow the player? Been searching all over, but could only find the TweakMB one, and I'd like to include it in the module files.
 
I just did a quick browse, as my first assumption was the quest would work with a range defined in constants. I just got the quest for delivering wine, which I'm assuming works the same way, most stuff on this appears to, and it does in fact call a script which defines it's range through the constants as seen from below scripts.

Code:
	          (eq, ":quest_no", "qst_deliver_wine"),
	          (is_between, ":giver_center_no", centers_begin, centers_end),
	          (store_random_party_in_range, ":quest_target_center", towns_begin, towns_end),
	          (store_random_in_range, ":random_no", 0, 2),
	          (try_begin),
Script is much longer then that, just posted that to give an idea what to look for.

Code:
centers_begin = towns_begin
centers_end   = villages_end

Edit: and yes there is a script to make cattle follow, I saw it recently, forget where though, I'll post if I find again.
 
Code:
("cattle_drive_away",[
       ],"Drive the cattle onward.",
       [
        (party_set_slot, "$g_encountered_party", slot_cattle_driven_by_player, 1),
        (party_set_ai_behavior, "$g_encountered_party", ai_bhvr_driven_by_party),
        (party_set_ai_object,"$g_encountered_party", "p_main_party"),
        (party_set_extra_text, "$g_encountered_party", "@Being Driven"),
        (change_screen_return),
        ]
       ),
      ("cattle_drag_with",[
       (call_script, "script_party_count_members_with_full_health", "p_main_party"),
       (assign, ":size", reg0),
       (party_stack_get_size, ":num_cattle", "$g_encountered_party", 0),
       (gt, ":size", ":num_cattle"),
      ],"Drag the cattle with you.",
       [
        (party_set_slot, "$g_encountered_party", slot_cattle_driven_by_player, 1),
        (party_set_ai_behavior, "$g_encountered_party", ai_bhvr_escort_party),
        (party_set_ai_object,"$g_encountered_party", "p_main_party"),
        (party_set_extra_text, "$g_encountered_party", "@Following"),
        (change_screen_return),
        ]
       ),
      ("cattle_stop",[
      ],"Bring the herd to a stop.",
       [
        (party_set_slot, "$g_encountered_party", slot_cattle_driven_by_player, 0),
        (party_get_position, pos1, "$g_encountered_party"),
        (party_set_ai_target_position,"$g_encountered_party",pos1),
        (party_set_ai_behavior, "$g_encountered_party", ai_bhvr_patrol_location),
        (party_set_extra_text, "$g_encountered_party", "@Wandering"),
        (change_screen_return),
        ]
       ),
 
Cozur said:
Two questions:

1: When the guild master gives you a quest to deliver Ale, does he just randomly choose a town, or is his options defined somewhere? With a map 4x larger than native, the player often has to go insane distances for a very small reward.

2: Is there an OSP script somewhere to have cattle follow the player? Been searching all over, but could only find the TweakMB one, and I'd like to include it in the module files.
1. You'll need to insert code for that in various quests with quest destinations, to limit the random choice of center to some radius (like 100). Requires several code changes and sometimes new scripts.
2. In the menus, there's a single change:
      ("cattle_drive_away",[],"Drive the cattle onward.",
      [
        (party_set_slot, "$g_encountered_party", slot_cattle_driven_by_player, 1),
        (party_set_ai_behavior, "$g_encountered_party", ai_bhvr_driven_by_party ai_bhvr_escort_party),
        (party_set_ai_object,"$g_encountered_party", "p_main_party"),
        (change_screen_return),
        ]
      ),

ninjabody
 
These are pretty simple questions that I fell kind of stupid for asking, but here goes:


I looked in the outdated official module system documentation for how to make quests, and I understand it basically. However, the code that they give and explain for their quest is a different quest than what I want to do- so- I understand how to activate quests through dialog. But what I would like to do is for after the initial merchant quests, instead of just saying "I am planning to leave now in a short while" and disappearing, He would say "I must leave town, meet me in Veluca."

So I understand the example quest with Geoffrey.


1) How can you make it so when you're talking to him in the tavern and he says to meet in Veluca, he leaves the tavern like belligerent drunks do after you say "do you know who I am"

2) How to make it so after that, he will spawn in the tavern in Veluca, but he will not spawn in Veluca in the beginning of the game.

3) How can you set it so the player will only start in Praven? finished

4) What are the differences, if any, between the outdated official documentation, and the Warband module system?


Thanks in advance for any help! :grin:
 
Dawiduh said:
what's the command to unspawn a scene prop?
No such thing: it is not possible while a mission is running. The best you can do is move it underground out of sight and disable the collision detection using prop_instance_enable_physics.
 
That's because replace_scene_props only works before the mission begins (in ti_before_mission_start). And I doubt the operation replace_prop_instance will help since I have no idea if it's taking in a prop id or instance id.
 
Well, my code is one that Lumos sent me and I slightly modified it. It's all in mission_templates and I need to spawn and attach a bubble for a force shield and on key press it activates or deactivates. I hope he won't have anything against me posting this here:

force_shield_init = ( ti_on_agent_spawn, 0, 0, [],
    [
(store_trigger_param, ":agent", 1),
(store_trigger_param, "$counter", 0),
(store_trigger_param, "$sh_pos", 0),

(agent_has_item_equipped,":agent", "itm_force_shield"),
(agent_set_slot, ":agent", slot_agent_shield_hitpoints, -250), # 250 HP, deactivated
        (agent_get_position, "$sh_pos", ":agent"),
(position_move_z, "$sh_pos", -500),
(set_spawn_position, "$sh_pos"),
(spawn_scene_prop, "spr_belt_shield_on"),
(prop_instance_enable_physics, "spr_belt_shield_on", 0),
(agent_set_attached_scene_prop, ":agent", "spr_belt_shield_on"),
(agent_set_attached_scene_prop_x, ":agent", 0),
(agent_set_attached_scene_prop_z, ":agent", 0),

(display_message, "@Force shield initialized."),
]
  )

So baiscally my problem is in this initialisation code. I put in red the code I added. The "$counter thingy is sued for other stuff in other parts of the code. So, every time I enter a new scene the game crashes, which means the problem is here, only I don't know which one it is. Most of the added code is taken form the pavise deployable shield OPS code which worked.
 
Scene prop operations take the instance id as input, not the prop id.
Code:
 (spawn_scene_prop, "spr_belt_shield_on"),
(assign, ":instance_id", reg0), # spawn_scene_prop returns instance id in reg0
(prop_instance_enable_physics, ":instance_id", 0),
(agent_set_attached_scene_prop, ":agent", ":instance_id"),
 
Right now I'm not working with the scene prop's HP. So that doesn't matter too much.

So all goes well showing up the scene prop. BUT I cannot toggle it haha. I am trying to move it under the ground for "inactive" mode and popping it up again for active mode.

force_shield_init = ( ti_on_agent_spawn, 0, 0, [],
    [
(store_trigger_param, ":agent", 1),
(store_trigger_param, "$counter", 0),
(store_trigger_param, "$sh_pos", 0),

(agent_has_item_equipped,":agent", "itm_force_shield"),
(agent_set_slot, ":agent", slot_agent_shield_hitpoints, -250), # 250 HP, deactivated

    (agent_get_position, "$sh_pos", ":agent"),
(position_move_z, "$sh_pos", -500),
(set_spawn_position, "$sh_pos"),
(spawn_scene_prop, "spr_belt_shield_on"),

    (assign, "$shield_id", reg0), # spawn_scene_prop returns instance id in reg0
    (prop_instance_enable_physics, "$shield_id", 0),
    (agent_set_attached_scene_prop, ":agent", "$shield_id"),

(agent_set_attached_scene_prop_x, ":agent", 0),
(agent_set_attached_scene_prop_y, ":agent", 0),
(agent_set_attached_scene_prop_z, ":agent", -500),

(display_message, "@Force shield initialized."),
]
  )

force_shield_toggle = ( 0, 0, 0, [],
    [
(try_begin),
(eq,"$counter", 1),
(key_clicked, key_h), # Replace this as you see fit
(get_player_agent_no, ":agent"),
(agent_get_slot, ":shield_health", ":agent", slot_agent_shield_hitpoints),
(val_mul, ":shield_health", -1),
(agent_set_slot, ":agent", slot_agent_shield_hitpoints, ":shield_health"),
(prop_instance_enable_physics, "$shield_id", 0),
(position_move_z, "$sh_pos", -500),
(agent_set_attached_scene_prop_z, ":agent", "$sh_pos"),
(prop_instance_animate_to_position, "$shield_id", "$sh_pos", 0),
(display_message, "@Force shield inactive."),
(assign,"$counter", 0),
(else_try),
        (eq,"$counter", 0),
(key_clicked, key_h), # Replace this as you see fit
(get_player_agent_no, ":agent"),
(agent_get_slot, ":shield_health", ":agent", slot_agent_shield_hitpoints),
(val_mul, ":shield_health", -1),
(agent_set_slot, ":agent", slot_agent_shield_hitpoints, ":shield_health"),
(prop_instance_enable_physics, "$shield_id", 1),
(position_move_z, "$sh_pos", 500),
        (agent_set_attached_scene_prop_z, ":agent", 0),
(prop_instance_animate_to_position, "$shield_id", "$sh_pos", 0),
(display_message, "@Force shield active."),
(assign,"$counter", 1),
(try_end),
    ]
  )

Now, as I haven't got much experience with this the whole thing is either toggled or not. I suspect a serious conflict between the position_move and agent_set_attached_scepe_prop_z. Couldn't find too many exapmples in scripts or scene_props...

edit:

Basically for my toggle I can use 3 methods:

1. move the scene prop underground. for some reason it fails to do so and I get a lot of error messages when in the scene.
2. (overlay_animate_to_alpha, "$shield_id", 250, 0), so maybe I will be able to correlate the shield HP (secondary item) with the spawned shield visibility. I tried it and failed, nothing happens, plus sh*tload of error messages in the scene.
3. make a simple animation by combining the standard sized model of the shield bubble with another one scaled down by 99% (the scabbard animation idea). The problem is that I haven't found how to activate the second frame if I do this. Also I am not sure such an animation is possible with scene props. So I was unable to test this idea.
 
@Dawiduh :
What do you want to do with these 2 lines?
(store_trigger_param, "$counter", 0),
(store_trigger_param, "$sh_pos", 0),

I think you should use pos1 or any other pos register instead, and you can use :
(assign, "$counter", 0),
at script_game_start to make initialization for "$counter".
 
OPCODE 2070 invalid trigger parameter ID: 0 line no : 1
OPCODE 2070 invalid trigger parameter ID: 0 line no : 2
OPCODE 2070 invalid trigger parameter ID: 255 line no : 3
OPCODE 922 invalid overlay ID: 15 line no : 19


I also changed the overlay_animate_to_alpha to overlay_set_alpha. Same result.

@Dunde:

the counter is just so i know if the shield is on or off, I use it in the toggle code. it can be anything for all I care, but it seemed to me safer to make it a trigger parameter.

also sh_pos should be the shield position if i use the move underground idea. i will change it to pos1 and see what happens.
 
Status
Not open for further replies.
Back
Top Bottom