have this code that I made by myself but I don't want to repeat so many lines for each type of entity, tried to transform the code into a function but... I suffer from serious skill issue. Can someone give me sample code from this? I need to have as "variables" the random amount of money ex. (random number from 1 and 4) and the type of entity ex. (pig), so that I can call the function on an entity death event like
the code I did is this, working obviously
Code:
on death:
if victim is a pig:
function reward(pig, 1 and 4)
the code I did is this, working obviously
Code:
on death:
if victim is a pig:
if damage was caused by void:
if {author::%victim%} is set:
set {_1} to a random number between 1 and 4
add {_1} to balance of "%{author::%victim%}%" parsed as player
send "%{_1}%" to "%{author::%victim%}%" parsed as player
clear {author::%victim%}