- 151
- Posts
- 6
- Years
- Seen Feb 4, 2020
Hey guys,
I've been working on Marin's easy quest script and added some nice modifications. I think the weakness of his systemeven though it is amazing) is that each quest doesn't have an intern progression system. So, I transformed the descriptions in goals and added a variable linked to these goals, so that when one of the goals is accomplished it changes color in the in game description of the quest. Also I added that when all goals are achieved the quest is completed without the need to call the usual function to switch complete to true.
I want to improve this more but first I would like to change the variables goal1, goal2... into one array goal and do the same for goal1done, goal2done variables. What would it take to do so?
here is how it looks now after my changes
and this what I added
I've been working on Marin's easy quest script and added some nice modifications. I think the weakness of his systemeven though it is amazing) is that each quest doesn't have an intern progression system. So, I transformed the descriptions in goals and added a variable linked to these goals, so that when one of the goals is accomplished it changes color in the in game description of the quest. Also I added that when all goals are achieved the quest is completed without the need to call the usual function to switch complete to true.
I want to improve this more but first I would like to change the variables goal1, goal2... into one array goal and do the same for goal1done, goal2done variables. What would it take to do so?
here is how it looks now after my changes
Code:
class Quest
attr_accessor :id
attr_accessor :name
attr_accessor :goal1
attr_accessor :goal1done
attr_accessor :goal2
attr_accessor :goal2done
attr_accessor :goal3
attr_accessor :goal3done
attr_accessor :goal4
attr_accessor :goal4done
attr_accessor :npc
attr_accessor :sprite
attr_accessor :location
attr_accessor :color
attr_accessor :time
attr_accessor :completed
def initialize(id, name,goal1,goal1done,goal2,goal2done,goal3,goal3done,goal4,goal4done, npc, sprite, location, color = :WHITE, time = Time.now, completed = false)
self.id = id
self.name = name
self.goal1 = goal1
self.goal1done = goal1done
self.goal2 = goal2
self.goal2done = goal2done
self.goal3 = goal3
self.goal3done = goal3done
self.goal4 = goal4
self.goal4done = goal4done
self.npc = npc
self.sprite = sprite
self.location = location
self.color = pbColor(color)
self.time = time
self.completed = completed
end
end
Code:
def pbSetGoal(id,goalnum,value)
$Trainer.quests = [] if $Trainer.quests.class == NilClass
for q in $Trainer.quests
q.goal1done = value if goalnum ==1 && q.id == id
q.goal2done = value if goalnum ==2 && q.id == id
q.goal3done = value if goalnum ==3 && q.id == id
q.goal4done = value if goalnum ==4 && q.id == id
end
for q in $Trainer.quests
q.completed = true if q.id == id && q.goal1done==true&&q.goal2done==true&&q.goal3done==true&&q.goal4done==true
end
end