I think I have a final draft for my script now, it seems to do all I need it to do.
Basically, you move up to the character, press E and get a text panel and activates a flag, you press E to close the panel and when you press E again it detects the flag and displays the next text panel, activates a different flag and deactivates the first flag.
By changing/adding/deleting the flags in the script I can manipulate it to move back and forth between different characters and they will all have a default unflagged conversation panel before and after you read their flagged conversation panels.
function chatty_init(e) -- CHANGE "CHATTY" TO THE NAME OF YOUR SCRIPT
textbox_pressed = 0
talking = 0
end
function chaty_main(e) -- CHANGE "CHATTY" TO THE NAME OF YOUR SCRIPT
PlayerDist = GetPlayerDistance(e)
-- THIS WILL BE THE SECOND CONVERSATION
if flag_first_finished == 1 then -- CHANGE "FIRST" TO WHATEVER YOU WANT YOUR FLAG TO BE CALLED
if PlayerDist < 150 then
if talking == 0 then
Prompt ( "Press E to talk" )
else
Prompt ( "Press E to stop talking" )
end
if GetInKey() == "e" and textbox_pressed == 0 then
if talking == 1 then
talking = 0
else
talking = 1
end
textbox_pressed = 1
end
if talking == 1 then
Panel(20,85,80,95)
Panel(20,15,80,85)
TextColor(25,20,1,"Hello again!",0,255,255)
TextColor(25,28,1,"If you come back later i will revert back to the first conversation",0,255,0)
TextColor(25,32,1,"...",0,255,0)
TextColor(25,36,1,"...",0,255,0)
TextColor(25,44,1,"...",0,255,255)
TextCenterOnXColor(50,87,4,"CONVERSATION RESET",255,0,0)
flag_second_finished = 1 -- CHANGE "SECOND" TO WHATEVER YOU WANT YOUR FLAG TO BE CALLED
flag_first_finished = 0 -- CHANGE "FIRST" TO WHATEVER YOU WANT YOUR FLAG TO BE CALLED
end
end
else
-- THIS WILL BE THE FIRST CONVERSATION,
if PlayerDist < 150 then
if talking == 0 then
Prompt ( "Press E to talk" )
else
Prompt ( "Press E to stop talking" )
end
if GetInKey() == "e" and textbox_pressed == 0 then
if talking == 1 then
talking = 0
else
talking = 1
end
textbox_pressed = 1
end
if talking == 1 then
Panel(20,85,80,95)
Panel(20,15,80,85)
TextColor(25,20,1,"Lucy: Hello!.",0,255,0)
TextColor(25,24,1,"Come back later for the second conversation",0,255,0)
TextColor(25,32,1,"...",0,255,255)
TextColor(25,40,1,"...",0,255,0)
TextColor(25,48,1,"...",0,255,255)
TextColor(25,56,1,"...",0,255,0)
TextCenterOnXColor(50,87,4,"COME BACK LATER.",255,0,0)
flag_first_finished = 1 -- CHANGE "FIRST" TO WHATEVER YOU WANT YOUR FLAG TO BE CALLED
end
end
end
if GetInKey() == "" then
textbox_pressed = 0
end
end
and because it uses flags you can use it to activate/use other entities by just putting the code in the main part of the items scrip inside an if flag command as below:
if flag_XX_finished == 1 then -- WHERE XX IS THE NAME OF THE FLAG
end
Here's how it looks in a winzone script:
-- LUA Script - precede every function and global member with lowercase name of script
function winzone2_flag_init(e)
end
function winzone2_flag_main(e)
if flag_winzone_finished == 1 then
if g_Entity[e]['plrinzone']==1 then
JumpToLevelIfUsed(e)
end
end
end
If the winsome flag is 0 then the winzone script will do nothing, effectively being hidden, if the flag is 1 then it will operate as a normal winzone.