
Tic Tac Toe Script - A Walkthrough
This walkthrough explains how you can create a fully scripted Tic Tac Toe game board for your mod. This is the same one that is featured in my Cyrodiil Training Center mod.
The scripts are hereby released as a modders resource. If you do use my scripts, I would not mind being credited.
{The scripts are all the way at the bottom for those who do not want to read the rest of the walkthrough}
First thing you will want to do is set up your game board. You will need some kind of base for the board and two different colored squares to use for the nine spaces. You should make sure to use static objects for best results. I used the PalacePedestal01 found in Static: Architecture: Palace: Interior for my base. The squares that I used were a part of the DC CURP. They were the CUOmarbleblock01 and the CUOmarbleblock02 found under Static: Architecture: CyrodiilUpgradeOverhaul: ColouredMarbleBlocks. If you don’t want to use those, you can use any other object that has a square top part and that comes in two or more color varieties. Set up 5 squares of one color and 4 of the other as shown in the picture below. Note that you may have to adjust the scale of the objects. I had to reduce the marble blocks to 04% of their original size so they would be the right size. The exact size is subjective so go with whatever looks best to you.

The next thing you want to do is create 9 activators that look like the squares you placed. In the left side of the Object Window, under WorldObjects click on the word Activator. Then in the right side, right click on any of the objects listed and select New. In the ID field of the window that pops up, enter tbeGameActivator1 or any other unique name with the number 1 added to the end. In the name field, enter Place your piece here or whatever text you want the player to see. The next part is somewhat trickier. Click the button called Add NIF File. Now what you need to do is find the same mesh (.nif) that is used by the squares you placed earlier. Specifically, the squares you placed in the corners and in the center. In the case of the Marble blocks that I used, they can be found under Architecture\ CyrodiilUpgradeOverhaul\ ColouredMarbleBlocks\ MRCmarbleblock01.nif. Note that the data folder structure is the same as is shown in the CS Object Window. If you know what folder your object is filed under in the Object Window, its mesh will be in the corresponding folder on your hard drive. The window should look something like this:

You don’t need to select a sound unless you want a sound played whenever a piece is played. Click OK to finish. You will need to repeat this once more but this time use the other square and name it tbeGameActivator2 . Now go and find the activators that you just created in the right side of the Object Window. Once you have found them, right click on the first one which is number 1. Right click on it and select edit. Change the number at the end of the ID to 3. Repeat this to create activators number 5, 7, and 9. Then right click on activator number 2 and create activators 4, 6, and 8 the same way. After this, the list in the Object window should look something like this:

Now place all nine activators in order on top of your regular blocks in the render window as shown in the next picture. You will want to make sure to scale down the objects to match the ones you originally placed. Also make sure that x and y coordinates match up but leave the activators floating directly above the static squares for now. Double check that the activators are all in order.

After that, double click on each of the activators in turn and in the Reference Editor ID field enter the name of the base object and add Ref to the end so it looks like tbeGameActivator1Ref. Before clicking OK, place a check in the Persistent Reference checkbox near the bottom of the box.
The next thing to do is double click on each of the static squares (not the activators that you just placed) and select the Enable Parent tab. Push the Select Reference In Render Window button and double click on the activator that is directly above it. Make sure the Set Enable State to Opposite of Parent option is checked. Finally click OK and repeat with the next block. What we just did is set it up so that while the Activator is enabled, the corresponding static block will be disabled but it will be enabled whenever the activator is disabled.

Next you will want to pick your game pieces. You will want to find two different static objects to use and place nine copies of each above your squares as shown in the next picture.

You need to decide which set of objects will be the player’s pieces and which will be the AI’s pieces. You will want to double click on each of the pieces in turn and in the Reference Editor ID field enter tbeGameAI1Ref or tbeGamePlayer1Ref and change the number to correspond to the specific piece being named. Use the same numbering sequence as before. Also make sure to enable the options Persistent Reference and Initially Disabled.
Now you can finally lower everything into place so that it looks something like the following picture.

