There's no simple way to do it for any map... But these general steps should help you. Also, this tutorial is written assuming you know basic JASS, and are capable of making your own triggers through JASS.
1) Identify and list things you can do that will grant you exp. Make sure to also record messages that are displayed at this time (annotate where colour changes occur, the colour itself isn't important)
2) Open the .j file for the map and search the messages you recorded.
NOTE: Only search for a section that's between two colour changes. Colour changes are done by "|cffRRGGBB" or "|r", so unless you know exactly what was used for it, your search will fail.
3) You should end up with a function that is sorta like this:
Code: Select all
function somefunc takes something returns probably nothing
local player p = GetTriggerPlayer() // If not specified in the function parameters
local integer i = GetPlayerId(p) // As above
set exp_array[i] = exp_array[i] + 5
call DisplayTextToPlayer(p, 0, 0, "Earned 5 experience.")
endfunction
IF: The function takes a player and an amount to increase by, create a trigger like this:
Code: Select all
function yourfunc takes nothing returns nothing
local player p = GetTriggerPlayer()
local integer i = GetPlayerId(p)
local string s = GetEventPlayerChatString()
local integer exp = SubString(s,4,8) // Assuming exp goes from 0-9999
call somefunc(p,exp) // Should be function name of the one you found, use proper parameters
endfunction
function main takes nothing returns nothing
//locals
local integer i2i = 0
local trigger t2t = CreateTrigger()
loop
exitwhen i2i > 11
call TriggerRegisterPlayerChatEvent(t2t,Player(i2i),"-exp ", false)
set i2i=i2i+1
endloop
call TriggerAddAction(t2t, function yourfunc)
OTHERWISE: Create a similar function as what I made above, but change this line:
call somefunc(p,exp)
To:
set exp_array
=exp_array+exp
Obviously replacing exp_array with whatever the name of the array in the map would be.
Some maps require a function to be called that will generate and display your code. You should add a call to that in your function after changing your experience, as well as (if that function doesn't) displaying your code to you.
Hopefully this post helps you. If you need any clarification or help (aside from doing the entire thing for you) then just ask.