mirror of
https://github.com/HarmonyHoney/ROTA.git
synced 2026-07-17 16:46:17 +00:00
ChatTree.gd! change NPC dialogue if expression is true (=
This commit is contained in:
parent
5ef4a36c5f
commit
c1a619a5b0
3 changed files with 54 additions and 3 deletions
43
src/actor/ChatTree.gd
Normal file
43
src/actor/ChatTree.gd
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
extends Node
|
||||
|
||||
onready var expression := Expression.new()
|
||||
export (String, MULTILINE) var expression_string := "false"
|
||||
|
||||
export (String) var erase := ""
|
||||
export (int, "Off", "On", "Swap", "Push Front", "Push Back") var is_lines := 0
|
||||
export (Array, String, MULTILINE) var lines := ["Lovely weather!"]
|
||||
export var is_greeting := false
|
||||
export var greeting := -1
|
||||
export var is_queue := false
|
||||
export (String, MULTILINE) var queue_write := ""
|
||||
|
||||
func _ready():
|
||||
var error = expression.parse(expression_string, [])
|
||||
if error != OK:
|
||||
print(expression.get_error_text())
|
||||
return
|
||||
var result = expression.execute([], Shared)
|
||||
if !expression.has_execute_failed() and result:
|
||||
var p = get_parent()
|
||||
if erase != "":
|
||||
var e = erase.split_floats(",", false)
|
||||
e.sort()
|
||||
e.invert()
|
||||
for i in e:
|
||||
p.lines.remove(int(i))
|
||||
|
||||
if is_lines > 0:
|
||||
if is_lines == 1:
|
||||
p.lines = lines
|
||||
elif is_lines == 2:
|
||||
for i in lines.size():
|
||||
p.lines[i] = lines[i]
|
||||
elif is_lines > 2:
|
||||
p.lines = (lines + p.lines) if is_lines == 3 else (p.lines + lines)
|
||||
|
||||
if is_greeting:
|
||||
p.greeting = greeting
|
||||
|
||||
if is_queue:
|
||||
p.queue_write = queue_write
|
||||
|
||||
|
|
@ -271,8 +271,6 @@ func _physics_process(delta):
|
|||
|
||||
if is_input and !MenuPause.is_paused and !Cutscene.is_playing and !Wipe.is_wipe:
|
||||
joy_last = joy
|
||||
# joy = Input.get_vector("left", "right", "up", "down")
|
||||
# joy = Vector2(sign(joy.x), sign(joy.y))
|
||||
joy.x = round(Input.get_axis("left", "right"))
|
||||
joy.y = round(Input.get_axis("up", "down"))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
[gd_scene load_steps=16 format=2]
|
||||
[gd_scene load_steps=17 format=2]
|
||||
|
||||
[ext_resource path="res://src/actor/door/DoorBig.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://src/stage/SolidTileMap.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://src/detail/Tree.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://src/detail/FlowerPetals.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://src/actor/ChatTree.gd" type="Script" id=5]
|
||||
[ext_resource path="res://src/detail/Bench.tscn" type="PackedScene" id=6]
|
||||
[ext_resource path="res://src/actor/door/DoorLittle.tscn" type="PackedScene" id=7]
|
||||
[ext_resource path="res://src/detail/Flower.tscn" type="PackedScene" id=8]
|
||||
|
|
@ -90,6 +91,15 @@ dye = {
|
|||
is_npc = true
|
||||
lines = [ "Lovely weather!", "I do adore the flowers", "Hello (=", "Are you a gem collector?", "I saw something shiny through that door..", "I flipped over this rock and found a gem! 0=" ]
|
||||
|
||||
[node name="Chat" type="Node" parent="Actors/NPC"]
|
||||
script = ExtResource( 5 )
|
||||
expression_string = "\"2A/0_hub\" in maps_visited"
|
||||
erase = "0,1,2"
|
||||
is_lines = 3
|
||||
lines = [ "You have been to the snow! (-=" ]
|
||||
is_greeting = true
|
||||
greeting = 0
|
||||
|
||||
[node name="NPC2" parent="Actors" instance=ExtResource( 16 )]
|
||||
position = Vector2( 1350, 1360 )
|
||||
__meta__ = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue