Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Nothing to do Sebastian. It doesn't work. This is a piece of the code to more some props. pos1 holds the pos of target prop.
Code:
(copy_position, pos6, pos1),
(position_rotate_z, pos6, 90),	
(copy_position, pos7, pos6),
(copy_position, pos8, pos6),
(copy_position, pos9, pos6),		
(copy_position, pos10, pos6),
(copy_position, pos11, pos6),

(position_rotate_z, pos7, -90),
(position_move_z, pos7, 70, 0),
(position_rotate_x, pos7, 180),

(position_rotate_z, pos8, 180),
(position_rotate_x, pos8, -90),
(position_move_z, pos8, -185, 0),
(position_move_y, pos8, -10, 0),

(position_move_y, pos9, -240, 0),
(position_move_z, pos9, 105, 0),
(position_rotate_x, pos9, 180),
(position_rotate_z, pos9, -180),

(position_move_y, pos10, 120, 0),
(position_move_z, pos10, 130, 0),
(position_rotate_z, pos10, -180),
(position_rotate_x, pos10, 180),

(position_move_y, pos11, -120, 0),
(position_move_z, pos11, 130, 0),
(position_rotate_z, pos11, -180),
(position_rotate_x, pos11, 180),

The result is the props fly directly to final target.
 
frozenpainter said:
  # script_game_get_upgrade_cost
  # This script is called from game engine for calculating needed cost upgrade
  # Input:
  # param1: troop_id,
  # Output: reg0 = needed cost for upgrade
  ("game_get_upgrade_cost",
    [
      (store_script_param_1, ":troop_id"),
     
      (store_character_level, ":troop_level", ":troop_id"),
     
      (try_begin),
        (is_between, ":troop_level", 0, 6),
        (assign, reg0, 10),
      (else_try),
        (is_between, ":troop_level", 6, 11),
        (assign, reg0, 20),
      (else_try),
        (is_between, ":troop_level", 11, 16),
        (assign, reg0, 40),
      (else_try),
        (is_between, ":troop_level", 16, 21),
        (assign, reg0, 80),

      (else_try),
        (is_between, ":troop_level", 21, 26),
        (assign, reg0, 120),
      (else_try),
        (is_between, ":troop_level", 26, 31),
        (assign, reg0, 160),
      (else_try),
        (assign, reg0, 200),
      (try_end),
     
      (set_trigger_result, reg0),
  ]),

Thank you very much,  I find where's the error  :grin:
 
K.A. said:
Nothing to do Sebastian. It doesn't work. This is a piece of the code to more some props. pos1 holds the pos of target prop.

look for operations on

Code:
[ Z21 ] SCENE PROPS, SCENE ITEMS, LIGHT SOURCES AND PARTICLE SYSTEM

and you will find what you are looking for



fladin said:
Question 2 : in single player, is it  possible to force the  first person view (R key) during mission  ?

yeap, you may need to update your header_operations.py for 1.168

Code:
# Camera and rendering operations

is_camera_in_first_person                    = 61    # (is_camera_in_first_person),
set_camera_in_first_person                   = 62    # (set_camera_in_first_person, <value>), 
                                                     # 1 = first, 0 = third person
 
K.A. said:
What i wanted to achieve is gradually movement toward target scene prop.

and that is exactly what the operation does, if you check Lav's header_operations.py for them. So again, check all the operations on Z21, in special the _animation_ ones
 
