Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
xPearse said:
usnavy30 said:
I'm realizing we too are having the same problem
Any weight over 60-80+ is somehow changed in-game to 1,2,3,4,5 in weight.
Even at 40 weight it was like this.
Bits, fellas, bits.

xPearse said:
Looked in the osp but didn't find anything, searched here and found this. Im not good at this and don't know how to set this up for the zombies troops I have, any help on how to.
For God's sake...
Code:
(ti_on_agent_spawn, 0, 0, [
	(store_trigger_param, ":agent", 1),
	(agent_get_troop_id, ":troop", ":agent"),
	(troop_get_type, ":race", ":troop"),
	(eq, ":race", tf_ZOMBIE_MOTHER_****ER), # Whatever you've got them defined as in header_troops and module_skins
	(agent_set_speed_limit, ":agent", 4),
  ], []),
Easy as pie.

@Stan: Things on my side spiralled out of control this evening and as much as I don't like not fulfilling my promises, I can't help you out with your code tonight. I'll take a peek at it first thing in the morning though.

In the mean time, why does a mesh_overlay_with_tableau_material not register a mouse_enter event? Is it because I'm using -1 as the mesh?
 
Lumos said:
@Stan: Things on my side spiralled out of control this evening and as much as I don't like not fulfilling my promises, I can't help you out with your code tonight. I'll take a peek at it first thing in the morning though.
No problem!  :wink:

Thanks for the help again!

Lumos said:
In the mean time, why does a mesh_overlay_with_tableau_material not register a mouse_enter event? Is it because I'm using -1 as the mesh?
Umm... I'm not sure but doesn't this: mesh_overlay_with_tableau_material

Have to be like this: create_mesh_overlay_with_tableau_material

I'm just putting it out there... (I guess you're editing module_presentations.py)
 
DanyEle said:
Hello fellow modders, i have a question regarding props and instances. Basically, is there a way for assigning a prop to another one so that one moves on the Z axis of a scene and the other one rotates on the Y axis in front of it, always staying in the same position?
Are you trying to do wheels or a carriage? Modify the Belfry code or any code for cannons with moving wheels (NW)?
Lumos said:
Code:
(ti_on_agent_spawn, 0, 0, [
	(store_trigger_param, ":agent", 1),
	(agent_get_troop_id, ":troop", ":agent"),
	(troop_get_type, ":race", ":troop"),
	(eq, ":race", tf_ZOMBIE_MOTHER_****ER), # Whatever you've got them defined as in header_troops and module_skins
	(agent_set_speed_limit, ":agent", 4),
  ], []),
Easy as pie.
Note that agent_set_speed_limit won't really work for players that get ahold of the equipment or multiplayer agents.
Lumos said:
You do realise I was talking about the overlay itself and not the operation which obviously creates it, right? :razz:
If you want clickable tableaus, try create_image_button_overlay_with_tableau_material? Buttons definitely trigger the mouse event.
Stan233 said:
But at this point I won't be surprised if that won't work too... Because at this point :
xVyoSl.jpg
Raising troop attributes is really not the way to go for modifying agents. You have several options at this point - either making the agent spam agent_set_attack_action (which should ignore the weapon's speed limits, but you need to make sure the weapon has the attack direction), equipping it with a variant of their wielded weapon that does more damage (making it faster, deal more damage - downside is adding more items and making sure the player can't get access), or using agent_set_damage_modifier/agent_set_speed_modifier/agent_set_max_hit_points in combination to achieve the right consistency of dealing more damage, running around faster, and taking more damage (you still need to refill their health though).
 
I have a problem with village icons. I've made 9 new villages for my newest faction and I have the icon set to icon_village_a on all 9 villages, but yet when the villages increase in prosperity the icons change to icon_village_c, I suspect there is missing code related to the villages because I have re-written all the related lines of code multiple times and yielded no results. What am I missing? :???:
 
I remember a modification to multiplayer which let multiplayer bots crouch and stand up random. The video shew it working in castle siege on desert map. I don't remember the name of this mod ( it was only this small enhancement not full mod). Does anyone knows where is this mod? I can't find it.
 
