Quest events
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
[ext_resource type="Script" uid="uid://b41umpbgqfuc2" path="res://scripts/Event/Item/EventGetItem.gd" id="10_avybc"]
|
[ext_resource type="Script" uid="uid://b41umpbgqfuc2" path="res://scripts/Event/Item/EventGetItem.gd" id="10_avybc"]
|
||||||
[ext_resource type="Script" uid="uid://0ygswaohp7kj" path="res://scripts/Event/EventFlagModify.gd" id="12_ncdgy"]
|
[ext_resource type="Script" uid="uid://0ygswaohp7kj" path="res://scripts/Event/EventFlagModify.gd" id="12_ncdgy"]
|
||||||
[ext_resource type="Script" uid="uid://ccujhcc446mvh" path="res://scripts/Event/Condition/EventIfFlag.gd" id="13_60ixl"]
|
[ext_resource type="Script" uid="uid://ccujhcc446mvh" path="res://scripts/Event/Condition/EventIfFlag.gd" id="13_60ixl"]
|
||||||
[ext_resource type="Script" uid="uid://baywtxo4wy5i4" path="res://scripts/Event/Trigger/EventQuestObjectiveComplete.gd" id="14_i48p6"]
|
[ext_resource type="Script" uid="uid://cvrib7pjlip8g" path="res://scripts/Event/Condition/EventIfQuestObjective.gd" id="14_i48p6"]
|
||||||
|
|
||||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_e1h75"]
|
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_e1h75"]
|
||||||
sky_horizon_color = Color(0.59625, 0.6135, 0.6375, 1)
|
sky_horizon_color = Color(0.59625, 0.6135, 0.6375, 1)
|
||||||
@@ -142,10 +142,11 @@ event = 1
|
|||||||
eventFlag = 1
|
eventFlag = 1
|
||||||
metadata/_custom_type_script = "uid://0ygswaohp7kj"
|
metadata/_custom_type_script = "uid://0ygswaohp7kj"
|
||||||
|
|
||||||
[node name="EventGroup" type="Node" parent="Events"]
|
[node name="EventQuestAllObjectivesComplete" type="Node" parent="Events"]
|
||||||
script = ExtResource("14_i48p6")
|
script = ExtResource("14_i48p6")
|
||||||
|
metadata/_custom_type_script = "uid://cvrib7pjlip8g"
|
||||||
|
|
||||||
[node name="TextTest" type="Node" parent="Events/EventGroup"]
|
[node name="TextTest" type="Node" parent="Events/EventQuestAllObjectivesComplete"]
|
||||||
script = ExtResource("6_gxq5o")
|
script = ExtResource("6_gxq5o")
|
||||||
text = "testestest
|
text = "testestest
|
||||||
"
|
"
|
||||||
|
70
scripts/Event/Condition/EventIfQuestObjective.gd
Normal file
70
scripts/Event/Condition/EventIfQuestObjective.gd
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
class_name EventIfQuestObjective extends "res://scripts/Event/Condition/EventIf.gd"
|
||||||
|
|
||||||
|
enum Type {
|
||||||
|
ANY_OF_OBJECTIVES_COMPLETED,
|
||||||
|
ALL_OF_OBJECTIVES_COMPLETED,
|
||||||
|
ANY_OF_OBJECTIVES_NOT_COMPLETED,
|
||||||
|
ALL_OF_OBJECTIVES_NOT_COMPLETED,
|
||||||
|
SPECIFIC_OBJECTIVE_COMPLETED,
|
||||||
|
SPECIFIC_OBJECTIVE_NOT_COMPLETED,
|
||||||
|
}
|
||||||
|
|
||||||
|
@export var questKey:QuestSystem.QuestKey = QuestSystem.QuestKey.TEST_QUEST
|
||||||
|
@export var type:Type = Type.ALL_OF_OBJECTIVES_COMPLETED
|
||||||
|
@export var objective:int = 0
|
||||||
|
@export var triggerMultipleTimes: bool = false
|
||||||
|
|
||||||
|
func _enter_tree() -> void:
|
||||||
|
QUEST.questUpdated.connect(onQuestUpdated)
|
||||||
|
|
||||||
|
func _exit_tree() -> void:
|
||||||
|
QUEST.questUpdated.disconnect(onQuestUpdated)
|
||||||
|
|
||||||
|
func onQuestUpdated(quest:Quest) -> void:
|
||||||
|
if self.ended:
|
||||||
|
if !self.triggerMultipleTimes:
|
||||||
|
return
|
||||||
|
self.reset()
|
||||||
|
|
||||||
|
if quest.questKey != self.questKey:
|
||||||
|
return
|
||||||
|
|
||||||
|
if !quest.isStarted():
|
||||||
|
return
|
||||||
|
|
||||||
|
match type:
|
||||||
|
Type.ANY_OF_OBJECTIVES_COMPLETED:
|
||||||
|
for objective in quest.objecitves:
|
||||||
|
if !objective.isCompleted():
|
||||||
|
continue
|
||||||
|
self.start()
|
||||||
|
return
|
||||||
|
|
||||||
|
Type.ALL_OF_OBJECTIVES_COMPLETED:
|
||||||
|
for objective in quest.objectives:
|
||||||
|
if !objective.isCompleted():
|
||||||
|
return
|
||||||
|
self.start()
|
||||||
|
|
||||||
|
Type.ANY_OF_OBJECTIVES_NOT_COMPLETED:
|
||||||
|
for objective in quest.objectives:
|
||||||
|
if objective.isCompleted():
|
||||||
|
continue
|
||||||
|
self.start()
|
||||||
|
return
|
||||||
|
|
||||||
|
Type.ALL_OF_OBJECTIVES_NOT_COMPLETED:
|
||||||
|
for objective in quest.objectives:
|
||||||
|
if objective.isCompleted():
|
||||||
|
return
|
||||||
|
self.start()
|
||||||
|
|
||||||
|
Type.SPECIFIC_OBJECTIVE_COMPLETED:
|
||||||
|
if quest.objectives[objective].isCompleted():
|
||||||
|
self.start()
|
||||||
|
return
|
||||||
|
|
||||||
|
Type.SPECIFIC_OBJECTIVE_NOT_COMPLETED:
|
||||||
|
if quest.objectives[objective].isCompleted():
|
||||||
|
return
|
||||||
|
self.start()
|
1
scripts/Event/Condition/EventIfQuestObjective.gd.uid
Normal file
1
scripts/Event/Condition/EventIfQuestObjective.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cvrib7pjlip8g
|
@@ -48,11 +48,6 @@ func start() -> void:
|
|||||||
textboxEvent.count = quantity
|
textboxEvent.count = quantity
|
||||||
conversationEvent.addChildEvent(textboxEvent)
|
conversationEvent.addChildEvent(textboxEvent)
|
||||||
|
|
||||||
conversationEvent.eventEnded.connect(func():
|
|
||||||
# Reward the item
|
|
||||||
rewardItem()
|
|
||||||
)
|
|
||||||
|
|
||||||
# Begin processing
|
# Begin processing
|
||||||
super.start()
|
super.start()
|
||||||
startChild(conversationEvent)
|
startChild(conversationEvent)
|
||||||
@@ -69,6 +64,7 @@ func isDone() -> bool:
|
|||||||
return conversationEvent.isDone()
|
return conversationEvent.isDone()
|
||||||
|
|
||||||
func end() -> void:
|
func end() -> void:
|
||||||
|
rewardItem()
|
||||||
if removeNode:
|
if removeNode:
|
||||||
var parent = removeNode.get_parent()
|
var parent = removeNode.get_parent()
|
||||||
if parent:
|
if parent:
|
||||||
|
28
scripts/Event/Trigger/EventQuestAllObjectivesComplete.gd
Normal file
28
scripts/Event/Trigger/EventQuestAllObjectivesComplete.gd
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
class_name EventQuestAllObjectivesComplete extends "res://scripts/Event/Flow/EventGroup.gd"
|
||||||
|
|
||||||
|
@export var questKey:QuestSystem.QuestKey = QuestSystem.QuestKey.TEST_QUEST
|
||||||
|
@export var triggerMultipleTimes: bool = false
|
||||||
|
|
||||||
|
func _enter_tree() -> void:
|
||||||
|
QUEST.questUpdated.connect(onQuestUpdated)
|
||||||
|
|
||||||
|
func _exit_tree() -> void:
|
||||||
|
QUEST.questUpdated.disconnect(onQuestUpdated)
|
||||||
|
|
||||||
|
func onQuestUpdated(quest:Quest) -> void:
|
||||||
|
if self.ended:
|
||||||
|
if !self.triggerMultipleTimes:
|
||||||
|
return
|
||||||
|
self.reset()
|
||||||
|
|
||||||
|
if quest.questKey != self.questKey:
|
||||||
|
return
|
||||||
|
|
||||||
|
if !quest.isStarted():
|
||||||
|
return
|
||||||
|
|
||||||
|
for objective in quest.objectives:
|
||||||
|
if !objective.isCompleted():
|
||||||
|
return
|
||||||
|
|
||||||
|
self.start()
|
@@ -0,0 +1 @@
|
|||||||
|
uid://ck0vs0awnc4n2
|
@@ -4,15 +4,11 @@ class_name EventQuestObjectiveComplete extends "res://scripts/Event/Flow/EventGr
|
|||||||
@export var quest:QuestSystem.QuestKey = QuestSystem.QuestKey.TEST_QUEST
|
@export var quest:QuestSystem.QuestKey = QuestSystem.QuestKey.TEST_QUEST
|
||||||
@export var objectiveIndex:int = 0
|
@export var objectiveIndex:int = 0
|
||||||
|
|
||||||
var hasTriggered:bool = false
|
|
||||||
|
|
||||||
func _enter_tree() -> void:
|
func _enter_tree() -> void:
|
||||||
QUEST.questUpdated.connect(onQuestUpdated)
|
QUEST.questUpdated.connect(onQuestUpdated)
|
||||||
pass
|
|
||||||
|
|
||||||
func _exit_tree() -> void:
|
func _exit_tree() -> void:
|
||||||
QUEST.questUpdated.disconnect(onQuestUpdated)
|
QUEST.questUpdated.disconnect(onQuestUpdated)
|
||||||
pass
|
|
||||||
|
|
||||||
func onQuestUpdated(quest:Quest) -> void:
|
func onQuestUpdated(quest:Quest) -> void:
|
||||||
if self.ended:
|
if self.ended:
|
||||||
@@ -25,7 +21,4 @@ func onQuestUpdated(quest:Quest) -> void:
|
|||||||
|
|
||||||
if !quest.objectives[objectiveIndex].isCompleted():
|
if !quest.objectives[objectiveIndex].isCompleted():
|
||||||
return
|
return
|
||||||
|
|
||||||
print("onObjectiveCompleted: %s" % quest.questKey)
|
|
||||||
self.start()
|
self.start()
|
||||||
pass
|
|
Reference in New Issue
Block a user