There are three more details that we need to take care of before starting on scripting. The first is a reset switch. For that, I used an Ayleid wall switch which happened to fit with the architecture I was using. You can use any activator that you want to though. What you need to do is find one that you like and edit it. Give it a new ID such as tbeGameResetSwitch and change the Name to Reset Game. Place it somewhere where the player will be able to press it easily. Preferably next to or very close to your game board.
You will also want another activator that will indicate to the player that it is his turn. I used the TG11ActivatorHourglass01, changed the ID to tbeGameTurnToggle and the name to It’s your turn. Make sure to deselect the script by selecting “ NONE”. Place the activator somewhere where the player will see it easily. Double click it and set the Reference ID to tbeGameTurnToggleRef and check the option to make it a persistent reference.
The final activator will hold the main script. It can be any random activator since the player will not be seeing it anyways. Just pick an activator to edit, give it a custom ID, and place it under the floor where the players will not be able to see it.
Now you can relax and get a drink or something because the hard part is over. Now on to scripting.
First things first. Save your changes to your mod. The CS can be very picky with scripts at times and often will not work unless you save your changes first.
Open the script window and create a new script. Copy the following code and replace the three ‘#’s with ‘1’s. Save the script and create 8 more scripts using the numbers 2 through 9.
Code:
scriptname tbeGameActivator#Script
BEGIN OnActivate
if (IsActionRef Player == 1)
if (TbeGameTurnToggleRef.GetDisabled == 0)
tbeGamePlayer#Ref.enable
tbeGameTurnToggleRef.disable
tbeGameActivator#Ref.disable
else
Message "Please wait until your turn" 3
endif
endif
END
Now on to the last script. Create a new script, copy the following code, save the script, and save your mod.
Code:
scriptname tbeGameAIScript
short AITurn
short EndGame
float timer
BEGIN gamemode
; A timer to delay the AI playing for added realism
; The GameTurnToggleRef is automatically disabled everytime the player plays a piece.
if (tbeGameTurnToggleRef.GetDisabled == 1 && AITurn == 0)
set AITurn to 1
set timer to 2
endif
if (timer > 0)
set timer to timer - GetSecondsPassed
endif
if (timer <= 0 && AITurn == 1)
; Perform a check for each of the 24 conditions where the AI is one move away from winning. (Two in a row)
if (tbeGameAI1Ref.GetDisabled == 0 && tbeGameAI2Ref.GetDisabled == 0 && tbeGameActivator3Ref.GetDisabled == 0)
tbeGameAI3Ref.enable
tbeGameActivator3Ref.disable
elseif (tbeGameAI3Ref.GetDisabled == 0 && tbeGameAI2Ref.GetDisabled == 0 && tbeGameActivator1Ref.GetDisabled == 0)
tbeGameAI1Ref.enable
tbeGameActivator1Ref.disable
elseif (tbeGameAI3Ref.GetDisabled == 0 && tbeGameAI1Ref.GetDisabled == 0 && tbeGameActivator2Ref.GetDisabled == 0)
tbeGameAI2Ref.enable
tbeGameActivator2Ref.disable
elseif (tbeGameAI4Ref.GetDisabled == 0 && tbeGameAI5Ref.GetDisabled == 0 && tbeGameActivator6Ref.GetDisabled == 0)
tbeGameAI6Ref.enable
tbeGameActivator6Ref.disable
elseif (tbeGameAI6Ref.GetDisabled == 0 && tbeGameAI5Ref.GetDisabled == 0 && tbeGameActivator4Ref.GetDisabled == 0)
tbeGameAI4Ref.enable
tbeGameActivator4Ref.disable
elseif (tbeGameAI6Ref.GetDisabled == 0 && tbeGameAI4Ref.GetDisabled == 0 && tbeGameActivator5Ref.GetDisabled == 0)
tbeGameAI5Ref.enable
tbeGameActivator5Ref.disable
elseif (tbeGameAI7Ref.GetDisabled == 0 && tbeGameAI8Ref.GetDisabled == 0 && tbeGameActivator9Ref.GetDisabled == 0)
tbeGameAI9Ref.enable
tbeGameActivator9Ref.disable
elseif (tbeGameAI9Ref.GetDisabled == 0 && tbeGameAI8Ref.GetDisabled == 0 && tbeGameActivator7Ref.GetDisabled == 0)
tbeGameAI7Ref.enable
tbeGameActivator7Ref.disable
elseif (tbeGameAI9Ref.GetDisabled == 0 && tbeGameAI7Ref.GetDisabled == 0 && tbeGameActivator8Ref.GetDisabled == 0)
tbeGameAI8Ref.enable
tbeGameActivator8Ref.disable
elseif (tbeGameAI1Ref.GetDisabled == 0 && tbeGameAI4Ref.GetDisabled == 0 && tbeGameActivator7Ref.GetDisabled == 0)
tbeGameAI7Ref.enable
tbeGameActivator7Ref.disable
elseif (tbeGameAI7Ref.GetDisabled == 0 && tbeGameAI4Ref.GetDisabled == 0 && tbeGameActivator1Ref.GetDisabled == 0)
tbeGameAI1Ref.enable
tbeGameActivator1Ref.disable
elseif (tbeGameAI7Ref.GetDisabled == 0 && tbeGameAI1Ref.GetDisabled == 0 && tbeGameActivator4Ref.GetDisabled == 0)
tbeGameAI4Ref.enable
tbeGameActivator4Ref.disable
elseif (tbeGameAI2Ref.GetDisabled == 0 && tbeGameAI5Ref.GetDisabled == 0 && tbeGameActivator8Ref.GetDisabled == 0)
tbeGameAI8Ref.enable
tbeGameActivator8Ref.disable
elseif (tbeGameAI8Ref.GetDisabled == 0 && tbeGameAI5Ref.GetDisabled == 0 && tbeGameActivator2Ref.GetDisabled == 0)
tbeGameAI2Ref.enable
tbeGameActivator2Ref.disable
elseif (tbeGameAI8Ref.GetDisabled == 0 && tbeGameAI2Ref.GetDisabled == 0 && tbeGameActivator5Ref.GetDisabled == 0)
tbeGameAI5Ref.enable
tbeGameActivator5Ref.disable
elseif (tbeGameAI3Ref.GetDisabled == 0 && tbeGameAI6Ref.GetDisabled == 0 && tbeGameActivator9Ref.GetDisabled == 0)
tbeGameAI9Ref.enable
tbeGameActivator9Ref.disable
elseif (tbeGameAI9Ref.GetDisabled == 0 && tbeGameAI6Ref.GetDisabled == 0 && tbeGameActivator3Ref.GetDisabled == 0)
tbeGameAI3Ref.enable
tbeGameActivator3Ref.disable
elseif (tbeGameAI9Ref.GetDisabled == 0 && tbeGameAI3Ref.GetDisabled == 0 && tbeGameActivator6Ref.GetDisabled == 0)
tbeGameAI6Ref.enable
tbeGameActivator6Ref.disable
elseif (tbeGameAI1Ref.GetDisabled == 0 && tbeGameAI5Ref.GetDisabled == 0 && tbeGameActivator9Ref.GetDisabled == 0)
tbeGameAI9Ref.enable
tbeGameActivator9Ref.disable
elseif (tbeGameAI9Ref.GetDisabled == 0 && tbeGameAI5Ref.GetDisabled == 0 && tbeGameActivator1Ref.GetDisabled == 0)
tbeGameAI1Ref.enable
tbeGameActivator1Ref.disable
elseif (tbeGameAI9Ref.GetDisabled == 0 && tbeGameAI1Ref.GetDisabled == 0 && tbeGameActivator5Ref.GetDisabled == 0)
tbeGameAI5Ref.enable
tbeGameActivator5Ref.disable
elseif (tbeGameAI3Ref.GetDisabled == 0 && tbeGameAI5Ref.GetDisabled == 0 && tbeGameActivator7Ref.GetDisabled == 0)
tbeGameAI7Ref.enable
tbeGameActivator7Ref.disable
elseif (tbeGameAI7Ref.GetDisabled == 0 && tbeGameAI5Ref.GetDisabled == 0 && tbeGameActivator3Ref.GetDisabled == 0)
tbeGameAI3Ref.enable
tbeGameActivator3Ref.disable
elseif (tbeGameAI7Ref.GetDisabled == 0 && tbeGameAI3Ref.GetDisabled == 0 && tbeGameActivator5Ref.GetDisabled == 0)
tbeGameAI5Ref.enable
tbeGameActivator5Ref.disable
; Perform a check for each of the 24 conditions where the Player is one move away from winning. (Two in a row)
elseif (tbeGamePlayer1Ref.GetDisabled == 0 && tbeGamePlayer2Ref.GetDisabled == 0 && tbeGameActivator3Ref.GetDisabled == 0)
tbeGameAI3Ref.enable
tbeGameActivator3Ref.disable
elseif (tbeGamePlayer3Ref.GetDisabled == 0 && tbeGamePlayer2Ref.GetDisabled == 0 && tbeGameActivator1Ref.GetDisabled == 0)
tbeGameAI1Ref.enable
tbeGameActivator1Ref.disable
elseif (tbeGamePlayer3Ref.GetDisabled == 0 && tbeGamePlayer1Ref.GetDisabled == 0 && tbeGameActivator2Ref.GetDisabled == 0)
tbeGameAI2Ref.enable
tbeGameActivator2Ref.disable
elseif (tbeGamePlayer4Ref.GetDisabled == 0 && tbeGamePlayer5Ref.GetDisabled == 0 && tbeGameActivator6Ref.GetDisabled == 0)
tbeGameAI6Ref.enable
tbeGameActivator6Ref.disable
elseif (tbeGamePlayer6Ref.GetDisabled == 0 && tbeGamePlayer5Ref.GetDisabled == 0 && tbeGameActivator4Ref.GetDisabled == 0)
tbeGameAI4Ref.enable
tbeGameActivator4Ref.disable
elseif (tbeGamePlayer6Ref.GetDisabled == 0 && tbeGamePlayer4Ref.GetDisabled == 0 && tbeGameActivator5Ref.GetDisabled == 0)
tbeGameAI5Ref.enable
tbeGameActivator5Ref.disable
elseif (tbeGamePlayer7Ref.GetDisabled == 0 && tbeGamePlayer8Ref.GetDisabled == 0 && tbeGameActivator9Ref.GetDisabled == 0)
tbeGameAI9Ref.enable
tbeGameActivator9Ref.disable
elseif (tbeGamePlayer9Ref.GetDisabled == 0 && tbeGamePlayer8Ref.GetDisabled == 0 && tbeGameActivator7Ref.GetDisabled == 0)
tbeGameAI7Ref.enable
tbeGameActivator7Ref.disable
elseif (tbeGamePlayer9Ref.GetDisabled == 0 && tbeGamePlayer7Ref.GetDisabled == 0 && tbeGameActivator8Ref.GetDisabled == 0)
tbeGameAI8Ref.enable
tbeGameActivator8Ref.disable
elseif (tbeGamePlayer1Ref.GetDisabled == 0 && tbeGamePlayer4Ref.GetDisabled == 0 && tbeGameActivator7Ref.GetDisabled == 0)
tbeGameAI7Ref.enable
tbeGameActivator7Ref.disable
elseif (tbeGamePlayer7Ref.GetDisabled == 0 && tbeGamePlayer4Ref.GetDisabled == 0 && tbeGameActivator1Ref.GetDisabled == 0)
tbeGameAI1Ref.enable
tbeGameActivator1Ref.disable
elseif (tbeGamePlayer7Ref.GetDisabled == 0 && tbeGamePlayer1Ref.GetDisabled == 0 && tbeGameActivator4Ref.GetDisabled == 0)
tbeGameAI4Ref.enable
tbeGameActivator4Ref.disable
elseif (tbeGamePlayer2Ref.GetDisabled == 0 && tbeGamePlayer5Ref.GetDisabled == 0 && tbeGameActivator8Ref.GetDisabled == 0)
tbeGameAI8Ref.enable
tbeGameActivator8Ref.disable
elseif (tbeGamePlayer8Ref.GetDisabled == 0 && tbeGamePlayer5Ref.GetDisabled == 0 && tbeGameActivator2Ref.GetDisabled == 0)
tbeGameAI2Ref.enable
tbeGameActivator2Ref.disable
elseif (tbeGamePlayer8Ref.GetDisabled == 0 && tbeGamePlayer2Ref.GetDisabled == 0 && tbeGameActivator5Ref.GetDisabled == 0)
tbeGameAI5Ref.enable
tbeGameActivator5Ref.disable
elseif (tbeGamePlayer3Ref.GetDisabled == 0 && tbeGamePlayer6Ref.GetDisabled == 0 && tbeGameActivator9Ref.GetDisabled == 0)
tbeGameAI9Ref.enable
tbeGameActivator9Ref.disable
elseif (tbeGamePlayer9Ref.GetDisabled == 0 && tbeGamePlayer6Ref.GetDisabled == 0 && tbeGameActivator3Ref.GetDisabled == 0)
tbeGameAI3Ref.enable
tbeGameActivator3Ref.disable
elseif (tbeGamePlayer9Ref.GetDisabled == 0 && tbeGamePlayer3Ref.GetDisabled == 0 && tbeGameActivator6Ref.GetDisabled == 0)
tbeGameAI6Ref.enable
tbeGameActivator6Ref.disable
elseif (tbeGamePlayer1Ref.GetDisabled == 0 && tbeGamePlayer5Ref.GetDisabled == 0 && tbeGameActivator9Ref.GetDisabled == 0)
tbeGameAI9Ref.enable
tbeGameActivator9Ref.disable
elseif (tbeGamePlayer9Ref.GetDisabled == 0 && tbeGamePlayer5Ref.GetDisabled == 0 && tbeGameActivator1Ref.GetDisabled == 0)
tbeGameAI1Ref.enable
tbeGameActivator1Ref.disable
elseif (tbeGamePlayer9Ref.GetDisabled == 0 && tbeGamePlayer1Ref.GetDisabled == 0 && tbeGameActivator5Ref.GetDisabled == 0)
tbeGameAI5Ref.enable
tbeGameActivator5Ref.disable
elseif (tbeGamePlayer3Ref.GetDisabled == 0 && tbeGamePlayer5Ref.GetDisabled == 0 && tbeGameActivator7Ref.GetDisabled == 0)
tbeGameAI7Ref.enable
tbeGameActivator7Ref.disable
elseif (tbeGamePlayer7Ref.GetDisabled == 0 && tbeGamePlayer5Ref.GetDisabled == 0 && tbeGameActivator3Ref.GetDisabled == 0)
tbeGameAI3Ref.enable
tbeGameActivator3Ref.disable
elseif (tbeGamePlayer7Ref.GetDisabled == 0 && tbeGamePlayer3Ref.GetDisabled == 0 && tbeGameActivator5Ref.GetDisabled == 0)
tbeGameAI5Ref.enable
tbeGameActivator5Ref.disable
; If the above conditions are not true, search for an open space and Play there.
elseif (tbeGameActivator5Ref.GetDisabled == 0)
tbeGameAI5Ref.enable
tbeGameActivator5Ref.disable
elseif (tbeGameActivator1Ref.GetDisabled == 0)
tbeGameAI1Ref.enable
tbeGameActivator1Ref.disable
elseif (tbeGameActivator3Ref.GetDisabled == 0)
tbeGameAI3Ref.enable
tbeGameActivator3Ref.disable
elseif (tbeGameActivator7Ref.GetDisabled == 0)
tbeGameAI7Ref.enable
tbeGameActivator7Ref.disable
elseif (tbeGameActivator9Ref.GetDisabled == 0)
tbeGameAI9Ref.enable
tbeGameActivator9Ref.disable
elseif (tbeGameActivator2Ref.GetDisabled == 0)
tbeGameAI2Ref.enable
tbeGameActivator2Ref.disable
elseif (tbeGameActivator4Ref.GetDisabled == 0)
tbeGameAI4Ref.enable
tbeGameActivator4Ref.disable
elseif (tbeGameActivator6Ref.GetDisabled == 0)
tbeGameAI6Ref.enable
tbeGameActivator6Ref.disable
elseif (tbeGameActivator8Ref.GetDisabled == 0)
tbeGameAI8Ref.enable
tbeGameActivator8Ref.disable
;If none of the above conditions is true, something is wrong with my script.
else
Message "Error! The AI was unable to Play" 15
endif
; Enable the game turn toggle ref so the player knows when it is his turn again.
tbeGameTurnToggleRef.enable
set AITurn to 0
endif
; Reset the board so a new game can be played.
; When the player presses the reset game switch, the switch is disabled causing this condition to trigger.
if (tbeGameResetRef.GetDisabled == 1)
tbeGameResetRef.enable
tbeGameAI1Ref.disable
tbeGameAI2Ref.disable
tbeGameAI3Ref.disable
tbeGameAI4Ref.disable
tbeGameAI5Ref.disable
tbeGameAI6Ref.disable
tbeGameAI7Ref.disable
tbeGameAI8Ref.disable
tbeGameAI9Ref.disable
tbeGamePlayer1Ref.disable
tbeGamePlayer2Ref.disable
tbeGamePlayer3Ref.disable
tbeGamePlayer4Ref.disable
tbeGamePlayer5Ref.disable
tbeGamePlayer6Ref.disable
tbeGamePlayer7Ref.disable
tbeGamePlayer8Ref.disable
tbeGamePlayer9Ref.disable
tbeGameActivator1Ref.enable
tbeGameActivator2Ref.enable
tbeGameActivator3Ref.enable
tbeGameActivator4Ref.enable
tbeGameActivator5Ref.enable
tbeGameActivator6Ref.enable
tbeGameActivator7Ref.enable
tbeGameActivator8Ref.enable
tbeGameActivator9Ref.enable
tbeGameTurnToggleRef.enable
set EndGame to 0
set AITurn to 0
set timer to 0
Message "The game has been reset" 6
endif
;Check if the Player has three in a row for a win.
if (tbeGamePlayer1Ref.GetDisabled == 0 && tbeGamePlayer2Ref.GetDisabled == 0 && tbeGamePlayer3Ref.GetDisabled == 0)
set EndGame to 1
elseif (tbeGamePlayer4Ref.GetDisabled == 0 && tbeGamePlayer5Ref.GetDisabled == 0 && tbeGamePlayer6Ref.GetDisabled == 0)
set EndGame to 1
elseif (tbeGamePlayer7Ref.GetDisabled == 0 && tbeGamePlayer8Ref.GetDisabled == 0 && tbeGamePlayer9Ref.GetDisabled == 0)
set EndGame to 1
elseif (tbeGamePlayer1Ref.GetDisabled == 0 && tbeGamePlayer4Ref.GetDisabled == 0 && tbeGamePlayer7Ref.GetDisabled == 0)
set EndGame to 1
elseif (tbeGamePlayer2Ref.GetDisabled == 0 && tbeGamePlayer5Ref.GetDisabled == 0 && tbeGamePlayer8Ref.GetDisabled == 0)
set EndGame to 1
elseif (tbeGamePlayer3Ref.GetDisabled == 0 && tbeGamePlayer6Ref.GetDisabled == 0 && tbeGamePlayer9Ref.GetDisabled == 0)
set EndGame to 1
elseif (tbeGamePlayer1Ref.GetDisabled == 0 && tbeGamePlayer5Ref.GetDisabled == 0 && tbeGamePlayer9Ref.GetDisabled == 0)
set EndGame to 1
elseif (tbeGamePlayer3Ref.GetDisabled == 0 && tbeGamePlayer5Ref.GetDisabled == 0 && tbeGamePlayer7Ref.GetDisabled == 0)
set EndGame to 1
;Check if the AI has three in a row for a win.
elseif (tbeGameAI1Ref.GetDisabled == 0 && tbeGameAI2Ref.GetDisabled == 0 && tbeGameAI3Ref.GetDisabled == 0)
set EndGame to 2
elseif (tbeGameAI4Ref.GetDisabled == 0 && tbeGameAI5Ref.GetDisabled == 0 && tbeGameAI6Ref.GetDisabled == 0)
set EndGame to 2
elseif (tbeGameAI7Ref.GetDisabled == 0 && tbeGameAI8Ref.GetDisabled == 0 && tbeGameAI9Ref.GetDisabled == 0)
set EndGame to 2
elseif (tbeGameAI1Ref.GetDisabled == 0 && tbeGameAI4Ref.GetDisabled == 0 && tbeGameAI7Ref.GetDisabled == 0)
set EndGame to 2
elseif (tbeGameAI2Ref.GetDisabled == 0 && tbeGameAI5Ref.GetDisabled == 0 && tbeGameAI8Ref.GetDisabled == 0)
set EndGame to 2
elseif (tbeGameAI3Ref.GetDisabled == 0 && tbeGameAI6Ref.GetDisabled == 0 && tbeGameAI9Ref.GetDisabled == 0)
set EndGame to 2
elseif (tbeGameAI1Ref.GetDisabled == 0 && tbeGameAI5Ref.GetDisabled == 0 && tbeGameAI9Ref.GetDisabled == 0)
set EndGame to 2
elseif (tbeGameAI3Ref.GetDisabled == 0 && tbeGameAI5Ref.GetDisabled == 0 && tbeGameAI7Ref.GetDisabled == 0)
set EndGame to 2
; If all the spaces have been played on, the game is a tie.
elseif (tbeGameActivator1Ref.GetDisabled == 1 && tbeGameActivator2Ref.GetDisabled == 1 && tbeGameActivator3Ref.GetDisabled == 1 && tbeGameActivator4Ref.GetDisabled == 1 && tbeGameActivator5Ref.GetDisabled == 1 && tbeGameActivator6Ref.GetDisabled == 1 && tbeGameActivator7Ref.GetDisabled == 1 && tbeGameActivator8Ref.GetDisabled == 1 && tbeGameActivator9Ref.GetDisabled == 1)
set EndGame to 3
endif
; If the game has ended, display a message.
if (EndGame == 1)
Message "You have won the game" 6
set EndGame to 0
tbeGameTurnToggleRef.disable
set AITurn to 3
elseif (EndGame == 2)
Message "You have lost the game" 6
set EndGame to 0
tbeGameTurnToggleRef.disable
set AITurn to 3
elseif (EndGame == 3)
Message "You have tied the game" 6
set EndGame to 0
tbeGameTurnToggleRef.disable
set AITurn to 3
endif
END
Now all we have to do is attach the scripts to their respective activators. In the object Window, edit the tbeGameScriptActivator and in the script drop down menu, select the tbeGameAIscript. You will not be able to find the script in the list unless you saved the whole mod after you created the script. You don’t need to reload the mod or anything like that, just save changes by clicking the save button.
Also edit each of the tbeGameActivator’s and apply the corresponding script.
Finally save changes and test your work.