Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Well that's mighty bizarre...seemed the perfect operation.

Two other ideas--from someone not versed in multiplayer coding--to take with a grain of salt.
--Check the values of the following player slots by looping through them.
Code:
slot_player_selected_item_indices_begin        = 2
slot_player_selected_item_indices_end          = 11
slot_player_cur_selected_item_indices_begin    = slot_player_selected_item_indices_end
slot_player_cur_selected_item_indices_end      = slot_player_selected_item_indices_end + 9
I'm not sure if the cur_selected_item slots hold the item IDs of what is equipped...?

--Another, sloppier, idea would be to cycle through all of the troop's inventory capacity, checking if the player agent has the given item equipped.
Code:
        (player_get_troop_id, ":troop_no", <player_id>),
        (player_get_agent_id, ":agent_no", <player_id>),
        (troop_get_inventory_capacity, ":end_cond", ":troop_no"), 
        (try_for_range, ":i_slot", 0, ":end_cond"),
          (troop_get_inventory_slot, ":item_id", ":troop_no", ":i_slot"),
          (gt, ":item_id", -1),
          (agent_has_item_equipped, ":agent_no", ":item_id"),
...but I'm not sure if all available items in multiplayer get dropped into the troop's inventory or exactly where they come from. If they aren't dropped there, then this second suggestion is nonsensical and you have my apologies.
 
I don't think they get dropped into the troops inventory, Just as well, I if it did, I don't think it would work with weapons picked up in-scene.

Edit: these slots...
Code:
slot_player_selected_item_indices_begin        = 2
slot_player_selected_item_indices_end          = 11
slot_player_cur_selected_item_indices_begin    = slot_player_selected_item_indices_end
slot_player_cur_selected_item_indices_end      = slot_player_selected_item_indices_end + 9

seem to hold the item's in them (the one's that the player select in the menu's that is). I'll report back after further experimenting.
 
