This what I have done for the cults ccc.
This is a scripted system that is for the purpose of representing cultists praying. The priest/leader says something and the cultists respond, repeat ad nauseum. Here is what it looks like in game -
The priest hasn’t detected the PC
The priests OnPerceive detects the PC and the system starts up
The cultists go to knees in order to pray.
Even black shows up
What’s different about this? It is entirely data driven. Say what? None (zero, zilch) of the data is stored in the script system itself. In other words you don’t need any programming/scripting knowledge/experience in order to use or re-purpose it. How’s that work? There are just 4 local variables stored on the leader/priest and a custom 2da. This is the current 2da -
2DA V2.0 Who What How Colour 0000 1 "Ek' masu-kov Mortus" 10 700 0001 1 "S'hai1e t' wuh tevik" 10 070 0002 1 "Ik nam-tor wuh tevik?" 10 007 0003 0 "Etek nam-tor wuh tevik" 4 770 0004 1 "Ik nam-tor wuh tevik?" 10 707 0005 0 "Ek' nam-tor tevik" 4 077 0006 1 "Du nam-tor wuh dying" 10 777 0007 0 "Ek' nam-tor tevik" 4 000 0008 1 "Vi' wuh brag" 10 730 0009 0 "Ek' nam-tor tevik" 4 444 0010 1 "Vi' wuh so1ektra" 10 572 0011 0 "Ek' nam-tor tevik" 4 674 0012 1 "Yem-tukh na' worms" 10 333 0013 0 "Ek' nam-tor tevik" 4 375 0014 1 "Du nam-tor grazhiv" 10 637 0015 0 "Ek' nam-tor tevik" 4 174 0016 1 "Du nam-tor rai weht" 10 714 0017 0 "Ek' nam-tor tevik" 4 346 0018 1 "Ek' masu-kov Mortus" 10 740 0019 0 "Ek' masu-kov Mortus" 4 551 0020 1 "S'haile t' wuh tevik" 10 147
Here is an explanation of what the columns actually mean/do.
- Who - Determines who actually speaks (1 is the leader and 0 for the mob)
- What - This is the string that will be spoken
- How - This is the number of the animation (only use those that have LOOPING in their name) to play while they are speaking (found in the lexicon under Reference/Constants/Animation)
- Colour - Determines the colour of the spoken text. Must only contain the digits 0 to 7 and there must be exactly 3 of them. These represent (from left to right) the colour channels for red, green and blue. This gives a total of 512 (if you include black) different colours available to use.
Doing it this way means that you can have as many or few lines of text spoken as you want without having to alter the script at all.
A little explanation on setting this up. Note this already done in the demo. For the purposes of the demonstration I have used the leader’s OnPerceive event so that when they perceive the PC the code sequence starts. You can of course change this if you want. However, the code as written expects to be attached to the leader through one of its events. Changing that would involve quite a bit of re-writing. You can call the cultist what ever you want but they must all have the same tag. For the leader the name and tag are unimportant. Use whatever npcs you want (but alter their faction so that they are all neutral to each other and the PC (hint on the first build of this I didn’t - first the mob killed the leader and then went after the PC…)).
So that brings us to those 4 local variables on the leader. What are they called and what are they there for.
- iDoTurn - (int) At the start of the sequence the mob all turn and face the leader. If necessary this behaviour can be turned off. This variable is used to do that. 0 = off, 1 = on.
- fInterval01 - (float) This determines how long to play each animation and the gap between each line of text being spoken. In the demo it is set to 6.0f for six seconds e.g. a round.
- sTagToLookFor01 - (string) This is the tag that all the cultists are expected to have. This allows for you to change the tag that the script looks for.
- s2daFile01 - (string) The name of the 2da file (without the “.2da” bit) to use.
sTagToLookFor01 and s2daFile01 means that it is possible to have 2 or more competing cults in the same area saying different things to one another as long as you have 2 different leaders.
One thing I forgot to mention. While there must always be a leader for this to function, you can have as many or as few cultists who worship around the leader. The only restriction is that they must be within 10 metres of the leader. This 10 metres doesn’t pass through walls however.
Last words (for now). This system is expandable with a bit of extra coding and it doesn’t have to be used for its original purpose. Just set up the 2da for your own purpose (Essential that you use the same column names though). Could be used for a strike with a strike leader (What do we want?", “Gruel!”, “When do we want it?” “Now!”) or a continuing conversation between just 2 people (“And he said [whisper]”, “No, Really?”), or even two people exchanging jokes. I’m sure you’ve got your own ideas.
Anyway, what do you think.