Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
You can also spawn placeholder parties (similar to how bridges are defined in module_parties) so you do not need to rework every single icon. This makes it modular and you'll only need as many map icons as you have upgrades for.
ithilienranger said:
Billath said:
Hey guys me again this time on a slightly different topic

Shields, is there anyway to get the current health of a shield on an agent?
If so how I  been trying to figure it out and it doesn't seem obvious.
There is, but it isn't easy. You need to add some Python code to get the item hitpoints and store it in an item slot.
Caba`drin said:
Does anyone know the possibilities for working with the following operation:
(troop_set_face_key_from_current_profile, <troop_id>),

For instance, is there a way to use it to change the appearance of an NPC Lord or Hero...say after they were "killed" and one codes a "new" Lord to be raised in their place by renaming the troop and changing its attributes?
I was thinking of using it to fix the problem with the bodyguards script changing face codes.
The "current" shield health cannot be fetched - the only way we have to intercept damage is ti_on_item_hit, and since we're using a shield, the agent shouldn't hit at all.

The problem with would still persist - it changes the facecode for the troop, not the agent. After the mission they'll all become clones of your multiplayer profile. DNA can be fetched per unit stack - this would be successful for heroes - but spawn_agent does not use that parameter. While you can have multiple profiles, there's no way to modify them from singleplayer. The only way you have of persistently changing appearances in-game is troop_set_age. They'll look the same, but older. Otherwise, you'd have to fetch their DNA and change their appearance every time they appear as a visitor.
 
Somebody said:
You can also spawn placeholder parties (similar to how bridges are defined in module_parties) so you do not need to rework every single icon. This makes it modular and you'll only need as many map icons as you have upgrades for.
If I manage to do all that stuff, I would moddel some models (that is what I can do), such as I already mentioned - build dock(give 3% more tax income)/upgrade to port (5% tax income+ you can buy ships). Than also light houses, another wall around town, or even change whole town icon and replace it with bigger one (as your city grows), than hospitals, academys... to shorten my story, you get income and loyality and your town icon grows and gets some beutifications. So that was idea.
 
Hello all,

I'm trying to put a sword i modeled in the game, I've done this multiple times with others things (including swords) but for the first time I'm getting a error in process_items.py file when compiling the module:
Code:
Traceback (most recent call last):
  File "process_items.py", line 72, in <module>
    write_items(variables,variable_uses,tag_uses,quick_strings)
  File "process_items.py", line 46, in write_items
    ofile.write(" %d\n"%(len(item[9])))
TypeError: object of type 'long' has no len()
I didn't change anything in the process_files... only in the module_files and i couldn't solve the problem after extensive search through the forum. If someone could help me i would apreciate it.
Thanks In Advance...
 
Here:
Code:
["gladius","Gladius BY LK", [("gladius",0)], itp_type_one_handed_wpn|itp_primary, itc_longsword|itcf_carry_sword_left_hip, 0, weight(1.0), difficulty(0), spd_rtng(105), weapon_length(59), swing_damage(18,cut), thrust_damage(30,pierce),imodbits_none],

I also added a musket, a sabre, a roman shield but the problem only started after i added the gladius.

Buuuuuut... after reading my own code i think i noticed the problem  :idea:
will edit if works

EDIT: Worked!!! thank you for making me note the problem... what a bad error of mine! Put commas where there should be |

edit2: Is the crouch script Open sourced or there is an easy way to implement it in my mod? because i see that there is an crouch animation in the game core files
 
Somebody said:
You can also spawn placeholder parties (similar to how bridges are defined in module_parties) so you do not need to rework every single icon. This makes it modular and you'll only need as many map icons as you have upgrades for.
ithilienranger said:
Billath said:
Hey guys me again this time on a slightly different topic

Shields, is there anyway to get the current health of a shield on an agent?
If so how I  been trying to figure it out and it doesn't seem obvious.
There is, but it isn't easy. You need to add some Python code to get the item hitpoints and store it in an item slot.
Caba`drin said:
Does anyone know the possibilities for working with the following operation:
(troop_set_face_key_from_current_profile, <troop_id>),

For instance, is there a way to use it to change the appearance of an NPC Lord or Hero...say after they were "killed" and one codes a "new" Lord to be raised in their place by renaming the troop and changing its attributes?
I was thinking of using it to fix the problem with the bodyguards script changing face codes.
The "current" shield health cannot be fetched - the only way we have to intercept damage is ti_on_item_hit, and since we're using a shield, the agent shouldn't hit at all.

