Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Bertanx said:
Bertanx said:
Me again, I have added some custom items to the game, however they don't show up in the "cheatmenu", how can I add them also to there?
Anyone?
Your problem is too simple and uninteresting. :smile:
If you look at the code, you'll see that the menu "cheat_find_item" works till "itm_items_end". This code is easy to find, just look for the in-game menu text "Find an item...".
So anything you add must be before that item AND you need to rebuild the module system, so the menu code constants will update.
 
MadVader said:
Bertanx said:
Bertanx said:
Me again, I have added some custom items to the game, however they don't show up in the "cheatmenu", how can I add them also to there?
Anyone?
Your problem is too simple and uninteresting. :smile:
If you look at the code, you'll see that the menu "cheat_find_item" works till "itm_items_end". This code is easy to find, just look for the in-game menu text "Find an item...".
So anything you add must be before that item AND you need to rebuild the module system, so the menu code constants will update.

lol Thanks. I actually checked the item with Morgh's Editor, and its order was 602, and the order of "itm_items_end" was 603. So it is before that code. :???:
 
when i installed map manager and did everything with instruction - there is error, like this
2a4f05c0b99f.png
[/spoile
 
Read this and give yourself full control over the Modules folder and all its subfolders (where the mods are placed):
http://www.addictivetips.com/windows-tips/windows-7-access-denied-permission-ownership/
Or ask someone who knows how to use Windows to do it for you.
 
cmpxchg8b said:
No scene, it's made up by the engine on the fly. You can't change lighting settings.

I actually think it's the "meeting_scene_plain". Not that I can change the lighting there though. At least I wouldn't know how ^^
 
Code:
finnish1 = (0, 0, 8, 
        [
	       (multiplayer_is_server),
           (multiplayer_get_my_player,":player_no"),
           (player_get_troop_id, ":player_troop", ":player_no"),
           (is_between, ":player_troop", "trp_finnish_rifleman_multiplayer", "trp_russian_rifleman_multiplayer"),
           (key_clicked, key_numpad_1),
        ],
        [
			(store_trigger_param_1, ":agent_id"),
			#(multiplayer_send_int_to_server,multiplayer_event_sound_at_player, "snd_kylla"),
			(multiplayer_get_my_player,":player_no"),
			(agent_get_player_id, ":agent_id", ":player_no"),
			(player_is_active,":player_no"),
			(player_get_agent_id, ":agent_id", ":player_no"), # Now we get the players agent id. We store it in cur_agent. cur agent being Current agent.
			(call_script, "script_agent_play_sound", ":agent_id", "snd_kylla"),
        ])
No errors, but neither does it work. Any help?
 
ehm... I would do it like this:
Code:
finnish1 = (0, 0, 8, 
        [
	       (multiplayer_is_server),
           (key_clicked, key_numpad_1),
        ],
        [
	   (multiplayer_get_my_player,":player_no"),
	   (player_is_active,":player_no"),
           (player_get_troop_id, ":player_troop", ":player_no"),
           (is_between, ":player_troop", "trp_finnish_rifleman_multiplayer", "trp_russian_rifleman_multiplayer"),
	   (player_get_agent_id, ":agent_id", ":player_no"), # Now we get the players agent id. We store it in cur_agent. cur agent being Current agent.
	   (call_script, "script_agent_play_sound", ":agent_id", "snd_kylla"),
        ])

Cause I don't think the (store_trigger_param_1, ....) thing works when there is not really a trigger, but I could be wrong of course ^^.
And the (agent_get_player_id, ...., ....) had the parameters the wrong way around.
 
cmpxchg8b said:
Still wrong, you can't check if a key is clicked or get the player id on the server (unless it's a listen server and you're the hosting player, but I doubt that's what you want).
Exactly. Right now, the priority is to get it to work on dedicated server. How would I do the check?
 
mr.master said:
cmpxchg8b said:
Still wrong, you can't check if a key is clicked or get the player id on the server (unless it's a listen server and you're the hosting player, but I doubt that's what you want).
Exactly. Right now, the priority is to get it to work on dedicated server. How would I do the check?

You need to do the key press detection on the client side, send a message to the server and then send a message to all players. For general events that is. I heard (read) someone say that you can use (agent_play_sound, ":sound"), and it will automatically get synchronized between all players, but I haven't tested this myself yet.
 
Poison script I've been working on. (borrowing animation from a dismemberment mod) It works except that it doesn't go away like it's supposed to.
The slots 'poisoned' and 'poison_wear_off' become the same value and I don't know why.

All of the code goes into mission_templates:
poison1 = (
    ti_on_agent_spawn, 0, 0, [],
    [
        (store_trigger_param_1,":victim"),
(agent_set_slot,":victim",agent_poisoned,0),
(agent_set_slot,":victim",agent_poison_damage,0),
(agent_set_slot,":victim",agent_poison_wear_off,0),       
        ])

