Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Griffith_ said:
Does anyone know a way to remove/change the position of fired arrows in a scene, after they got stuck in a scene prop, body etc? Is there some kind of id an arrow has after it's been fired?
If you simply want missiles to disappear rather than get permanently stuck in destructable scene props, just use the (new in 1.134) scene prop flag sokf_missiles_not_attached with the destructables.
 
Thank you for your replies.

What I actually want is to move the arrows with the scene prop they got stuck in. The scene prop is a moving ship so the arrows just remain stuck in the air.  I will try to make it destructible or put other flags to the ship scene prop to see if the arrows will follow the ship, just as they would when fired into a shield.
 
Ran into some strange problem. Wont let me compile without errors. Here's the code
Code:
 ["arrows","Arrows", [("arrow",0),("flying_missile",ixmesh_flying_ammo),("quiver", ixmesh_carry)], itp_type_arrows|itp_merchandise|itp_default_ammo, itcf_carry_quiver_back, 72,weight(3)|abundance(160)|weapon_length(95)|thrust_damage(1,pierce)|max_ammo(30),imodbits_missile,
  [(ti_on_agent_hit, 0, 0, [],[
    (assign, ":item", reg0),
    (store_trigger_param_1, ":inflicted_agent"),
    (agent_is_human, ":inflicted_agent"), #no animal abuse?
    (store_trigger_param_3, ":damage"),
    (store_agent_hit_points, ":hp", ":inflicted_agent", 1),
    (val_sub, ":hp", ":damage"),
    (le, ":hp", 0),
    (try_begin),
       (eq, ":item", "itm_arrows"),
       (agent_play_sound, ":inflicted_agent", "snd_arrow_death"),
    (try_end),
    #or fetch sound from item slot, etc.
])]],

Pic of the error
b7d35c60310b29edf96f4d4f3f6c1b17e61ad68469724996dcc409ab74ed363f5g.jpg
 
dunde said:
from header_triggers.py :

    ti_on_agent_hit          = -28.0 #can only be used in module_mission_templates triggers
Oh wow. No wonder. Is there anyway to do it so that it checkes what imodbit it has and then plays the sound? e.g, if it has imodbit mace, it would play snd_mace_death, but if it's imodbit polearm, it would play snd_axe_death?
 
I 'm not sure but you can try this :
- change every hit sounds from module_sounds.py like "arrow_hit_body", "metal_hit_low_armor_high_damage" to silent sound files
- use ti_on_agent_hit on mission template to play your own sound.

But it will be not so efficient I guess.
 
dunde said:
I 'm not sure but you can try this :
- change every hit sounds from module_sounds.py like "arrow_hit_body", "metal_hit_low_armor_high_damage" to silent sound files
- use ti_on_agent_hit on mission template to play your own sound.

But it will be not so efficient I guess.
Yes I know but I meant that is there any easire way to add this to all weapons? Since I'm intending to add weapon specific  death sounds to all weapons and thus wondering if it would be possible to determine the sounds looking at what imodbit the weapon has.
 
mr.master said:
Yes I know but I meant that is there any easire way to add this to all weapons? Since I'm intending to add weapon specific  death sounds to all weapons and thus wondering if it would be possible to determine the sounds looking at what imodbit the weapon has.

1st, imodbits is used to determine each imodbit an item can has. So from imodbit, we can't determine what weapon hit the agent. You should use item type instead but it's inacureate for it lead to single handed or double handed weapon instead of club or sword. You can  use similar way rubik saves weapon stats to slot, you can save the imodbits into 'weapon type' slot.
Then just use the ti_on_agent_hit, get the 'weapon type' slot of atacker's weapon and play your sound according it's value.
 
dunde said:
mr.master said:
Yes I know but I meant that is there any easire way to add this to all weapons? Since I'm intending to add weapon specific  death sounds to all weapons and thus wondering if it would be possible to determine the sounds looking at what imodbit the weapon has.

1st, imodbits is used to determine each imodbit an item can has. So from imodbit, we can't determine what weapon hit the agent. You should use item type instead but it's inacureate for it lead to single handed or double handed weapon instead of club or sword. You can  use similar way rubik saves weapon stats to slot, you can save the imodbits into 'weapon type' slot.
Then just use the ti_on_agent_hit, get the 'weapon type' slot of atacker's weapon and play your sound according it's value.
Hmm. Well, I did so know that I just arranged the weapons so that swords in one place, maces in one place etc. Then, Ill just make the game check the the weapon is between these weapons, and then plays the specific sound.

Edit: Well for some reason, it only works for the maces, but not for swords nor axes etc. Here is the code

Code:
	(ti_on_agent_hit, 0, 0, [],[
		(assign, ":item", reg0),
		(store_trigger_param_1, ":inflicted_agent"),
		(agent_is_human, ":inflicted_agent"), #no animal abuse?
		(store_trigger_param_3, ":damage"),
		(store_agent_hit_points, ":hp", ":inflicted_agent", 1),
		(val_sub, ":hp", ":damage"),
		(le, ":hp", 0),
		(try_begin),
			(is_between, ":item", "itm_hammer", "itm_hatchet"),
			(agent_play_sound, ":inflicted_agent", "snd_club_death"),
		(else_try),
			(is_between, ":item", "itm_sarranid_mace_1", "itm_scythe"),
			(agent_play_sound, ":inflicted_agent", "snd_axe_death"),
		(else_try),
			(is_between, ":item", "itm_poleaxe", "itm_sickle"),
			(agent_play_sound, ":inflicted_agent", "snd_spear_death"),
		(else_try),
			(is_between, ":item", "itm_awlpike_long", "itm_polehammer"),
			(agent_play_sound, ":inflicted_agent", "snd_sword_death"),
		(else_try),
			(is_between, ":item", "itm_charger", "itm_pilgrim_disguise"),
			(agent_play_sound, ":inflicted_agent", "snd_arrow_death"),
		(try_end),
    #or fetch sound from item slot, etc.
	]),

Edit 2 : Well, it works but it plays the wrong sounds for some of them. Example, where it's supposed to be snd_sword_death, it plays axe_death sounds.
 
Quick question. 

I'm trying to place:

Code:
		 ballista_tick,
		 ballista_action,
		 ballista_enter,
		 ballista_wtf,
		 ballista_missile_tick,
		 ballista_rotate_something,
 		 ballista_misslie_check,
   		 ballista_reload,
		 ballista_fire,
		 ballista_fire_tick,
		 ballista_check_actions,
		 ballista_create_missiles,
		 ballista_move_up,
		 ballista_move_down,
		 ballista_move_left,
		 ballista_move_right,

in

