Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Somebody said:
There are several components to the merchant quest: When you first encounter the bandit (see script_prepare_alley_to_fight), after which you talk to the merchant and go to his room. That room is determined by the code block I described. Unless you mean the last quest to clean out the bandits, which is set up using script_prepare_town_to_fight.
I already know this, I have found all the parts of the code that are part of the first game quest, where you fight the bandit and then talk to the merchant. When you finish talking you get the quest to get 5 mean. I have already changed the description of this quest and I will make it main quest in the game.
But what I don't know how to do is that, that after you finish talking with the merchant you wouldn't yes spawn on the map, but you would go to yet another scene. I also posted code and it was working if I placed that code at the end of the dialog that you have with merchant, but the problem was that the dialog would start again.
Also I tried posting that in module_scripts after the part that you call mission_template, but then the alley scene would get overwritten and you would need to fight bandit in a new scene.

So what i tried with menus was this:
-I added this code to menu_phase_3
Code:
       [
           ("continue",[], "Continue...",
             [
		      (jump_to_menu, "mnu_start_phase_5"),
            ]),
         ]

And made menu phase_5

Code:
("start_phase_5",mnf_disable_all_keys,
    "You and your crew sail for Farao islands.",
    "none",


     [
      ("Continue...",
       [
		 (assign,":landing_scene",scn_lair_sea_raiders),
         (jump_to_scene,":landing_scene"),
         (change_screen_mission),
       ]),
      ]
  ),

Butt when I try to compile it I get:
Error in game menu ('start_phase_5', 512, 'You and your crew sail for Farao islands.', 'none', [('C
ontinue...', [(2133, ':landing_scene', 520), (1910, ':landing_scene'), 2048])])

So can you tell me what is wrong with my menu, or some other way how to go in another scene when you finish talking to the merchant.

 
Somebody said:
Code:
(ti_on_item_wielded, 0, 0, 
[],
[(store_trigger_param_1, ":agent"),
 (store_trigger_param_2, ":item"),
 (eq, ":item", "itm_lightsaber_extended"),
 (agent_play_sound, ":agent", "snd_whoosh"),
]),
Not sure if this will fire for toggling weapons (or at all in single-player). Does the mesh actually change when you press X? If not, then you should use the second trigger to manually switch the item. The AI won't switch weapons from melee to melee anyways, so this is only applicable to the player.
Code:
(0, 0, 0, 
[(game_key_clicked, gk_toggle_weapon_mode)],
[
  (get_player_agent_no, ":player_agent"),
  (agent_get_wielded_item, ":wielded_weapon", ":player_agent", 0),
  (eq, ":wielded_weapon", "itm_lightsaber"),
  (agent_play_sound, ":player_agent", "snd_whoosh"),
  (agent_unequip_item, ":player_agent", "itm_lightsaber"),
  (agent_equip_item, ":player_agent", "itm_lightsaber_extended"),
  (agent_set_wielded_item, ":player_agent", "itm_lightsaber_extended"),
]),

yeah just realised that only the stats change and not the mesh :-S

Is it possible to spawn a new mesh when I press x?
 
Longshaft said:
Somebody said:
Does the mesh actually change when you press X? If not, then you should use the second trigger to manually switch the item. The AI won't switch weapons from melee to melee anyways, so this is only applicable to the player.
Code:
(0, 0, 0, 
[(game_key_clicked, gk_toggle_weapon_mode)],
[
  (get_player_agent_no, ":player_agent"),
  (agent_get_wielded_item, ":wielded_weapon", ":player_agent", 0),
  (eq, ":wielded_weapon", "itm_lightsaber"),
  (agent_play_sound, ":player_agent", "snd_whoosh"),
  (agent_unequip_item, ":player_agent", "itm_lightsaber"),
  (agent_equip_item, ":player_agent", "itm_lightsaber_extended"),
  (agent_set_wielded_item, ":player_agent", "itm_lightsaber_extended"),
]),

yeah just realised that only the stats change and not the mesh :-S

Is it possible to spawn a new mesh when I press x?
Somebody's game_key trigger does just that.
 
Thanks! I am sorry but I do not know how to add new sounds into the module_sounds.py, I have the whoosh.ogg sound in the mods sound folder but don't know what to do in the module_sounds.py. I tried to enter a new line but it gave errors when compiling.
 
Somebody said:
Code:
(ti_on_item_wielded, 0, 0, 
[],
[(store_trigger_param_1, ":agent"),
 (store_trigger_param_2, ":item"),
 (eq, ":item", "itm_lightsaber_extended"),
 (agent_play_sound, ":agent", "snd_whoosh"),
]),
Not sure if this will fire for toggling weapons (or at all in single-player). Does the mesh actually change when you press X? If not, then you should use the second trigger to manually switch the item. The AI won't switch weapons from melee to melee anyways, so this is only applicable to the player.
Code:
(0, 0, 0, 
[(game_key_clicked, gk_toggle_weapon_mode)],
[
  (get_player_agent_no, ":player_agent"),
  (agent_get_wielded_item, ":wielded_weapon", ":player_agent", 0),
  (eq, ":wielded_weapon", "itm_lightsaber"),
  (agent_play_sound, ":player_agent", "snd_whoosh"),
  (agent_unequip_item, ":player_agent", "itm_lightsaber"),
  (agent_equip_item, ":player_agent", "itm_lightsaber_extended"),
  (agent_set_wielded_item, ":player_agent", "itm_lightsaber_extended"),
]),

Thanks for this man it is awesome! but how would I reverse it so when I press x it returns to itm lightsaber would this be right

Code:
(eq, ":wielded_weapon", "itm_lightsaber_extended"),
  (agent_play_sound, ":player_agent", "snd_whoosh_reversed"),
  (agent_unequip_item, ":player_agent", "itm_lightsaber_extended"),
  (agent_equip_item, ":player_agent", "itm_lightsaber"),
  (agent_set_wielded_item, ":player_agent", "itm_lightsaber"),
]),
 
In that case, you'll need a selection statement.
Code:
(try_begin),
  (eq, ":wielded_weapon", "itm_lighsaber"),
  ...
(else_try),
  (eq, ":wielded_weapon", "itm_lightsaber_extended"),
  ...
(try_end),
Otherwise, it will first check if you're wielding the original lightsaber, and if this isn't the case, disregard all code after that.
 
Somebody said:
In that case, you'll need a selection statement.
Code:
(try_begin),
  (eq, ":wielded_weapon", "itm_lighsaber"),
  ...
(else_try),
  (eq, ":wielded_weapon", "itm_lightsaber_extended"),
  ...
(try_end),
Otherwise, it will first check if you're wielding the original lightsaber, and if this isn't the case, disregard all code after that.

Well I did what I siad I thougt might work but when I press x it just stays on itm lightsaber so its cancelling itself out :-S
 
MadocComadrin said:
SonKidd said:
can i send positions (ie pos0,pos1) as integers to servers/clients?

or do I have to split them up into their x,y,z's?

Currently, we have to split them up, but I did make a suggestion for multiplayer_send_position_to_player/server. It's in the bug tracker if you want to support it.

then can we pass it as a script parameter?

thanks!
 
Since you don't have to use the position register by name (only number) when using the position operations, yes.

Likewise, if you really need to send a position as an event, you can pack the rotation around each axis and the coordinate of each axis together and send them as 3 integers.
 
I tried to put this code on a weapon in my modules_items.py
Code:
["lightsaber_alt",       "lightsaber_alt", [("lightsaber_alt",0)], itp_type_two_handed_wpn|itp_primary, itc_bastardsword|itcf_carry_sword_left_hip,
1  , weight(1)|difficulty(2)|spd_rtng(110) | weapon_length(119)|swing_damage(90 , pierce) | thrust_damage(90 , pierce),imodbits_sword_high ],
[(ti_on_init_item, [(set_position_delta,0,63,0),(particle_system_add_new, "psys_torch_smoke"),(particle_system_add_new, "psys_torch_fire_sparks"),(particle_system_add_new, "psys_fire_glow_1"),(set_current_color, 220, 180, 120),(add_point_light, 10, 30),
])]],

I keep on getting an unexpected indent error when I try to compile?
 
Code:
ship_move_forward = (0, 0, 0, [(key_is_down, key_up)],
		  [(scene_prop_get_instance,":ship_instance", "spr_ship", 0),   
			(prop_instance_get_position,pos1,":ship_instance"),      
		    (position_move_x,pos1,3),     
			(prop_instance_animate_to_position,":ship_instance",pos1,25),    
		])
		
ship_move_backward = (0, 0, 0, [(key_is_down, key_down)],
		  [(scene_prop_get_instance,":ship_instance", "spr_ship", 0),   
		  (prop_instance_get_position,pos1,":ship_instance"),     
		  (position_move_x,pos1,-3),  
		  (prop_instance_animate_to_position,":ship_instance",pos1,25),
		]) 

ship_move_right = (0, 0, 0, [(key_is_down, key_right)],
		  [(scene_prop_get_instance,":ship_instance", "spr_ship", 0),
			(prop_instance_get_position,pos1,":ship_instance"),    
			(position_rotate_z,pos1,-3),         
			(prop_instance_animate_to_position,":ship_instance",pos1,25),   
		])
		