Somebody said:
Stan233 said:
But at this point I won't be surprised if that won't work too... Because at this point :
xVyoSl.jpg
Raising troop attributes is really not the way to go for modifying agents. You have several options at this point - either making the agent spam agent_set_attack_action (which should ignore the weapon's speed limits, but you need to make sure the weapon has the attack direction), equipping it with a variant of their wielded weapon that does more damage (making it faster, deal more damage - downside is adding more items and making sure the player can't get access), or using agent_set_damage_modifier/agent_set_speed_modifier/agent_set_max_hit_points in combination to achieve the right consistency of dealing more damage, running around faster, and taking more damage (you still need to refill their health though).
Hmmm, yeah I thought the script won't work since we are dealing with agents and not with troops in the code... You said to I can use the agent_set_attack_action, I don't think that might be best for what I have now, so I think I'll go for the agent_set_damage_modifier/agent_set_speed_modifier/agent_set_max_hit_points operations sounds best for me!

Anyway thanks Somebody!  :grin:  Although that doesn't clarify to me how to set the condition when the actual berserkers are at a certain distance , and at that distance they start to rage... Lumos said he will see to it in the morning, I'm not pushing anyone (everyone has personal life after all) it's just that I've tried many combinations of operations and none worked... (You can see one of the experiments, my messed up code in a previous post)

But, yeah Thanks for helping!
 
Somebody said:
DanyEle said:
Hello fellow modders, i have a question regarding props and instances. Basically, is there a way for assigning a prop to another one so that one moves on the Z axis of a scene and the other one rotates on the Y axis in front of it, always staying in the same position?
Are you trying to do wheels or a carriage? Modify the Belfry code or any code for cannons with moving wheels (NW)?



Something more challening: airplanes with a rotating propeller. This is the code for the airplane to make it move. I just replaced the bird flying in the sky with an airplane model.

Code:
multiplayer_server_move_bird_common = (
  4, 0, 0, [(this_or_next|multiplayer_is_server),(neg|game_in_multiplayer_mode),],
  [
    (set_fixed_point_multiplier,1000),
    (scene_prop_get_num_instances,":num_birds","spr_ie_airplane"),
    (try_for_range,":bird_num",0,":num_birds"),
      (scene_prop_get_instance, ":bird_id", "spr_ie_airplane", ":bird_num"),
      (scene_prop_slot_eq,":bird_id", scene_prop_slot_in_use, 1),
      
      (prop_instance_get_position, pos23, ":bird_id"),
      
      
      (store_random_in_range,":rotation_angle",-50,50),
      (position_rotate_z,pos23,":rotation_angle"),
      (position_move_y,pos23,7500,0),#2500
      (prop_instance_animate_to_position, ":bird_id", pos23, 560),#2000
    (try_end),
  ])

And the code to rotate the propeller, inspired by the windmills' fans.

Code:
multiplayer_ie_server_turn_propeller = (
  0.3, 0, 0, [(this_or_next|multiplayer_is_server),(neg|game_in_multiplayer_mode),],
  [
    (try_for_range,":fan_type", "spr_ie_propeller", "spr_propellers_end"),
      (scene_prop_get_num_instances, ":end_cond", ":fan_type"),
      (try_for_range,":cur_instance",0,":end_cond"),
        (scene_prop_get_instance, ":instance_id", ":fan_type", ":cur_instance"),
     
        #(scene_prop_slot_eq, ":instance_id", scene_prop_slot_in_use, 1), # ball is in use.
        
        (prop_instance_get_position, pos16, ":instance_id"),
        (position_rotate_y, pos16, 90),
        (prop_instance_animate_to_position, ":instance_id", pos16, 700),
      (try_end),
    (try_end),
  ])

So, how can i attach those 2 parts and make them move together?
 
using some glue? kidding...

you need to move the propeller using the airplane position...you get the position of the airplane, then you do pos_move_y that the propeller will be in the front of the airplane, then rotate that position and there you have the pos of the propeller. you don't need to rotate/move the position of plane/propeller independent, you need to move the airplane, and then calculate the new position of the propeller using the airplane position.(it will require 1 trigger and 1 extra slot that that will hold the propeller id by the airplane id)
 
Stan233 said:
Lumos said he will see to it in the morning
Sorry. I was... delayed. Though this is not an excuse.
Anyways, I'm here.

So, assuming you'd want to have that 30-seconds duration and 5-minute cooldown, all we need to do to make the triggering range-dependable is to change one of the triggers only.
- Use all codes from the previous post, replace the mission_templates part with this:
Code:
#-## TBS - Berserker raging
berserker_rage = [
 
 # rage_check
 (0.5, 0, 0, [], [
	# Try for all berserkers
	(try_for_agents, ":agent"),
		(agent_is_human, ":agent"),
		(agent_is_alive, ":agent"),
		(agent_get_troop_id, ":troop", ":agent"),
		(this_or_next|eq, ":troop", "trp_nord_berserker"),
		(eq, ":troop", "trp_nord_armoured_berserker"),
		(agent_slot_eq, ":agent", slot_agent_raging, 0), # Not raging, but ready
		(agent_get_team, ":berserker_team", ":agent"),
		(try_for_agents, ":enemy_agent"),
			(agent_is_human, ":enemy_agent"),
			(agent_is_alive, ":enemy_agent"),
			(agent_get_team, ":enemy_team", ":enemy_agent"),
			(neq, ":berserker_team", ":enemy_team"), # Just in case
			(teams_are_enemies, ":berserker_team", ":enemy_team"),
			(agent_get_position, pos1, ":agent"),
			(agent_get_position, pos2, ":enemy_agent"),
			(get_distance_between_positions, ":dist", pos1, pos2),
			(le, ":dist", 500), # If close enough
			(agent_set_slot, ":agent", slot_agent_raging, rage_duration),
			(agent_set_damage_modifier, ":agent", 600), # No health boosts, or they'd get too overpowered.
			(agent_set_speed_modifier, ":agent", 300),
		(try_end),
	(try_end),
  ]),

 # rage_tick
 (1, 0, 0, [], [
	(try_for_agents, ":agent"), # Not sure how this could be more efficient right now
		(neg|agent_slot_eq, ":agent", slot_agent_raging, 0), # Consider only these agents that interest us
		(agent_get_slot, ":state", ":agent", slot_agent_raging),
		(try_begin), # Operate
			(eq, ":state", 1), # If the time is running out...
			(agent_set_damage_modifier, ":agent", 100), # ... revert to normal
			# Set the cooldown
			(store_mul, ":cooldown", rage_cooldown, -1),
			(agent_set_slot, ":agent", slot_agent_raging, ":cooldown"),
		(else_try),
			(gt, ":state", 1), # If the clock is ticking and the rage is active
			(val_sub, ":state", 1), # Tick one second
			(agent_set_slot, ":agent", slot_agent_raging, ":state"),
		(else_try),
			(lt, ":state", 0), # If the cooldown is ticking
			(val_add, ":state", 1), # Decrease cooldown amount by one till it reaches zero
		(try_end),
	(try_end),
  ]),
  
]
#-## TBS - Berserker raging end
Thsi is noticeably less commented, but you should be OK with reading it now. I am quite uncertain if I'm using the most efficient way to check the distances between all agents, but we can still afford to run the trigger less often than every frame for performance reasons. If you're using the WSE, you can make the try_for_agents loop within a specified distance only, which would be useful in the current circustances.
One more thing: The current version gives berserkers a massive damage and speed boost and no health bonus for balance. I'd recommend making them less armoured and with no shields, or they would shred things in pieces. Or just tone down the boosts and play around with them 'till you're happy with the results.
And one last note: Berserkers and Armoured Berserkers will get the same benefits. Your script had it differently, so you might want to change that.
 
Lumos said:
Stan233 said:
Lumos said he will see to it in the morning
Sorry. I was... delayed. Though this is not an excuse.
Anyways, I'm here.