The problem with would still persist - it changes the facecode for the troop, not the agent. After the mission they'll all become clones of your multiplayer profile. DNA can be fetched per unit stack - this would be successful for heroes - but spawn_agent does not use that parameter. While you can have multiple profiles, there's no way to modify them from singleplayer. The only way you have of persistently changing appearances in-game is troop_set_age. They'll look the same, but older. Otherwise, you'd have to fetch their DNA and change their appearance every time they appear as a visitor.

There's a ti_on_item_hit? but that doesn't exist as a trigger....does it?
 
Hm oh probably....since a shield block does still cause that to fire....hm....
But still then how do I get the items stats? I am a complete newb when it comes to that I don't have too much of a clue about it....
Wouldn't a check for a difference in an agents health serve as that...I mean I only need it for the player...
 
Theoris said:
you could, however, find out where it hit and whether it hit a shield or not.
How do you intend to do this? You need to take into account damage done through all melee, ranged, and custom damage.
 
Billath said:
Hm oh probably....since a shield block does still cause that to fire....hm....
But still then how do I get the items stats? I am a complete newb when it comes to that I don't have too much of a clue about it....
Wouldn't a check for a difference in an agents health serve as that...I mean I only need it for the player...

You really can't get item stats directly.

step 1. Copy the base shield health for a new slot for each shield

step 2. Track any damage done to the shield.  Frankly this is near impossible. ti_on_agent_hit doesn't tirgger on shield hits, just agent hits so... you have no real ways to do this. You could track every agent in the battle and their attacks and guess wheter they hit player agents shield and then guess the damage done.  But this is at best guesstimation , and hell of a lot of work.

Unless there will be agent_get_shield_hit_points / agent_set_Shield_hit_points  or something similiar in the future patches, i think you are out of luck here.

Maybe try to desccribe effect you are wishing to archieve, often loopholes and indirect ways of archieving them are easier.
 
Oh true ti_agent_on_hit doesn't fire too....ahh well I will live without it.

EDIT:But I did find out that agent_deliver_damage_to_agent does cause the trigger to fire...but doesn't store the weapons id (I guess because it isn't really a weapon.) I wonder if I could use that hm.... Anyway thanks for your guys help it has helped me quite alot :razz:
 
Hey guys, Ive been thinking about dual wielding for pistols ...
One of the pistols would be a normal weapon and the second one would act as a shield. New animation would take care of the rest...

Now I have some questions :
- Is there a way to prevent a unit from blocking with the one which acts as shield ? Blocking animation would ruin the whole thing...
- Is there a way to spawn 2 bullets from slightly different places upon firing on gun ? Or is there some other way to create two bullets ?
- Is there a way to connect this new animation to only one kind of unit?
 
Silver Wolf said:
Hey guys, Ive been thinking about dual wielding for pistols ...
One of the pistols would be a normal weapon and the second one would act as a shield. New animation would take care of the rest...

Now I have some questions :
- Is there a way to prevent a unit from blocking with the one which acts as shield ? Blocking animation would ruin the whole thing...
- Is there a way to spawn 2 bullets from slightly different places upon firing on gun ? Or is there some other way to create two bullets ?
- Is there a way to connect this new animation to only one kind of unit?

1. Yes, but I can't remember how at the moment.
2. Sadly no. You could use a scene prop for the extra bullet, move it along the line of fire and check where it hits. There are other approaches as well.

3.You can restrict it to agents with that item (that seems like it would be the most flexible). I'd suggest checking if the block button was pressed, and if they had that item equipped, omit the button press, force the animation, and fire the bullet.
 
Hi,

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? I tried in a mission templates trigger:
Code:
(try_for_range, ":item_no", all_items_begin, all_items_end),
		(scene_spawned_item_get_num_instances, ":num_spawned_inst", ":item_no"),
		(scene_item_get_num_instances, ":num_inst", ":item_no"),
		(this_or_next|gt, ":num_inst", 0),
		(gt, ":num_spawned_inst", 0),
		(display_message,"@found item with num_inst > 0"),
(try_end),
but the message was never displayed so I guess it's not a scene item or scene spawned item.
 
Griffith_ said:
Hi,
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? I tried in a mission templates trigger:
...
but the message was never displayed so I guess it's not a scene item or scene spawned item.
scene items are those placed in edit mode, while scene spawned items are those dropped or created via spawn_item. You could test for collision with ti_on_missile_hit, but there's no way to manipulate corpses (although you can get rid of blood and stuck projectiles with agent_equip_item (reequiping their armor) before they die).

mr.master said:
Weapon type specific death sounds. Is this possible? D: If someone knows, please, do sure your wisdom.
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),
       (eq, ":item", "itm_foo"),
       (agent_play_sound, ":inflicted_agent", "snd_bar"),
    (try_end),
    #or fetch sound from item slot, etc.
]),
 
Status
Not open for further replies.
Back
Top Bottom