poison2 = (
    ti_on_agent_hit, 0, 0, [],
    [
        (store_trigger_param_1,":victim"),
        (store_trigger_param_2,":attacker"),
        (assign, ":attacker_item", reg0),
        (agent_get_team, ":enemy_team", ":attacker"),
        (agent_get_team, ":team", ":victim"),
        (neq,":team", ":enemy_team"),
        (is_between, ":attacker_item", "itm_assassin_bow_weakest", "itm_assassin_archer_basic_armor"),
##        (store_random_in_range, ":poison_timing", 2, 3),
##        (agent_set_slot,":victim",agent_poisoned,":poison_timing"),
        (agent_set_slot,":victim",agent_poisoned,3),
       
        (store_random_in_range, ":poison_wear_off", 12, 15),
        (agent_set_slot,":victim",agent_poison_wear_off,":poison_wear_off"),
        (agent_get_slot, ":poison_damage", ":victim", agent_poison_damage),
        (val_add, ":poison_damage", 3),
        (val_max, ":poison_damage", 12),
        (agent_set_slot,":victim",agent_poison_damage,":poison_damage"),   
        ])

poison3 = (

0.25, 0, 0, [],
[
  (try_for_agents, ":cur_agent"),
      (agent_is_human, ":cur_agent"),
      (agent_is_alive, ":cur_agent"),
 
        (agent_get_slot, ":poisoned", ":cur_agent", agent_poisoned),
      (agent_get_slot, ":poison_duration", ":cur_agent", agent_poison_wear_off), 

  (try_begin),
  (gt, ":poison_duration", 0),
    (val_sub, ":poisoned", 1),
    (agent_set_slot,":cur_agent",agent_poisoned,":poisoned"), 
    (val_sub, ":poison_duration", 1),
    (agent_set_slot,":cur_agent",agent_poison_wear_off,":poison_duration"), 
  (else_try),
        (agent_set_slot,":cur_agent",agent_poisoned,0),
        (agent_set_slot,":cur_agent",agent_poison_wear_off,0),
        (agent_set_slot,":cur_agent",agent_poison_damage,0), 
  (try_end),


  (gt, ":poison_duration", 0),
 
    (assign, reg1, ":poison_duration"),
      (display_message, "@poison_wear_off: {reg1}"),
    (assign, reg2, ":poisoned"),
      (display_message, "@poison_timer: {reg2}"),

      (try_begin),   
      (eq, ":poisoned", 1), 
      #begin to damage troop
      (store_agent_hit_points, ":hp", ":cur_agent", 0), #percent
      (agent_get_slot, ":poison_damage", ":cur_agent", agent_poison_damage), 
      (val_sub, ":hp", ":poison_damage"),
      (agent_set_hit_points, ":cur_agent", ":hp", 0), #again, 0 param = relative 
 
      (try_begin),
      (lt, ":hp", 2),
      (agent_deliver_damage_to_agent,":cur_agent",":cur_agent"),
      (try_end),
         
      (agent_get_position, pos1, ":cur_agent"),
      (position_move_z, pos1, 85), #makes the blood higher, otherwise it's on ground level
        (position_move_x, pos1, -32), #makes the blood out from the torso towards the arm stump
        (position_move_y, pos1, 16), #makes the blood come out severed stump
        (position_rotate_x, pos1, -70), #makes the blood spurt downwards
        (particle_system_burst, "psys_game_blood_2", pos1, 80), #100 as power.
 
          (store_random_in_range, ":poison_timing", 4, 6),
        (agent_set_slot,":cur_agent",agent_poisoned,":poison_timing"),   
          (display_message, "@poison deals damage"), 
 
      (agent_get_horse, ":horse", ":cur_agent"),
      (eq, ":horse", -1), #No horse.
      (agent_set_animation, ":cur_agent", "anim_handchop"),

  (try_end),
  (try_end), 
 
  ])

animation
  ["handchop", 0, amf_priority_striked|amf_play,
  [1.5, "strikes", 55, 71, arf_blend_in_3],
],

Here's a testing item to poison yourself with:
["poison_self", "TEST_Poison_Self", [("throwing_stone",0)], itp_type_thrown|itp_no_pick_up_from_ground |itp_primary ,itcf_throw_stone, 1 , weight(4)|difficulty(0)|spd_rtng(97) | shoot_speed(30) | thrust_damage(11 ,  blunt)|max_ammo(15)|weapon_length(:cool:,imodbit_large_bag,
  [(ti_on_missile_hit,
    [

(store_trigger_param_1,":victim"),
##        (store_random_in_range, ":poison_timing", 2, 3),
##        (agent_set_slot,":victim",agent_poisoned,":poison_timing"),
        (agent_set_slot,":victim",agent_poisoned,3),                       
        (store_random_in_range, ":poison_wear_off", 12, 15),
        (agent_set_slot,":victim",agent_poison_wear_off,":poison_wear_off"),
        (agent_get_slot, ":poison_damage", ":victim", agent_poison_damage),
        (val_add, ":poison_damage", 3),
        (val_max, ":poison_damage", 12),
        (agent_set_slot,":victim",agent_poison_damage,":poison_damage"),
        ],)]],
 
Status
Not open for further replies.
Back
Top Bottom