Hey guys
While having no wifi i could not download some models (have them now :grin:)
so i decided to work on a perfect organized roman army
i added shield bashing but the problem is that some of the troops in the back of the rank formation keep falling down :sad:
they fall exactly like the victims do but the code contains an ensurance that only people forward of position fall
and that the teams of victim and dealer cant match
heres my code: (all mt)
Code:
common_battle_rome_fight = (
  5, 0, 0, [],
  [
     (try_for_agents, ":agent"), # search all agents   
		(agent_is_alive, ":agent"), # exclude dead agents
		(agent_is_human, ":agent"), # exclude horses (and futuristic mod things)
		(get_player_agent_no, ":player_agent"), # get player agent
		(neq, ":agent", ":player_agent"), # exclude player from search
		(agent_get_team, ":roman_team", ":agent"),
		(agent_get_troop_id, ":troop_no", ":agent"), #get troop of agents left
		(this_or_next|eq, ":troop_no", "trp_swadian_recruit"), # roman infantry begin
		(this_or_next|eq, ":troop_no", "trp_swadian_militia"),
		(this_or_next|eq, ":troop_no", "trp_swadian_footman"),
		(this_or_next|eq, ":troop_no", "trp_swadian_infantry"),
		(this_or_next|eq, ":troop_no", "trp_swadian_infantry2"),
		(this_or_next|eq, ":troop_no", "trp_swadian_sergeant"),
		(eq, ":troop_no", "trp_swadian_man_at_arms"), # roman infantry end
		(agent_get_position, pos2, ":agent"),
		(try_for_agents, ":enemy"),
			(neq, ":agent", ":enemy"),
			(agent_is_alive, ":enemy"), # exclude dead agents
			(agent_is_human, ":enemy"), # exclude horses (and futuristic mod things)
			(agent_get_team, ":enemy_team", ":enemy"),
			(neq, ":enemy_team", ":roman_team"),
			(agent_get_position, pos3, ":enemy"),
			(get_distance_between_positions_in_meters, ":distance", pos2, pos3),
			(try_begin),
				(le, ":distance", 1),
				(assign, "$g_bash_distance", 1),
			(else_try),
				(gt, ":distance", 1),
				(assign, "$g_bash_distance", 0),
			(try_end),
		(try_end),
		(agent_get_animation, ":anim", ":agent", 0),
		(neq, ":anim", "anim_shield_bash"), # not already shield bashing
		(agent_set_defend_action, ":agent" ,2 ,1), # blocking 2 sec
		(agent_get_wielded_item, ":shield_item", ":agent", 1),
		(gt, ":shield_item", itm_no_item),
		(item_get_type, ":type", ":shield_item"),
		(eq, ":type", itp_type_shield), 
		(try_begin), # builders For Rome begin
			(this_or_next|eq, ":shield_item", itm_scutum),
			(this_or_next|eq, ":shield_item", itm_scutumcen),
			(this_or_next|eq, ":shield_item", itm_scutumop),
			(eq, ":shield_item", itm_scutumprae),
			(assign, "$g_roman_shield_equipped", 1),
		(try_end), # builders For Rome end
		(agent_set_animation, ":agent","anim_shield_bash"), # plays animation
		(agent_get_position, pos63, ":agent"), # stores position
		(agent_get_troop_id, ":id", ":agent"),
		(troop_get_type, ":type", ":id"),
		(try_begin),
			(eq, ":type", tf_male),
			(agent_play_sound, ":agent", "snd_man_yell"),
		(else_try),
			(agent_play_sound, ":agent", "snd_woman_yell"),		
		(try_end),
        (assign, ":bash_victim", -1),
		(assign, ":closest_dist", 100), #100 cm / 1m
		(assign, ":fp_closest_dist", 1), #1 meter
		(convert_to_fixed_point, ":fp_closest_dist"),
		(try_for_agents,":victim", pos63, ":fp_closest_dist"), #in distance :fp_closes_dist on pos63
			(neq, ":victim", ":agent"),
			(agent_get_team, ":victim_team", ":victim"),
			(neq, ":victim_team", ":roman_team"),
			(agent_is_human, ":agent"),#stop if not human			
			(agent_is_alive,":agent"),	
			(agent_get_horse, ":horse", ":agent"),
			(eq, ":horse", -1), # eq unmounted
			(agent_get_position,pos62,":victim"),
			(neg|position_is_behind_position, pos62, pos63),
			(get_distance_between_positions,":dist",pos63,pos62),	
			(assign, reg0, ":dist"),
			(display_message, "str_reg0"),		
			(le, ":dist", ":closest_dist"),				
			(assign, ":bash_victim", ":victim"),
			(assign, ":closest_dist", ":dist"),
		(try_end),
		(try_begin),
			(ge, ":victim", 0),
			(agent_play_sound, ":agent", "snd_wooden_hit_low_armor_high_damage"),				
			(agent_set_animation, ":victim", "anim_shield_strike"),		
		(try_end),
		(try_begin), # builders For Rome
			(eq, "$g_roman_shield_equipped", 1), # if item equipped is scutum
			(agent_deliver_damage_to_agent, ":agent", ":victim", 20), #pretty much damage for the scutum
		(try_end),
	  (try_end),
  ])
 
Does prop_instance_intersects_with_prop_instance not work? I've attempted to use it with objects that have collision and objects that lack collision, and in both cases it failed to detect when objects were actually intersecting.

For the following code, I placed two doors in a scene and made them clearly intersect, but the result still told me that they were not detected to be intersecting.

Code:
test_intersection_check = ( 
  ti_tab_pressed, 0, 1, #check interval, delay interval, and re-arm interval
  [],
  [
    (try_for_prop_instances, ":b_spi_id", "spr_door_a"),
      (try_for_prop_instances, ":a_spi_id", "spr_door_b"),
	    (prop_instance_intersects_with_prop_instance, ":b_spi_id", ":a_spi_id"),
	    (display_message,"@Obj A is detected to intersect with Obj B.",0xFFFFFFFF),
      (else_try),
	    (display_message,"@Obj A is NOT detected to intersect with Obj B.",0xFFFFFFFF),
      (try_end),
    (try_end),
  ]
)
 
Nate said:
Does prop_instance_intersects_with_prop_instance not work?

I didn't test the operation under 1.168, but things to note before you can do that:

1) Check header_operations.py for the operations listed under can_fail_operations
--> same deal as a cf_ script

2) try_for is a loop operation, so your syntax is off on the else_try
 
Thanks, that was a fundamental misunderstanding on my part. Here's the corrected code:

test_intersection_check = (
  ti_tab_pressed, 0, 1, #check interval, delay interval, and re-arm interval
  [],
  [
    (try_for_prop_instances, ":a_spi_id", "spr_door_a"),
      (try_for_prop_instances, ":b_spi_id", "spr_door_b"),
        (try_begin),
  (prop_instance_intersects_with_prop_instance, ":a_spi_id", ":b_spi_id"),
  (display_message,"@Obj A is detected to intersect with Obj B.",0xFFFFFFFF),
        (else_try),
  (display_message,"@Obj A is NOT detected to intersect with Obj B.",0xFFFFFFFF),
(try_end),
      (try_end),
    (try_end),
  ]
)

Sorry about the weird spacing--I'm not sure how to make it display properly on TWF. Anyway, it still failed to detect the intersection.

I checked and confirmed that prop_instance_intersects_with_prop_instance is part of can_fail_operations.
 
prop_instance_intersects_with_prop_instance probably wont recognize intersections that happend before mission-start.
Try to move a prop into another prop during a mission(prop_instance_set_position / prop_instance_animate_to_position) and then check again.
Code:
(prop_instance_intersects_with_prop_instance, ":instance", -1),#checks against all props
Keep in mind that both props must have active collision meshes.
 
Which is condition for dialog so it can be spoken only once a day example (i wont write it right)
[happy_widow, "start", [what should go here?], "You wanna have good time", "happy_widow_talk", []],
 
Dangerdude said:
Dangerdude said:
Arch3r said:
Dangerdude said:
I havent come here to ask for a new OSP, because its not really an OSP and not new, I came here to question someone how to do it. And I dont really get those steps in your original post.

"I want the pike to automatically drop when drawing another weapon"
Thats what I asked for

Code:
mp_large_weapon_drop = ( 
    ti_on_item_unwielded, 0, 0, [],
    [(store_trigger_param_1, ":agent_no"),
     (store_trigger_param_2, ":item_no"),

     (try_begin),
       (multiplayer_is_server), #check is done serverside, as well as spawning the dropped item on the ground
       (neg|agent_is_non_player, ":agent_no"), #not for bots, only players
       (is_between, ":item_no", "itm_scythe", "itm_wooden_shield"),
       (agent_unequip_item,":agent_no",":item_no"),

       (agent_get_position, pos0, ":agent_no"),
       (set_spawn_position, pos0),
       (spawn_item, ":item_no", 120), #despawns after 120 seconds.
     (else_try),
       (neg|multiplayer_is_server), #client, only for displaying the message.
       (multiplayer_get_my_player, ":my_player"),
       (player_get_agent_id, ":my_agent", ":my_player"),
       (eq, ":my_agent", ":agent_no"),
       (is_between, ":item_no", "itm_scythe", "itm_wooden_shield"),
       (display_message, "@Weapon too large to sheath - weapon dropped", 0xDB7304),
     (try_end),
     ])
Should be easy to turn into a SP if that's what you were looking for.
Hi. Sadly it doesnt work form me. I dont know what could be the problem
Do I have to create a trigger or something like that?
Bump
 
kalarhan said:
fladin said:
Question 2 : in single player, is it  possible to force the  first person view (R key) during mission  ?

yeap, you may need to update your header_operations.py for 1.168

Code:
# Camera and rendering operations

is_camera_in_first_person                    = 61    # (is_camera_in_first_person),
set_camera_in_first_person                   = 62    # (set_camera_in_first_person, <value>), 
                                                     # 1 = first, 0 = third person

Ah ok, thank you  :grin:
 
Which is condition for dialog so it can be spoken only once a day example (i wont write it right)
[happy_widow, "start", [what should go here?], "You wanna have good time", "happy_widow_talk", []],
 
DarkNord said:
Which is condition for dialog so it can be spoken only once a day example (i wont write it right)
[happy_widow, "start", [what should go here?], "You wanna have good time", "happy_widow_talk", []],

You should use the code tag when posting code

Code:
code here

You can use the same system as Native. A slot for waiting period and a trigger that updates it from time to time. A example is waiting for XX days, and every day the trigger removes 1 from it

You could use "slot_troop_days_on_mission" or a a new slot like "slot_troop_cant_talk_for_days" or whatever you want to call it
 
Im getting RGL error: Unexpected end of file troops.txt while reading the file. I tried to find the syntax error but failed. Is there a way to easily find it?
 
Having a hell of a time adding generated grass to desert and snow scenes.

Just added the fkf_desert modifier to grass as a starter, in the flora_kinds, but the grass doesn't show up.

Code:
 ("desert_grass",fkf_grass|fkf_on_green_ground|fkf_guarantee|fkf_align_with_ground|fkf_point_up|fkf_desert|fkf_desert_forest|density(600),[["grass_a","0"],["grass_b","0"],["grass_c","0"],["grass_d","0"],["grass_e","0"]]),

Is there a guide for this that I've completely missed?
 
Status
Not open for further replies.
Back
Top Bottom