You do it with events, not through this script. This script just graphically represents that quest.
You would set up the quest in the script like this:
when 7 # Quest 7 - this ID doesn't need to be 7, but it has to be unique
q[:name] = "Animal Trouble in Lynis"
q[:level] = 1
q[:icon_index] = 333
q[:description] = "Wolves are attacking the town of Lynis. The mayor has put a bounty on their heads."
q[:objectives][0] = "Speak to Mayor Trakia."
q[:objectives][1] = "Kill 5 Wolves. \\v[4] / 5"
q[:objectives][2] = "Return their pelts to Mayor Trakia."
q[:client] = "Mayor Trakia"
q[:location] = "Black Forest"
q[:rewards] = [
[:gold, 500],
]
As a sample, you would then set up the actual quest through events. In this example, I am using the pelt count as a proxy for wolves killed, meaning every wolf would need to have a 100% drop rate for pelts. However, that is not totally necessary. You could do it simply by kills, but you would need to set up counting events in every troop that has wolves (if you are doing random encounters). If you are not doing random encounters, you would just need to count the wolves in the troop inside the event in which the battle is called. Anyway, the following event does it by pelt count.
So first, you hear a rumour about the wolf troubles. That event would look like this:
@>Text: Hey, you might not want to go to Lynis. I hear there are wolves attacking that town every night!
@>Script: reveal_objective(7, 0)
7 is the quest ID I chose at the very top of the event I setup - "when 7". It has to be unique so that you can identify it when you are modifying objective status. That reveals the "Talk to Mayor Trakia" objective.
Then in Lynis, there would be this Mayor Trakia event:
Page 1: No conditions
@>Text: Please help us! We are being attacked by wolves! I will give you 500 Gold if you kill five of them.
@>Show Choices: OK!, No thanks!
: When OK!
@>Text: Oh thank you so much! Bring me five pelts for your reward.
@>Script: complete_objective(7,0)
reveal_objective(7, 1, 2)
@>Control Switches: Switch 34 is ON
Page 2: Condition: Switch 34 is ON
@>Conditional Branch: Variable 4 >= 5
@>Text: Oh, you have the pelts! That is wonderful news! Here is your reward
@>Change Gold: +500
@>Change Items: -5 Wolf Pelts
@>Script: complete_objective(7,2)
@> quest(7).objectives[1] = "Kill 5 Wolves 5/5"
@>Control Switch: Switch 34 = OFF
@>Control Self-Switch: A = ON
: Else
@>Text: Please return when you have killed the savage beasts!
@>Branch End
Page 3, Condition: Self-Switch A is ON
@>Text: Thank you for your earlier assistance.
Switch 34 and Variable 4 were randomly chosen IDs. Again they can be any ID, as long as you are consistent. I chose variable 4 actually when setting up the quest, as I set that to be the pelt count.
Now all that is left is counting the wolves killed. This can be done with a parallel process common event like this:
Common Event, Trigger: Parallel Process, Switch Condition: Switch 34
@>Variable Operation: [004: Pelt Count] = [Wolf Pelt] is present
@>Conditional Branch: Variable [004: Pelt Count] >= 5
@>Variable Operation: [004: Pelt Count] = 5
@>Script: complete_objective(7, 1)
: Else
@>Conditional Branch: Script: objective_complete?(7, 1)
@>Script: uncomplete_objective(7, 1)
: Branch END
: Branch END
@>Wait: 6 frames
That's all very messy, but I am sure you can adapt it to your needs.