Change the amount of experience recieved from battles

Users who are viewing this thread

t11

Veteran
I tried searching the forum for it but "changing battle experience" is way to broad to get concise results. :razz:

How do I change the experience received from battles for both players and NPC troops (at least in my game they are non-playable lol)?
 
Code:
(ti_on_agent_killed_or_wounded, 0, 0, [],
  [
    (store_trigger_param_1, ":agent"),
    (agent_is_human, ":agent"),
    (store_trigger_param_2, ":killer"),
    (agent_get_troop_id, ":killer", ":killer"),
    (troop_is_hero, ":killer"),
    (agent_get_troop_id, ":troop", ":agent"),
    (store_character_level, ":level", ":troop"),
    (add_xp_to_troop, ":level", ":killer"),
  ])
Stick this into any mission template and any hero should gain additional xp equal to the xp of the agent he/she just killed.
 
Well I tried throwing this into common_battle_tab_press in module_mission_templates.py. Got an error when trying to build the scripts coming from the addition. Did I put in a bad place? I'm pretty new to this so I wouldn't doubt it.

Code:
common_battle_tab_press = (
  ti_tab_pressed, 0, 0, [],
  [
    (try_begin),
      (eq, "$g_battle_won", 1),
      (call_script, "script_count_mission_casualties_from_agents"),
      (finish_mission,0),
    (else_try),
      (call_script, "script_cf_check_enemies_nearby"),
      (question_box,"str_do_you_want_to_retreat"),
    (else_try),
      (display_message,"str_can_not_retreat"),
    (try_end),
    ]
  ti_on_agent_killed_or_wounded, 0, 0, [],  
  [    
	(store_trigger_param_1, ":agent"),    
    (agent_is_human, ":agent"),    
    (store_trigger_param_2, ":killer"),    
    (agent_get_troop_id, ":killer", ":killer"),    
    (troop_is_hero, ":killer"),    
    (agent_get_troop_id, ":troop", ":agent"),    
    (store_character_level, ":level", ":troop"),    
    (add_xp_to_troop, ":level", ":killer"),
	]	
	)

EDIT: I got it. I wasn't supposed to put it where I did. :razz: I put in a battle teplate and still got some errors. I was wondering what was wrong so I looked at other blocks that were similar and realised I was missing a comma giving me a syntax error. lol. Thank you so much for that code block!
 
t11 said:
Well I tried throwing this into common_battle_tab_press in module_mission_templates.py. Got an error when trying to build the scripts coming from the addition. Did I put in a bad place? I'm pretty new to this so I wouldn't doubt it.

Code:
      (display_message,"str_can_not_retreat"),
    (try_end),
    ],
  ti_on_agent_killed_or_wounded, 0, 0, [],

Im pretty rusty, but I think there should be a comma where I've put one. ie. after the closing ']'.
 
Hatonastick said:
t11 said:
Well I tried throwing this into common_battle_tab_press in module_mission_templates.py. Got an error when trying to build the scripts coming from the addition. Did I put in a bad place? I'm pretty new to this so I wouldn't doubt it.

Code:
      (display_message,"str_can_not_retreat"),
    (try_end),
    ],
  ti_on_agent_killed_or_wounded, 0, 0, [],  

	)

Im pretty rusty, but I think there should be a comma where I've put one.

I'll try that too. Thank you!
Hmm... I wonder if it's better to put it here since tab press is used in every battle situation.
 
Just ignore the ')' at the end of my post that somehow ended up in my quote (I edited my post just after your reply I think).  Not sure how that happened. :smile:

Your question would be best answered by Somebody, so I'll leave it to him.
 
Back
Top Bottom