Legacy GM Text, NPC Dialogue.

J

JesterLuciferDeath

Guest
Tell me if this is right, because I get this:


Objects / Characters / char_unknowngirl / Create / Code

image_speed = .2
global.text = false

Objects / Characters / char_unknowngirl / Step / Code

if ( distance_to_object ( char_unknowngirl ) < 4 ) {
if
(keyboard_check_pressed (vk_space) && global.text = false)
instance_create ( x , y , obj_cryngshdetxt )
}

Objects / Objects / obj_cryngshdetxt / Create / Code


text1 = string ("I.... I'm sorry lord...")
text2 = string ("I... I couldn't protect my little lamb..")
text3 = string ("I... I.. I thought he was safe..")
text4 = string ("(You attempt to get her attention, even yelling..)")
text5 = string ("(....She seems to not notice you...?)")

talk = 0

global.text = true


out = string ("")
spd = 0

Objects / Objects / obj_cryngshdetxt / Step / Code

if ( distance_to_object ( obj_cryngshdetxt ) < 4 ) {
image_index = 1;
}
else
{

image_index = 0;
}
depth = -y;

if talk = 1 {
out = string_copy (text1, 1, spd);
}

if talk = 2 {
out = string_copy (text2, 1, spd);
}

if talk = 3 {
out = string_copy (text3, 1, spd);
}

if talk = 4 {
out = string_copy (text4, 1, spd);
}

if talk = 5 {
out = string_copy (text5, 1, spd);
}

spd += 0.25

if ( keyboard_check_pressed ) ( vk_space ) ){
talk += 1;
spd = 0;
}

if ( talk > 5 ) {
instance_destroy();
}

Objects / Objects / obj_cryngshdetxt / Draw / Code

draw_set_font(font);
draw_set_valign(fa_top);
draw_set_halign(fa_left);

if ( talk = 1 ) {
draw_sprite
(obj_cryngshdetxt, 0, view_xview[0], view_yview[0]+240);
draw_set_color(c_white)
draw_text (view_xview[0], view_yview[0]+240-75, out);
}

if ( talk = 2 ) {
draw_sprite
(obj_cryngshdetxt, 0, view_xview[0], view_yview[0]+240);
draw_set_color(c_white)
draw_text (view_xview[0], view_yview[0]+240-75, out);
}

if ( talk = 3 ) {
draw_sprite
(obj_cryngshdetxt, 2, view_xview[0], view_yview[0]+240);
draw_set_color(c_red)
draw_text (view_xview[0], view_yview[0]+240-75, out);
}

if ( talk = 4 ) {
draw_sprite
(obj_cryngshdetxt, 3, view_xview[0], view_yview[0]+240);
draw_set_color(c_white)
draw_text (view_xview[0], view_yview[0]+240-75, out);
}

if ( talk = 5 ) {
draw_sprite
(obj_cryngshdetxt, 4, view_xview[0], view_yview[0]+240);
draw_set_color(c_white)
draw_text (view_xview[0], view_yview[0]+240-75, out);
}
 
Last edited by a moderator:

Yal

šŸ§ *penguin noises*
GMC Elder
Shameless plug: totally recommending my YaruNPCEngine, it has both textboxes and menus that should be plug-and-play.

I'd really recommend that you use arrays instead of 5 separate variables, it'd make you able to shorten down the code a bit and let you extend conversations much easier without having to duplicate code in three different events...
Try using show_debug_message() to print out the text you're trying to draw each step, that will tell you if the issue is the text itself or the drawing of it.
 
J

JesterLuciferDeath

Guest
Shameless plug: totally recommending my YaruNPCEngine, it has both textboxes and menus that should be plug-and-play.

I'd really recommend that you use arrays instead of 5 separate variables, it'd make you able to shorten down the code a bit and let you extend conversations much easier without having to duplicate code in three different events...
Try using show_debug_message() to print out the text you're trying to draw each step, that will tell you if the issue is the text itself or the drawing of it.
I'll try it out, thanks for the tip.
 
J

JesterLuciferDeath

Guest
Shameless plug: totally recommending my YaruNPCEngine, it has both textboxes and menus that should be plug-and-play.

I'd really recommend that you use arrays instead of 5 separate variables, it'd make you able to shorten down the code a bit and let you extend conversations much easier without having to duplicate code in three different events...
Try using show_debug_message() to print out the text you're trying to draw each step, that will tell you if the issue is the text itself or the drawing of it.
Would you kindly show an array example for dialogue?
 
Top