ship_move_left = (0, 0, 0, [(key_is_down, key_left)],
		  [(scene_prop_get_instance,":ship_instance", "spr_ship", 0),
			(prop_instance_get_position,pos1,":ship_instance"),    
		    (position_rotate_z,pos1,3),         
			(prop_instance_animate_to_position,":ship_instance",pos1,25),   
		])

Does anyone know why that code moves the scene prop "spr_enemy_ship" and not spr_ship? 
 
Longshaft said:
I tried to put this code on a weapon in my modules_items.py
Code:
["lightsaber_alt",       "lightsaber_alt", [("lightsaber_alt",0)], itp_type_two_handed_wpn|itp_primary, itc_bastardsword|itcf_carry_sword_left_hip,
1  , weight(1)|difficulty(2)|spd_rtng(110) | weapon_length(119)|swing_damage(90 , pierce) | thrust_damage(90 , pierce),imodbits_sword_high ],
[(ti_on_init_item, [(set_position_delta,0,63,0),(particle_system_add_new, "psys_torch_smoke"),(particle_system_add_new, "psys_torch_fire_sparks"),(particle_system_add_new, "psys_fire_glow_1"),(set_current_color, 220, 180, 120),(add_point_light, 10, 30),
])]],

I keep on getting an unexpected indent error when I try to compile?
Remove the bracket after imodbits_sword_high.
 
MadocComadrin said:
Also, what's the safest way to pack 2 integers together in the module system?
I use packed "indexes" of 1 digit integers for a number of different things...I imagine you could do similar things with multi-digit numbers, too, with some tweaking:

Code:
 ("battle_get_preferences_from_index", [
    (party_get_slot, ":caba_prefs_index", "p_main_party", slot_party_battle_pref_index), 
    (store_div, ":pref_one", ":caba_prefs_index", 1000),
    (store_mul, ":pref_two", ":pref_one", 1000),
    (val_sub, ":caba_prefs_index", ":pref_two"),
    (store_div, ":pref_two", ":caba_prefs_index", 100),
    (store_mul, ":pref_three", ":pref_two", 100),
    (val_sub, ":caba_prefs_index", ":pref_three"),
    (store_div, ":pref_three", ":caba_prefs_index", 10),
    (store_mul, ":pref_four", ":pref_three", 10),
    (store_sub, ":pref_four", ":caba_prefs_index", ":pref_four"),

    
    (assign, reg0, ":pref_one"),  #Thousands digit
    (assign, reg1, ":pref_two"),  #Hundreds digit
    (assign, reg2, ":pref_three"),#Tens digit
    (assign, reg3, ":pref_four"), #Ones digit
  ]),

Code:
("battle_set_preference_index", [
    (store_script_param_1, ":pref_no"),
    (store_script_param_2, ":value"),
    
    (call_script, "script_battle_get_preferences_from_index"),
    (assign, ":pref_one", reg0),
    (assign, ":pref_two", reg1),
    (assign, ":pref_three", reg2),
    (assign, ":pref_four", reg3),
    (try_begin),
        (eq, ":pref_no", 1),
        (assign, ":pref_one", ":value"),
    (else_try),
        (eq, ":pref_no", 2),
        (assign, ":pref_two", ":value"),
    (else_try),
        (eq, ":pref_no", 3),
        (assign, ":pref_three", ":value"),
    (else_try),
        (eq, ":pref_no", 4),
        (assign, ":pref_four", ":value"),
    (try_end),

    (val_mul, ":pref_one", 1000),
    (val_mul, ":pref_two", 100),
    (val_mul, ":pref_three", 10),
    (store_add, ":caba_prefs_index", ":pref_one", ":pref_two"),
    (val_add, ":caba_prefs_index", ":pref_three"),
    (val_add, ":caba_prefs_index", ":pref_four"),
          
    (party_set_slot, "p_main_party", slot_party_battle_pref_index, ":caba_prefs_index"),
   ]),
 
Could anyone give me any advice on where to search for the crossbow reload animation in header_items ? There are several reload anims there, including the firearm ones, but I can't seem to find the one for the crossbow. There are carry_crossbow and shoot_crossbow ones, but the only non-firearm reload I see is reload_mask. Is that some cryptic labeling of the crossbow reload anim or a reload anim for the player's face ?

Thanks in advance for any possible advice.
 
Well I have changed the colour of the glow on my weapon but only the glow on walls etc. changes colour but not the orb that it seems to eminate from?

Is there anyway to change it?
 
Status
Not open for further replies.
Back
Top Bottom