Code:
(
   "ship_battle",mtf_battle_mode,-1,
   "You enter battle on your longships.",
   [
    (0,mtef_attackers|mtef_team_1,af_override_horse,aif_start_alarmed,4,[]),
    (1,mtef_attackers|mtef_team_1,af_override_horse,aif_start_alarmed,4,[]),
    (2,mtef_attackers|mtef_team_1,af_override_horse,aif_start_alarmed,4,[]),
    (10,mtef_defenders|mtef_team_0,af_override_horse,aif_start_alarmed,4,[]),
    (11,mtef_defenders|mtef_team_0,af_override_horse,aif_start_alarmed,4,[]),
    (12,mtef_defenders|mtef_team_0,af_override_horse,aif_start_alarmed,4,[]),
    ],
   [
     (1, 0, 0, [], [(scene_prop_get_instance,"$ship", "spr_ship", 0),(scene_prop_get_instance,"$eship", "spr_enemy_ship", 0),]),
     
     (10, 0, ti_once, [], [(try_for_agents,":agent"),(agent_set_speed_limit,":agent",0),(end_try),]),
     (ti_tab_pressed, 0, 0, [],
      [
          (try_begin),
            (eq, "$battle_won", 1),
            (finish_mission,0),
          (else_try),
            (call_script, "script_cf_check_enemies_nearby"),
            (question_box,"str_do_you_want_to_retreat"),
          (else_try),
            (display_message,"str_can_not_retreat"),
          (try_end),
       ]),
     
     (0, 0, ti_once, [], [(assign,"$pbehavior",1),(assign,"$ebehavior",2),(assign,"$battle_won",0),]),
     (1, 60, ti_once, [(store_mission_timer_a,reg(1)),(ge,reg(1),10),(all_enemies_defeated,2),(neg|main_hero_fallen,0),(set_mission_result,1),(display_message,"str_msg_battle_won"),(assign,"$battle_won",1),(assign, "$g_battle_result", 1)],
          [(finish_mission,1)]),
     (10, 0, 0, [], [(eq,"$battle_won",1),(display_message,"str_msg_battle_won")]),
     (1, 4, ti_once, [(main_hero_fallen,0)],
         [(set_mission_result,-1),(finish_mission,1)]),
		 
		 

#friendly ship ai
     (0.1, 0, 0, [],
     [(call_script,"script_check_for_collisions"),]),

     (0.1, 0, 0, [],
     [(call_script,"script_kill_overboard"),]),


     (0.05, 0, 0, [],
     [(call_script,"script_cf_keep_troops_on_ships"),]),

#     (0.1, 0, 0, [],
#[(try_for_agents,":agent"),
#     (agent_is_human,":agent"),
 #    (agnet_is_alive,":agent"),


     (1.0, 0, 0, [(eq,"$pbehavior",1)],                   
      [(scene_prop_get_num_instances,reg12, "spr_ship"),
       (val_add,reg12,1),
       (try_for_range,reg13,0,reg12),
          (scene_prop_get_instance,"$ship", "spr_ship", reg13),
          (call_script,"script_select_enemy_ship"),
          (call_script,"script_cf_close_and_board"),
       (end_try),(call_script,"script_check_for_collisions"),]),
          
     
     (1.0, 0, 0, [(eq,"$pbehavior",2),],                   
      [(scene_prop_get_num_instances,reg12, "spr_ship"),
       (val_add,reg12,1),
       (try_for_range,reg13,0,reg12),
          (scene_prop_get_instance,"$ship", "spr_ship", reg13),
          (call_script,"script_select_enemy_ship"),
          (call_script,"script_skirmish"),
       (end_try),(call_script,"script_check_for_collisions"),]),
       


#enemy ship ai



     (10.0, 0, 0, [],
      [(assign,":friends",0),
       (assign,":enemies",0),
       (try_for_agents,":agent"),
          (agent_is_alive,":agent"),
          (try_begin),
             (agent_is_ally,":agent"),
             (val_add,":friends",1),
          (else_try),
             (val_add,":enemies",1),
          (end_try),
       (end_try),
       (try_begin),
          (val_mul,":friends",10),
          (val_div,":friends",":enemies"),
          (gt,":friends",8),
          (assign,"$ebehavior",2),
       (else_try),
          (assign,"$ebehavior",1),
       (end_try)]),      


     (1.0, 0, 0, [(eq,"$ebehavior",1)],
      [(scene_prop_get_num_instances,reg12, "spr_enemy_ship"),
       (val_add,reg12,1),
       (try_for_range,reg13,0,reg12),
          (scene_prop_get_instance,"$ship", "spr_enemy_ship", reg13),
          (call_script,"script_select_friendly_ship"),
          (call_script,"script_cf_close_and_board"),
       (end_try),(call_script,"script_check_for_collisions"),]),
       
     (1.0, 0, 0, [(eq,"$ebehavior",2)],
      [(scene_prop_get_num_instances,reg12, "spr_enemy_ship"),
       (val_add,reg12,1),
       (try_for_range,reg13,0,reg12),
          (scene_prop_get_instance,"$ship", "spr_enemy_ship", reg13),
          (call_script,"script_select_friendly_ship"),
          (call_script,"script_skirmish"),
       (end_try),(call_script,"script_check_for_collisions"),]),


   

  
      (ti_inventory_key_pressed, 0, 0, [(try_begin),
                                           (eq,"$pbehavior",2),
                                           (assign,"$pbehavior",0),
                                           (display_message,"str_hold"),
                                           (scene_prop_get_instance,"$ship", "spr_ship", 0),
                                           (prop_instance_get_position,1,"$ship"),
                                           (prop_instance_animate_to_position,"$ship",1,1),
                                        (else_try),
                                           (val_add,"$pbehavior",1),
                                           (try_begin),
                                              (eq,"$pbehavior",1),
                                              (display_message,"str_board"),
                                           (else_try),
                                              (display_message,"str_skirmish"),
                                           (end_try),
                                        (end_try)], []),

     (ti_question_answered, 0, 0, [],
      [(store_trigger_param_1,":answer"),(eq,":answer",0),(finish_mission,0),]),
  


   ],
 ),

but no matter where I put it, the module system has a complete meltdown, and floods me with raw code.  (Not even errors.)

Where should I put it? 
 
Are those common triggers? I am not sure if you need common_ before the name. If so, they must go in the trigger section