So, assuming you'd want to have that 30-seconds duration and 5-minute cooldown, all we need to do to make the triggering range-dependable is to change one of the triggers only.
- Use all codes from the previous post, replace the mission_templates part with this:
Code:
#-## TBS - Berserker raging
berserker_rage = [
 
 # rage_check
 (0.5, 0, 0, [], [
	# Try for all berserkers
	(try_for_agents, ":agent"),
		(agent_is_human, ":agent"),
		(agent_is_alive, ":agent"),
		(agent_get_troop_id, ":troop", ":agent"),
		(this_or_next|eq, ":troop", "trp_nord_berserker"),
		(eq, ":troop", "trp_nord_armoured_berserker"),
		(agent_slot_eq, ":agent", slot_agent_raging, 0), # Not raging, but ready
		(agent_get_team, ":berserker_team", ":agent"),
		(try_for_agents, ":enemy_agent"),
			(agent_is_human, ":agent"),
			(agent_is_alive, ":agent"),
			(agent_get_team, ":enemy_team", ":agent"),
			(neq, ":berserker_team", ":enemy_team"), # Just in case
			(teams_are_enemies, ":berserker_team", ":enemy_team"),
			(agent_get_position, pos1, ":agent"),
			(agent_get_position, pos2, ":enemy_agent"),
			(get_distance_between_positions, ":dist", pos1, pos2),
			(le, ":dist", 500), # If close enough
			(agent_set_slot, ":agent", slot_agent_raging, rage_duration),
			(agent_set_damage_modifier, ":agent", 600), # No health boosts, or they'd get too overpowered.
			(agent_set_speed_modifier, ":agent", 300),
		(try_end),
	(try_end),
  ]),

 # rage_tick
 (1, 0, 0, [], [
	(try_for_agents, ":agent"), # Not sure how this could be more efficient right now
		(neg|agent_slot_eq, ":agent", slot_agent_raging, 0), # Consider only these agents that interest us
		(agent_get_slot, ":state", ":agent", slot_agent_raging),
		(try_begin), # Operate
			(eq, ":state", 1), # If the time is running out...
			(agent_set_damage_modifier, ":agent", 100), # ... revert to normal
			# Set the cooldown
			(store_mul, ":cooldown", rage_cooldown, -1),
			(agent_set_slot, ":victim", slot_agent_raging, ":cooldown"),
		(else_try),
			(gt, ":state", 1), # If the clock is ticking and the rage is active
			(val_sub, ":state", 1), # Tick one second
			(agent_set_slot, ":victim", slot_agent_raging, ":state"),
		(else_try),
			(lt, ":state", 0), # If the cooldown is ticking
			(val_add, ":state", 1), # Decrease cooldown amount by one till it reaches zero
		(try_end),
	(try_end),
  ]),
  
]
#-## TBS - Berserker raging end
Thsi is noticeably less commented, but you should be OK with reading it now. I am quite uncertain if I'm using the most efficient way to check the distances between all agents, but we can still afford to run the trigger less often than every frame for performance reasons. If you're using the WSE, you can make the try_for_agents loop within a specified distance only, which would be useful in the current circustances.
One more thing: The current version gives berserkers a massive damage and speed boost and no health bonus for balance. I'd recommend making them less armoured and with no shields, or they would shred things in pieces. Or just tone down the boosts and play around with them 'till you're happy with the results.
And one last note: Berserkers and Armoured Berserkers will get the same benefits. Your script had it differently, so you might want to change that.
Thank you so very much for this!

However in this trigger:
# rage_tick
(1, 0, 0, [], [
(try_for_agents, ":agent"), # Not sure how this could be more efficient right now
(neg|agent_slot_eq, ":agent", slot_agent_raging, 0), # Consider only these agents that interest us
(agent_get_slot, ":state", ":agent", slot_agent_raging),
(try_begin), # Operate
(eq, ":state", 1), # If the time is running out...
(agent_set_damage_modifier, ":agent", 100), # ... revert to normal
# Set the cooldown
(store_mul, ":cooldown", rage_cooldown, -1),
(agent_set_slot, ":victim", slot_agent_raging, ":cooldown"),
(else_try),
(gt, ":state", 1), # If the clock is ticking and the rage is active
(val_sub, ":state", 1), # Tick one second
(agent_set_slot, ":victim", slot_agent_raging, ":state"),
(else_try),
(lt, ":state", 0), # If the cooldown is ticking
(val_add, ":state", 1), # Decrease cooldown amount by one till it reaches zero
(try_end),
(try_end),
  ]),
 
]
#-## TBS - Berserker raging end[/code]

there might be some errors (I only found one for now) like the local variable doesn't exist: ":victim"

And I'm not sure if I should replace it with the already set variable: ":agent"

One last thing instead of cool down time, could the rage duration last for, say, an entire battle and when the battle is over they return to normal, or is it not possible? If not I could just make the duration to be 5 minutes, because to be honest these guys are very hard to get in-game the player can get only like 2-3 (if he's not cheating of course).
 
Yes, of course. The ":victim" is because I'd simply copy-pasted it from the previous trigger, replace it with ":agent". Fixing it in my posts now.

To have no cooldowns and no durations, simply do not use the second trigger. (And, if you want, replace the only reference to
Code:
[color=navy]rage_duration[/color]
to 1 and don't add anything to the constants.)
 
I have three questions, fellows:

1. Where can I find a modern pack with modern buildings, objects, weapons etc etc? I'd love to create some modern looking cities in the mod I'm developing.
2. How can I add a new question/answer for a certain hero? I'd like to characterize the faction leaders and all.
3.How can I modify the reward of a mission?
 
1) OSP section
2)Read jiks updated modsys tutorial

And its generally considered rude to post if you haven't looked/tried to figure it out/tried to fix it yourself.
 
@Lumos
I do found another minor mistake in the first trigger:

Instead of this:
# rage_check
(0.5, 0, 0, [], [
# Try for all berserkers
(try_for_agents, ":agent"),
(agent_is_human, ":agent"),
(agent_is_alive, ":agent"),
(agent_get_troop_id, ":troop", ":agent"),
(this_or_next|eq, ":troop", "trp_nord_berserker"),
(eq, ":troop", "trp_nord_armoured_berserker"),
(agent_slot_eq, ":agent", slot_agent_raging, 0), # Not raging, but ready
(agent_get_team, ":berserker_team", ":agent"),
(try_for_agents, ":enemy_agent"),
(agent_is_human, ":agent"),
(agent_is_alive, ":agent"),
(agent_get_team, ":enemy_team", ":agent"),
(neq, ":berserker_team", ":enemy_team"), # Just in case
(teams_are_enemies, ":berserker_team", ":enemy_team"),
(agent_get_position, pos1, ":agent"),
(agent_get_position, pos2, ":enemy_agent"),
(get_distance_between_positions, ":dist", pos1, pos2),
(le, ":dist", 500), # If close enough
(agent_set_slot, ":agent", slot_agent_raging, rage_duration),
(agent_set_damage_modifier, ":agent", 600), # No health boosts, or they'd get too overpowered.
(agent_set_speed_modifier, ":agent", 300),
(try_end),
(try_end),
  ]),

It should be this:
# rage_check
(0.5, 0, 0, [], [
# Try for all berserkers
(try_for_agents, ":agent"),
(agent_is_human, ":agent"),
(agent_is_alive, ":agent"),
(agent_get_troop_id, ":troop", ":agent"),
(this_or_next|eq, ":troop", "trp_nord_berserker"),
(eq, ":troop", "trp_nord_armoured_berserker"),
(agent_slot_eq, ":agent", slot_agent_raging, 0), # Not raging, but ready
(agent_get_team, ":berserker_team", ":agent"),
(try_for_agents, ":enemy_agent"),
(agent_is_human, ":agent"),
(agent_is_alive, ":agent"),
(agent_get_team, ":enemy_team", ":enemy_agent"),
(neq, ":berserker_team", ":enemy_team"), # Just in case
(teams_are_enemies, ":berserker_team", ":enemy_team"),
(agent_get_position, pos1, ":agent"),
(agent_get_position, pos2, ":enemy_agent"),
(get_distance_between_positions, ":dist", pos1, pos2),
(le, ":dist", 500), # If close enough
(agent_set_slot, ":agent", slot_agent_raging, rage_duration),
(agent_set_damage_modifier, ":agent", 600), # No health boosts, or they'd get too overpowered.
(agent_set_speed_modifier, ":agent", 300),
(try_end),
(try_end),
  ]),

But other than that it works like a charm! Again, THANK YOU!

Oh, and one very final question, if you don't mind me asking: In what is the distance measured? (in bits, in meters or in something else)
 
DanyEle said:
Something more challening: airplanes with a rotating propeller. This is the code for the airplane to make it move. I just replaced the bird flying in the sky with an airplane model.
With regards to airplanes, is the player going to be actually close enough to see them dogfight? If they're just patrolling way off in the distance, there's absolutely no requirement for the propellers to be moving at all - you can just model it as a blurred wheel and the player can use their imagination (not to mention the pilot, waving scarfs, etc).
 
Status
Not open for further replies.
Back
Top Bottom