killed entity reward, have code, need to convert to a function

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

ililedie

New Member
Feb 19, 2021
7
0
1
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
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%}
 
Status
Not open for further replies.