I have a system that displays upto 3 quotes at one time. If a 4th appears, then it'll push the top quote off the screen so there's never any more than 3.
Although the following works for me, there's most certainly a better and more efficient way:
// QUOTE VARS
gamevar NEWQUOTE -1 0 // This holds a quote number to be played through gametext.
gamevar QUOTEPAL 0 0 // This colours the quotes through gametext based on who owns the quote. I.E: if an enemy caused a critical hit then it'll be colourd red. If the player or a firend caused it, then blue.
gamevar QUOTEPAL1 0 0
gamevar QUOTEPAL2 0 0
gamevar QUOTEPAL3 0 0
gamevar QUOTEPAL4 0 0
gamevar SLOTTIME1 0 0 // This is the duration time of quotes on screen. However, the quotes can only be removed through slot 1.
gamevar SLOTTIME2 0 0
gamevar SLOTTIME3 0 0
gamevar SLOTTIME4 0 0
gamevar QUOTESLOT1 -1 0 // These slots indicate whether a quote is currently occupying a line on screen. If so then the quote will take place on the following slot.
gamevar QUOTESLOT2 -1 0
gamevar QUOTESLOT3 -1 0
gamevar QUOTESLOT4 -1 0
gamevar QUOTE1Y 0 0 // These y possitions are used for a nice roll off effect instead of the quote just jumping to the next slot.
gamevar QUOTE2Y 0 0
gamevar QUOTE3Y 0 0
gamevar QUOTE4Y 0 0
gamevar ORIEN 26 0 // Orientation for the slot 1 (as it'll have to take on transparrentcey when time is up)
gamevar QSHADE 0 0 // Simple really - this holds the shade of the quotes.
gamevar QSHADE2 0 0 // This keeps track of how much shade has been applied. When enough has been done, it'll lighten the quotes then repeat.
onevent EVENT_DISPLAYREST
ifvarg QUOTESLOT1 -1 // There's meant to be a quote on screen.
{
gametext 2822 320 QUOTE1Y QUOTESLOT1 QSHADE QUOTEPAL1 ORIEN 0 0 1920 1080
}
ifvarg QUOTESLOT2 -1
{
gametext 2822 320 QUOTE2Y QUOTESLOT2 QSHADE QUOTEPAL2 26 0 0 1920 1080
ifvare QUOTESLOT1 -1 // The slot above this one is now empty.
{
setvarvar QUOTESLOT1 QUOTESLOT2
setvarvar QUOTEPAL1 QUOTEPAL2
setvarvar SLOTTIME1 SLOTTIME2
setvarvar QUOTE1Y QUOTE2Y
setvar QUOTESLOT2 -1
setvar SLOTTIME2 0
}
}
ifvarg QUOTESLOT3 -1
{
gametext 2822 320 QUOTE3Y QUOTESLOT3 QSHADE QUOTEPAL3 26 0 0 1920 1080
ifvare QUOTESLOT2 -1 // The slot above this one is now empty.
{
setvarvar QUOTESLOT2 QUOTESLOT3
setvarvar QUOTEPAL2 QUOTEPAL3
setvarvar SLOTTIME2 SLOTTIME3
setvarvar QUOTE2Y QUOTE3Y
setvar QUOTESLOT3 -1
setvar SLOTTIME3 0
}
}
ifvarg QUOTESLOT4 -1
{
gametext 2822 320 QUOTE4Y QUOTESLOT4 QSHADE QUOTEPAL4 26 0 0 1920 1080
ifvare QUOTESLOT3 -1 // The slot above this one is now empty.
{
setvarvar QUOTESLOT3 QUOTESLOT4
setvarvar QUOTEPAL3 QUOTEPAL4
setvarvar SLOTTIME3 SLOTTIME4
setvarvar QUOTE3Y QUOTE4Y
setvar QUOTESLOT4 -1
setvar SLOTTIME4 0
}
}
ifvarg NEWQUOTE -1 // We have a new addition to the quote list.
{
ifvare QUOTESLOT1 -1 { setvarvar QUOTESLOT1 NEWQUOTE setvarvar QUOTEPAL1 QUOTEPAL } // The first slot is empty so lets take it!
else
ifvarn QUOTESLOT1 13
{
ifvare QUOTESLOT2 -1 { setvarvar QUOTESLOT2 NEWQUOTE setvarvar QUOTEPAL2 QUOTEPAL setvar QUOTE2Y 8 }
else
ifvarn QUOTESLOT2 13
{
ifvare QUOTESLOT3 -1 { setvarvar QUOTESLOT3 NEWQUOTE setvarvar QUOTEPAL3 QUOTEPAL setvar QUOTE3Y 16 }
else
ifvarn QUOTESLOT3 13 { setvarvar QUOTESLOT4 NEWQUOTE setvarvar QUOTEPAL4 QUOTEPAL setvar QUOTE4Y 28 setvar QUOTESLOT1 -1 setvar SLOTTIME1 0 }
}
}
setvar NEWQUOTE -1
}
endevent
The following should be placed in the Player actor code (so the timings are fixed). Look for the line "actor APLAYER MAXPLAYERHEALTH PSTAND 0 0" and then find the line direclty under that, which should read: "ifaction 0 action PSTAND"
modify that so it reads:
ifaction 0
{
setplayer[THISACTOR].fta -1 setplayer[THISACTOR].ftq -1 // Prevents the "auto aiming" quote from being displayed at map start up.
action PSTAND
}
Now place the following under that:
// Moving quotes to the new quote system.
getplayer[THISACTOR].ftq TEMP ifvarg TEMP -1 { setvarvar NEWQUOTE TEMP setvar QUOTEPAL 0 setplayer[THISACTOR].ftq -1 }
getplayer[THISACTOR].fta TEMP ifvarg TEMP -1 setplayer[THISACTOR].fta -1
// The counter.
ifvarg QUOTESLOT1 -1 // There's at least 1 quote on screen.
{
ifvare QSHADE 0 setvar QSHADE2 0 else ifvare QSHADE 9 setvar QSHADE2 1
ifvare QSHADE2 1 subvar QSHADE 1 else addvar QSHADE 1
ifvarg QUOTE1Y 0 subvar QUOTE1Y 1
else
ifvarn QUOTESLOT1 13
{
ifvare SLOTTIME1 124 { setvar SLOTTIME1 0 setvar QUOTESLOT1 -1 setvar ORIEN 26 }
else
ifvare SLOTTIME1 122 setvar ORIEN 59
else
ifvare SLOTTIME1 120 setvar ORIEN 27
ifvarl SLOTTIME1 124 addvar SLOTTIME1 1
}
}
ifvarg QUOTESLOT2 -1 { ifvarg QUOTE2Y 8 subvar QUOTE2Y 1 ifvarl SLOTTIME2 120 addvar SLOTTIME2 1 }
ifvarg QUOTESLOT3 -1 { ifvarg QUOTE3Y 16 subvar QUOTE3Y 1 ifvarl SLOTTIME3 120 addvar SLOTTIME3 1 }
ifvarg QUOTESLOT4 -1 { ifvarl SLOTTIME4 120 addvar SLOTTIME3 4 }
I hope I haven't missed anything.
Quotes can be displayed normally with the quote command or by directly setting "NEWQUOTE" to the quote number to be played. Also at the same time, setting QUOTEPAL to a palette number will change the pal of the text. Also no more quotes will be displayed once "press space to restart level" appears.