(
  "ship_battle",mtf_battle_mode,-1,
  "You enter battle on your longships.",
  [
    (0,mtef_attackers|mtef_team_1,af_override_horse,aif_start_alarmed,4,[]),
    (1,mtef_attackers|mtef_team_1,af_override_horse,aif_start_alarmed,4,[]),
    (2,mtef_attackers|mtef_team_1,af_override_horse,aif_start_alarmed,4,[]),
    (10,mtef_defenders|mtef_team_0,af_override_horse,aif_start_alarmed,4,[]),
    (11,mtef_defenders|mtef_team_0,af_override_horse,aif_start_alarmed,4,[]),
    (12,mtef_defenders|mtef_team_0,af_override_horse,aif_start_alarmed,4,[]),
    ],
  [
After this point.
 
I tried that.  They all match up, blah blah blah, but no matter what I do, I get this:

Code:
Initializing...
Compiling all global variables...
Error in mission template:
('ship_battle', 2, -1, 'You enter battle on your longships.', [(0, 8320, 256, 16
, 4, []), (1, 8320, 256, 16, 4, []), (2, 8320, 256, 16, 4, []), (10, 4160, 256,
16, 4, []), (11, 4160, 256, 16, 4, []), (12, 4160, 256, 16, 4, [])], [(0, 0, 100
000000.0, [], [(2133, '$balista_action', 0), (2133, '$balista_fire', 0), (2133,
'$missile_count', 0), (2133, '$missile_max', 15)]), (0, 0, 0, [(71, 18), (31, '$
balista_action', 0), (1811, ':balista_instance', 'spr_balista', 0), (1700, ':pla
yer_agent'), (1850, 1, ':balista_instance'), (1710, 2, ':player_agent'), (710, '
:distance', 1, 2), (2147483678L, ':distance', 750), (2001, 1), (2011, 2), (2133,
 '$balista_action', 4)], [(1811, ':balista_instance', 'spr_balista', 0), (1850,
1, ':balista_instance'), (722, 1, 125), (721, 1, 350), (725, 1, 180), (2012, 1,
1000, 0)]), (0, 0, 0, [(71, 33), (31, '$balista_action', 1)], [(2001, 0), (2133,
 '$balista_action', 0)]), (0, 1, 0, [(31, '$balista_action', 4)], [(2133, '$bali
sta_action', 1)]), (0, 0, 0, [(31, '$balista_action', 1)], [(1811, ':balista_ins
tance', 'spr_balista', 0), (1850, 1, ':balista_instance'), (1811, ':missile_inst
ance', 'spr_balista_missile', '$missile_count'), (1850, 2, ':balista_instance'),
 (722, 2, 55), (1855, ':missile_instance', 2), (722, 1, 125), (721, 1, 350), (72
5, 1, 180), (2011, 1)]), (0, 0, 0, [(70, 57), (31, '$balista_action', 1)], [(213
3, '$balista_action', 2), (1811, ':balista_instance', 'spr_balista', 0), (1850,
1, ':balista_instance'), (722, 1, 500), (721, 1, 350), (725, 1, 180), (2012, 1,
1000, 0)]), (0, 0, 0, [], [(6, ':missile_number', 0, '$missile_count'), (1811, '
:missile_instance', 'spr_balista_missile', ':missile_number'), (1850, 1, ':missi
le_instance'), (1850, 2, ':missile_instance'), (791, 2), (710, ':distance', 1, 2
), 4, (32, ':distance', 5), (721, 1, -300), (723, 1, 1), (1860, ':missile_instan
ce', 1, 10), (1700, ':player_agent'), (12, ':agents'), (1702, ':agents'), (1710,
 2, ':agents'), (710, ':missile_hit', 1, 2), 4, (2147483678L, ':missile_hit', 10
0), (1721, ':agents', 0, 0), (1722, ':player_agent', ':agents'), 3, 3, 3, 3]), (
0, 0, 0, [(31, '$balista_action', 2)], [(2133, '$balista_action', 3), 4, (214748
3678L, '$missile_count', '$missile_max'), (2105, '$missile_count', 1), 3]), (0,
0, 0, [(71, 20), (31, '$balista_action', 1)], [4, (31, '$balista_fire', 1), (213
3, '$balista_fire', 0), 5, (2133, '$balista_fire', 1), 3]), (0, 0, 0, [(31, '$ba
lista_fire', 1)], [(2121, ':one_less', '$missile_count', 1), (2121, ':two_less',
 '$missile_count', 2), (1811, ':missile_instance', 'spr_balista_missile', '$miss
ile_count'), (1811, ':missile_instance2', 'spr_balista_missile', ':one_less'), (
1811, ':missile_instance3', 'spr_balista_missile', ':two_less'), (1850, 1, ':mis
sile_instance'), (1850, 2, ':missile_instance2'), (1850, 3, ':missile_instance3'
), (721, 1, -100), (721, 2, -100), (721, 3, -100), (1969, 'psys_torch_fire', 1,
10), (1969, 'psys_torch_smoke', 1, 10), (1969, 'psys_torch_fire_sparks', 1, 10),
 (1969, 'psys_fire_glow_1', 1, 5), (1969, 'psys_torch_fire', 2, 5), (1969, 'psys
_torch_fire_sparks', 2, 5), (1969, 'psys_fire_glow_1', 2, 2), (1969, 'psys_torch
_fire', 3, 5)]), (0, 4, 0, [(31, '$balista_action', 3)], [(2133, '$balista_actio
n', 5)]), (0, 0.10000000000000001, 0, [(31, '$balista_action', 5)], [(2133, '$ba
lista_action', 4), (1811, ':balista_instance', 'spr_balista', 0), (1850, 1, ':ba
lista_instance'), (722, 1, 125), (721, 1, 350), (725, 1, 180), (2012, 1, 1000, 0
), (1811, ':missile_instance', 'spr_balista_missile', '$missile_count'), (1850,
2, ':balista_instance'), (722, 2, 55), (1855, ':missile_instance', 2)]), (0, 0,
0, [(70, 200), (31, '$balista_action', 1)], [(1811, ':balista_instance', 'spr_ba
lista', 0), (1850, 1, ':balista_instance'), (723, 1, 3), (1860, ':balista_instan
ce', 1, 10)]), (0, 0, 0, [(70, 208), (31, '$balista_action', 1)], [(1811, ':bali
sta_instance', 'spr_balista', 0), (1850, 1, ':balista_instance'), (723, 1, -3),
(1860, ':balista_instance', 1, 10)]), (0, 0, 0, [(70, 203), (31, '$balista_actio
n', 1)], [(1811, ':balista_instance', 'spr_balista', 0), (1850, 1, ':balista_ins
tance'), (725, 1, 3), (1860, ':balista_instance', 1, 10)]), ((0, 0, 0, [(70, 205
), (31, '$balista_action', 1)], [(1811, ':balista_instance', 'spr_balista', 0),
(1850, 1, ':balista_instance'), (725, 1, -3), (1860, ':balista_instance', 1, 10)
]),), (1, 0, 0, [], [(1811, '$ship', 'spr_ship', 0), (1811, '$eship', 'spr_enemy
_ship', 0)]), (10, 0, 100000000.0, [], [(12, ':agent'), (1736, ':agent', 0), 3])
, (-21.0, 0, 0, [], [4, (31, '$battle_won', 1), (1907, 0), 5, (1, 'script_cf_che
ck_enemies_nearby'), (1121, 'str_do_you_want_to_retreat'), 5, (1106, 'str_can_no
t_retreat'), 3]), (0, 0, 100000000.0, [], [(2133, '$pbehavior', 1), (2133, '$ebe
havior', 2), (2133, '$battle_won', 0)]), (1, 60, 100000000.0, [(2370, 7205759403
7927937L), (30, 72057594037927937L, 10), (1003, 2), (2147484654L, 0), (1906, 1),
 (1106, 'str_msg_battle_won'), (2133, '$battle_won', 1), (2133, '$g_battle_resul
t', 1)], [(1907, 1)]), (10, 0, 0, [], [(31, '$battle_won', 1), (1106, 'str_msg_b
attle_won')]), (1, 4, 100000000.0, [(1006, 0)], [(1906, -1), (1907, 1)]), (0.100
00000000000001, 0, 0, [], [(1, 'script_check_for_collisions')]), (0.100000000000
00001, 0, 0, [], [(1, 'script_kill_overboard')]), (0.050000000000000003, 0, 0, [
], [(1, 'script_cf_keep_troops_on_ships')]), (1.0, 0, 0, [(31, '$pbehavior', 1)]
, [(1810, 72057594037927948L, 'spr_ship'), (2105, 72057594037927948L, 1), (6, 72
057594037927949L, 0, 72057594037927948L), (1811, '$ship', 'spr_ship', 7205759403
7927949L), (1, 'script_select_enemy_ship'), (1, 'script_cf_close_and_board'), 3,
 (1, 'script_check_for_collisions')]), (1.0, 0, 0, [(31, '$pbehavior', 2)], [(18
10, 72057594037927948L, 'spr_ship'), (2105, 72057594037927948L, 1), (6, 72057594
037927949L, 0, 72057594037927948L), (1811, '$ship', 'spr_ship', 7205759403792794
9L), (1, 'script_select_enemy_ship'), (1, 'script_skirmish'), 3, (1, 'script_che
ck_for_collisions')]), (10.0, 0, 0, [], [(2133, ':friends', 0), (2133, ':enemies
', 0), (12, ':agent'), (1702, ':agent'), 4, (1706, ':agent'), (2105, ':friends',
 1), 5, (2105, ':enemies', 1), 3, 3, 4, (2107, ':friends', 10), (2108, ':friends
', ':enemies'), (32, ':friends', 8), (2133, '$ebehavior', 2), 5, (2133, '$ebehav
ior', 1), 3]), (1.0, 0, 0, [(31, '$ebehavior', 1)], [(1810, 72057594037927948L,
'spr_enemy_ship'), (2105, 72057594037927948L, 1), (6, 72057594037927949L, 0, 720
57594037927948L), (1811, '$ship', 'spr_enemy_ship', 72057594037927949L), (1, 'sc
ript_select_friendly_ship'), (1, 'script_cf_close_and_board'), 3, (1, 'script_ch
eck_for_collisions')]), (1.0, 0, 0, [(31, '$ebehavior', 2)], [(1810, 72057594037
927948L, 'spr_enemy_ship'), (2105, 72057594037927948L, 1), (6, 72057594037927949
L, 0, 72057594037927948L), (1811, '$ship', 'spr_enemy_ship', 72057594037927949L)
, (1, 'script_select_friendly_ship'), (1, 'script_skirmish'), 3, (1, 'script_che
ck_for_collisions')]), (-22.0, 0, 0, [4, (31, '$pbehavior', 2), (2133, '$pbehavi
or', 0), (1106, 'str_hold'), (1811, '$ship', 'spr_ship', 0), (1850, 1, '$ship'),
 (1860, '$ship', 1, 1), 5, (2105, '$pbehavior', 1), 4, (31, '$pbehavior', 1), (1
106, 'str_board'), 5, (1106, 'str_skirmish'), 3, 3], []), (-8, 0, 0, [], [(2071,
 ':answer'), (31, ':answer', 0), (1907, 0)])])
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Exporting map icons...
Creating new tag_uses.txt file...
Creating new quick_strings.txt file...
Exporting faction data...
Exporting item data...
Exporting scene data...
Exporting troops data
Exporting particle data...
Exporting scene props...
Exporting tableau materials data...
Exporting presentations...
Exporting party_template data...
Exporting parties
Exporting quest data...
Exporting info_page data...
Exporting scripts...

It's a mission, so I should be able to add it, right? 

EDIT:  I get it no matter where I put it.  Even in lead_charge.  :???: 

The code compiles correctly.

Code:
ballista_tick = (0, 0, ti_once, [],[(assign,"$balista_action",0),# 0 is none, 1 is in action, 2 fired, 3 reloading, 4 one second please:P
	(assign,"$balista_fire",0),
	(assign,"$missile_count",0), 
	(assign,"$missile_max",15),
	])  
ballista_action = (0, 0, 0, [(key_clicked, key_e),
			(eq,"$balista_action",0),
			(scene_prop_get_instance,":balista_instance", "spr_balista", 0), 
			(get_player_agent_no,":player_agent"),  
			(prop_instance_get_position,pos1,":balista_instance"),  
			(agent_get_position,pos2,":player_agent"), 
			(get_distance_between_positions,":distance",pos1,pos2), 
			(lt,":distance",750),    
			(mission_cam_set_mode,1),   
			(mission_cam_set_position, pos2),    
			(assign,"$balista_action",4)],
		  [(scene_prop_get_instance,":balista_instance", "spr_balista", 0), 
			(prop_instance_get_position,pos1,":balista_instance"),   
			(position_move_z,pos1,125),      
			(position_move_y,pos1,350),     
			(position_rotate_z,pos1,180),  
			(mission_cam_animate_to_position, pos1, 1000, 0), 
		]) 
		
ballista_enter = (0, 0, 0, [(key_clicked, key_f),(eq,"$balista_action",1)],
		  [(mission_cam_set_mode,0),
			(assign,"$balista_action",0),
		]) 
		
ballista_wtf = (0, 1, 0, [(eq,"$balista_action",4)],
		  [(assign,"$balista_action",1),
		])
ballista_missile_tick = (0, 0, 0, [(eq,"$balista_action",1)],
		  [(scene_prop_get_instance,":balista_instance", "spr_balista", 0), 
			(prop_instance_get_position,pos1,":balista_instance"),     
			(scene_prop_get_instance,":missile_instance", "spr_balista_missile", "$missile_count"),    
			(prop_instance_get_position,pos2,":balista_instance"),     
			(position_move_z,pos2,55),     
			(prop_instance_set_position,":missile_instance",pos2),  
			(position_move_z,pos1,125),      
			(position_move_y,pos1,350),        
			(position_rotate_z,pos1,180),     
			(mission_cam_set_position, pos1),
		]) 
		
ballista_rotate_something = (0, 0, 0, [(key_is_down, key_space),(eq,"$balista_action",1)],
		  [(assign,"$balista_action",2), 
			(scene_prop_get_instance,":balista_instance", "spr_balista", 0),        
			(prop_instance_get_position,pos1,":balista_instance"),       
			(position_move_z,pos1,500),     
			(position_move_y,pos1,350),  
			(position_rotate_z,pos1,180),   
			(mission_cam_animate_to_position, pos1, 1000, 0),   
		])      
ballista_misslie_check = (0, 0, 0, [],[(try_for_range,":missile_number",0,"$missile_count"),   
				(scene_prop_get_instance,":missile_instance", "spr_balista_missile", ":missile_number"),
				(prop_instance_get_position,pos1,":missile_instance"),    
				(prop_instance_get_position,pos2,":missile_instance"),
				(position_set_z_to_ground_level, pos2),       
				(get_distance_between_positions,":distance",pos1,pos2),  
				(try_begin),              
				(gt,":distance",5),       
				(position_move_y,pos1,-300),
				(position_rotate_x,pos1,1),  
                (prop_instance_animate_to_position,":missile_instance",pos1,10),        
				(get_player_agent_no,":player_agent"),    
				(try_for_agents,":agents"),          
				(agent_is_alive, ":agents"),         
				(agent_get_position,pos2,":agents"),         
				(get_distance_between_positions,":missile_hit",pos1,pos2),   
				(try_begin),                       
				(lt,":missile_hit",100),                
				(agent_set_hit_points,":agents",0,0),     
				(agent_deliver_damage_to_agent,":player_agent",":agents"),    
				(try_end),          
				(try_end),              
				(try_end),     
				(try_end),
		])      
ballista_reload = (0, 0, 0, [(eq,"$balista_action",2)],
		  [(assign,"$balista_action",3),  
			(try_begin),      
			(lt,"$missile_count","$missile_max"),       
			(val_add,"$missile_count",1),  
			(try_end)
		])
ballista_fire = (0, 0, 0, [(key_clicked, key_t),(eq,"$balista_action",1),],
		  [(try_begin), 
			(eq,"$balista_fire",1), 
			(assign,"$balista_fire",0),    
			(else_try),         
			(assign,"$balista_fire",1),  
			(try_end)
		])
ballista_fire_tick = (0, 0, 0, [(eq,"$balista_fire",1),],
		  [(store_sub,":one_less","$missile_count",1), 
			(store_sub,":two_less","$missile_count",2), 
			(scene_prop_get_instance,":missile_instance", "spr_balista_missile", "$missile_count"), 
			(scene_prop_get_instance,":missile_instance2", "spr_balista_missile", ":one_less"), 
			(scene_prop_get_instance,":missile_instance3", "spr_balista_missile", ":two_less"), 
			(prop_instance_get_position,pos1,":missile_instance"),     
			(prop_instance_get_position,pos2,":missile_instance2"),  
			(prop_instance_get_position,pos3,":missile_instance3"),  
			(position_move_y,pos1,-100),        
			(position_move_y,pos2,-100),       
			(position_move_y,pos3,-100),     
			(particle_system_burst, "psys_torch_fire",pos1,10),   
			(particle_system_burst, "psys_torch_smoke",pos1,10), 
			(particle_system_burst, "psys_torch_fire_sparks",pos1,10),    
			(particle_system_burst, "psys_fire_glow_1",pos1,5),  
			(particle_system_burst, "psys_torch_fire",pos2,5),   
			(particle_system_burst, "psys_torch_fire_sparks",pos2,5),    
			(particle_system_burst, "psys_fire_glow_1",pos2,2),   
			(particle_system_burst, "psys_torch_fire",pos3,5),   
		])
ballista_check_actions = (0, 4, 0, [(eq,"$balista_action",3),],
		  [(assign,"$balista_action",5),
		])
ballista_create_missiles = (0, 0.1, 0, [(eq,"$balista_action",5),],
		  [(assign,"$balista_action",4),
          (scene_prop_get_instance,":balista_instance", "spr_balista", 0),
          (prop_instance_get_position,pos1,":balista_instance"),   
		  (position_move_z,pos1,125),    
		  (position_move_y,pos1,350),     
		  (position_rotate_z,pos1,180),     
		  (mission_cam_animate_to_position, pos1, 1000, 0),  
		  (scene_prop_get_instance,":missile_instance", "spr_balista_missile", "$missile_count"),    
		  (prop_instance_get_position,pos2,":balista_instance"),      
		  (position_move_z,pos2,55),     
		  (prop_instance_set_position,":missile_instance",pos2), 
		])      
ballista_move_up = (0, 0, 0, [(key_is_down, key_up),(eq,"$balista_action",1),],
		  [(scene_prop_get_instance,":balista_instance", "spr_balista", 0),   
			(prop_instance_get_position,pos1,":balista_instance"),      
			(position_rotate_x,pos1,3),     
			(prop_instance_animate_to_position,":balista_instance",pos1,10),    
		])
ballista_move_down = (0, 0, 0, [(key_is_down, key_down),(eq,"$balista_action",1),],
		  [(scene_prop_get_instance,":balista_instance", "spr_balista", 0),   
		  (prop_instance_get_position,pos1,":balista_instance"),     
		  (position_rotate_x,pos1,-3),  
		  (prop_instance_animate_to_position,":balista_instance",pos1,10), 
		]) 
ballista_move_left = (0, 0, 0, [(key_is_down, key_left),(eq,"$balista_action",1),],
		  [(scene_prop_get_instance,":balista_instance", "spr_balista", 0),
			(prop_instance_get_position,pos1,":balista_instance"),    
			(position_rotate_z,pos1,3),         
			(prop_instance_animate_to_position,":balista_instance",pos1,10),   
		])
ballista_move_right = (0, 0, 0, [(key_is_down, key_right),(eq,"$balista_action",1),],
		  [(scene_prop_get_instance,":balista_instance", "spr_balista", 0), 
			(prop_instance_get_position,pos1,":balista_instance"),      
			(position_rotate_z,pos1,-3),    
			(prop_instance_animate_to_position,":balista_instance",pos1,10), 
			
		]), 

Also, is there an operation to check if a party is on land or water? 
 
@Bolkonsky:
Removing the comma ithilienranger notes may solve your issue.

A few ways you could find out about land/water. The easiest would likely be
(party_get_current_terrain,<destination>,<party_id>),
with the result rt_water = 0  (see header_terrain_types)
 
Removing the comma worked!  Thanks!

Caba`drin said:
@Bolkonsky:
Removing the comma ithilienranger notes may solve your issue.

A few ways you could find out about land/water. The easiest would likely be
(party_get_current_terrain,<destination>,<party_id>),
with the result rt_water = 0  (see header_terrain_types)

What would I put in the destination slot? 
 
Bolkonsky said:
Removing the comma worked!  Thanks!

Caba`drin said:
@Bolkonsky:
Removing the comma ithilienranger notes may solve your issue.

A few ways you could find out about land/water. The easiest would likely be
(party_get_current_terrain,<destination>,<party_id>),
with the result rt_water = 0  (see header_terrain_types)

What would I put in the destination slot?
For the party id I guess. You get the party id then put the party id as destination, e.g, ":myparty" and then it checks the terrain for that party. I may be wrong but Id guess it's like that.
 
So it would be

(party_get_current_terrain, ":terrain", ":party_id"),
(eq, ":terrain", 0), #If you want it to be water...or use neq if you DON'T want it to be water.
with you setting whatever the value for ":party_id" earlier in the code.
 
mr.master said:
dunde said:
mr.master said:
Yes I know but I meant that is there any easire way to add this to all weapons? Since I'm intending to add weapon specific  death sounds to all weapons and thus wondering if it would be possible to determine the sounds looking at what imodbit the weapon has.

1st, imodbits is used to determine each imodbit an item can has. So from imodbit, we can't determine what weapon hit the agent. You should use item type instead but it's inacureate for it lead to single handed or double handed weapon instead of club or sword. You can  use similar way rubik saves weapon stats to slot, you can save the imodbits into 'weapon type' slot.
Then just use the ti_on_agent_hit, get the 'weapon type' slot of atacker's weapon and play your sound according it's value.
Hmm. Well, I did so know that I just arranged the weapons so that swords in one place, maces in one place etc. Then, Ill just make the game check the the weapon is between these weapons, and then plays the specific sound.

Edit: Well for some reason, it only works for the maces, but not for swords nor axes etc. Here is the code

Code:
	(ti_on_agent_hit, 0, 0, [],[
		(assign, ":item", reg0),
		(store_trigger_param_1, ":inflicted_agent"),
		(agent_is_human, ":inflicted_agent"), #no animal abuse?
		(store_trigger_param_3, ":damage"),
		(store_agent_hit_points, ":hp", ":inflicted_agent", 1),
		(val_sub, ":hp", ":damage"),
		(le, ":hp", 0),
		(try_begin),
			(is_between, ":item", "itm_hammer", "itm_hatchet"),
			(agent_play_sound, ":inflicted_agent", "snd_club_death"),
		(else_try),
			(is_between, ":item", "itm_sarranid_mace_1", "itm_scythe"),
			(agent_play_sound, ":inflicted_agent", "snd_axe_death"),
		(else_try),
			(is_between, ":item", "itm_poleaxe", "itm_sickle"),
			(agent_play_sound, ":inflicted_agent", "snd_spear_death"),
		(else_try),
			(is_between, ":item", "itm_awlpike_long", "itm_polehammer"),
			(agent_play_sound, ":inflicted_agent", "snd_sword_death"),
		(else_try),
			(is_between, ":item", "itm_charger", "itm_pilgrim_disguise"),
			(agent_play_sound, ":inflicted_agent", "snd_arrow_death"),
		(try_end),
    #or fetch sound from item slot, etc.
	]),

Edit 2 : Well, it works but it plays the wrong sounds for some of them. Example, where it's supposed to be snd_sword_death, it plays axe_death sounds.
Hmm. Found out that you cant change the order of the weapons or the game will explode. Any suggestions? I though that I could use your suggestion dunde but I'm not too sure how to do it.
 
Caba`drin said:
So it would be

(party_get_current_terrain, ":terrain", ":party_id"),
(eq, ":terrain", 0), #If you want it to be water...or use neq if you DON'T want it to be water.
with you setting whatever the value for ":party_id" earlier in the code.

I see.  Thanks! 
 
Status
Not open for further replies.
Back
Top Bottom