Caba`drin said:
MadocComadrin said:
Is there any way to get all of the items an agent has currently equipped? (I need to tell if an agent/player (multiplayer) has more of one type of item and if they have a weapon space free)

Might a server-side bit of code using
player_get_item_id                  = 422 # (player_get_item_id, <destination>, <player_id>, <item_slot_no>) #only for server

embedded in a try_for_range loop going through the ek_item_0 to ek_head (for weapons) or ek_food (for all equipped things) work?
I thought so too, a while back; but it's not quite what it seems. That operation only returns what is in the equip list for the next spawn (added with player_add_spawn_item), and a bug report / suggestion on the tracker to fix or expand it was rejected... I was able to figure out a horribly complicated hacky workaround, eventually; but don't bother with that, just wait for the next version - second time lucky, you could say :grin:.
 
I've got a question that seems really simple, but I still can't figure it out. How do I add more things to the admin panel without cutting off the things on the bottom?

Edit: Never mind. :razz:

And to make this post not completely useless...

Knight of the Rose said:
Gonna repeat my question from a few pages back..

Any information about making a night map for online multiplayer play ?
Use the scene_set_day_time command in ti_before_mission_start in mission_templates.py.
 
Hmm. How can one add a custom running animation for a certan weapon? Since I need to do many, I have one animation ready to be tested but Im not sure how to appoint it to a certain weapon. I'm a bit lost with this. Basically, I need to add bunch of animations to a weapon. Reloading, readying, releasing, running with it, shooting, idle and I'm not really sure how to do it. I can do the animation side but adding it right to the module system is the problem and appointing them to the gun.
 
mr.master said:
Hmm. How can one add a custom running animation for a certan weapon? Since I need to do many, I have one animation ready to be tested but Im not sure how to appoint it to a certain weapon. I'm a bit lost with this. Basically, I need to add bunch of animations to a weapon. Reloading, readying, releasing, running with it, shooting, idle and I'm not really sure how to do it. I can do the animation side but adding it right to the module system is the problem and appointing them to the gun.
Well, you can't do much with the running/standing animation. Both of those are based entirely on the item type, and you can't make new ones. But you can still overwrite them in module_animations.py.

For reloading, you have access to itp_reload_musket and itp_reload_pistol, as well as the crossbow reload, but you can only use that if the item is set as a crossbow.

For shooting (readying/releasing), you have many more options. Since you can use all the throwing animations, you have access to itcf_throw_stone, throw_knife, throw_axe, and throw_javelin, as well as the shooting ones: shoot_bow, shoot_crossbow, shoot_pistol, and shoot_musket. Just pick the ones you don't think you'll need in their default form and overwrite their animations with your own in module_animations.py, and add the itcf or itp property to your item.
 
Shredzorz said:
Knight of the Rose said:
Gonna repeat my question from a few pages back..

Any information about making a night map for online multiplayer play ?
Use the scene_set_day_time command in ti_before_mission_start in mission_templates.py.

But wont that only show me for in multiplayer?  How can I make a map nighttime for everyone on the server?
 
Shredzorz said:
mr.master said:
Hmm. How can one add a custom running animation for a certan weapon? Since I need to do many, I have one animation ready to be tested but Im not sure how to appoint it to a certain weapon. I'm a bit lost with this. Basically, I need to add bunch of animations to a weapon. Reloading, readying, releasing, running with it, shooting, idle and I'm not really sure how to do it. I can do the animation side but adding it right to the module system is the problem and appointing them to the gun.
Well, you can't do much with the running/standing animation. Both of those are based entirely on the item type, and you can't make new ones. But you can still overwrite them in module_animations.py.

For reloading, you have access to itp_reload_musket and itp_reload_pistol, as well as the crossbow reload, but you can only use that if the item is set as a crossbow.

For shooting (readying/releasing), you have many more options. Since you can use all the throwing animations, you have access to itcf_throw_stone, throw_knife, throw_axe, and throw_javelin, as well as the shooting ones: shoot_bow, shoot_crossbow, shoot_pistol, and shoot_musket. Just pick the ones you don't think you'll need in their default form and overwrite their animations with your own in module_animations.py, and add the itcf or itp property to your item.
So it's not possible to change how one runs with a certain weapon or how the player holds it? Since I'm talking about pretty many guns here. :/ And so it's not possible to add many different shooting animations for different guns?
 
mr.master said:
Shredzorz said:
mr.master said:
Hmm. How can one add a custom running animation for a certan weapon? Since I need to do many, I have one animation ready to be tested but Im not sure how to appoint it to a certain weapon. I'm a bit lost with this. Basically, I need to add bunch of animations to a weapon. Reloading, readying, releasing, running with it, shooting, idle and I'm not really sure how to do it. I can do the animation side but adding it right to the module system is the problem and appointing them to the gun.
Well, you can't do much with the running/standing animation. Both of those are based entirely on the item type, and you can't make new ones. But you can still overwrite them in module_animations.py.

For reloading, you have access to itp_reload_musket and itp_reload_pistol, as well as the crossbow reload, but you can only use that if the item is set as a crossbow.

For shooting (readying/releasing), you have many more options. Since you can use all the throwing animations, you have access to itcf_throw_stone, throw_knife, throw_axe, and throw_javelin, as well as the shooting ones: shoot_bow, shoot_crossbow, shoot_pistol, and shoot_musket. Just pick the ones you don't think you'll need in their default form and overwrite their animations with your own in module_animations.py, and add the itcf or itp property to your item.
So it's not possible to change how one runs with a certain weapon or how the player holds it? Since I'm talking about pretty many guns here. :/ And so it's not possible to add many different shooting animations for different guns?
The walking/standing animation is based only on the item type, and between itp_type_musket, itp_type_pistol, and itp_type_crossbow, the crossbow is the only one with its own unique animation (I think).

The shooting animations are the easy part. You can use all the ones I listed in my other post by overwriting their animations and adding the itp to your item.
 
Oh well, I try those then. Hopefully they would make a better system for implenting own animations. Replacing existing ones like this aint the best way imo. Still, better than nothing :smile:
 
Use agent_get_wielded_weapon in conjunction with agent_set_stand_animation and agent_set_walk_forward_animation. The stand animation should work (it's used for guards in towns, nobles in their halls, etc.) but then again none of those agents have items wielded. Try to see if it overrides the weapon-specific animations.
 
i have a big problem. when i try to use my module system i get this problem:http://img121.imageshack.us/img121/4428/bugox.png
please help!
 
Shredzorz said:
mr.master said:
Shredzorz said:
mr.master said:
Hmm. How can one add a custom running animation for a certan weapon? Since I need to do many, I have one animation ready to be tested but Im not sure how to appoint it to a certain weapon. I'm a bit lost with this. Basically, I need to add bunch of animations to a weapon. Reloading, readying, releasing, running with it, shooting, idle and I'm not really sure how to do it. I can do the animation side but adding it right to the module system is the problem and appointing them to the gun.
Well, you can't do much with the running/standing animation. Both of those are based entirely on the item type, and you can't make new ones. But you can still overwrite them in module_animations.py.

For reloading, you have access to itp_reload_musket and itp_reload_pistol, as well as the crossbow reload, but you can only use that if the item is set as a crossbow.

For shooting (readying/releasing), you have many more options. Since you can use all the throwing animations, you have access to itcf_throw_stone, throw_knife, throw_axe, and throw_javelin, as well as the shooting ones: shoot_bow, shoot_crossbow, shoot_pistol, and shoot_musket. Just pick the ones you don't think you'll need in their default form and overwrite their animations with your own in module_animations.py, and add the itcf or itp property to your item.
So it's not possible to change how one runs with a certain weapon or how the player holds it? Since I'm talking about pretty many guns here. :/ And so it's not possible to add many different shooting animations for different guns?
The walking/standing animation is based only on the item type, and between itp_type_musket, itp_type_pistol, and itp_type_crossbow, the crossbow is the only one with its own unique animation (I think).

The shooting animations are the easy part. You can use all the ones I listed in my other post by overwriting their animations and adding the itp to your item.
Still one question. Where does it define what animations does itp_crossbow use? I tried searching but didn't find.
 
thelight9 said:
i have a big problem. when i try to use my module system i get this problem:http://img121.imageshack.us/img121/4428/bugox.png
please help!

Check out this Sticky: How to fix "Python not recognized...".
This is also addressed Module System Documentation sub-board and in jik's Tutorial.


Time for a question of my own.
Has anyone had success using the following:
(team_set_order_listener, <team_no>, <sub_class>, <value>), #merge with old listeners if value is non-zero #clear listeners if sub_class is less than zero

EDIT: When I attempt to use it, even when leaving off the <value> parameter, or using it as 0 or putting a negative value there (not noted as a workable option, but something I've tried) it always seems to merge with previous listeners, rather than re-setting who is listening to the orders. Does it work as intended?

But rather than just the class that I've set with (team_set_order_listener), previously selected classes are passing the (class_is_listening_order) test. Do these functions not work together as they should? Am I missing something?

Thanks for any input.


I found an error in my code. This function works as described/intended. Apologies.

My discovery: if you have a script that is called repeatedly (from a loop) the local variables within this script are NOT reset with every call due to the quick succession of the script calls. One must initialize them at the beginning of the script so they are re-set with every call.

I had anticipated that, as local variables, they wouldn't linger beyond the end of the script run, but it appears they do. No shortcuts around initializing them at 0, it seems.
 
I would like to know how to use this op: (replace_scene_props, <old_scene_prop_id>,<new_scene_prop_id>),
Does it affect all props of a type or just the instance?

I would like to use it for the autofire mod to remove the bullet props so that the game isn't searching through the inactive ones.
 
Status
Not open for further replies.
Back
Top Bottom