Post tutorial RSS Coding Introduction

A small introduction with detailed explaining images for creating your own scripts for the TCW Client for use in the Editor with VS2010. An Hello script example.

Posted by on - Basic Client Side Coding
When you opened up the Solution in VS2010 make sure that it is set to Release and Win32.
This "mode" is required for making scripts you can use in the Editor/Game Client.
When you added your scripts the build will create a new scripts.dll which you should add into your Game Client folder and overwrite the existing file.
The Editor will load scripts from this file automatically so they become available then.
Before we begin, goto Build->Rebuild Solution this will compile all scripts and build a clean scripts.dll
If you have errors feel free to post them in this topic or in a new topic in this sub-forum.
This is what the end-result should look like. No errors and all successes ;)
4 were built which are part of the Release configuration for the Game, the 9 skipped ones are part of the SERVER (Release SSGM) and will be discussed later.
In the solution explorer on the left you can find the plugins and scripts code available.
Expande the scripts->01.Sources->Tib.Crystal War to see a list of scripts that are used in Tiberium Crystal War.
ALL scripts contained in this folder are accessible from in the game and the editor automatically after building and placing the new scripts.dll in the game folder.
To keep things organized you could create a new Filter and add one with your (project) name, for example "zunnie".
To create scripts you need a .cpp source file and a .h header file.
Create two files by right clicking and adding them and call them (for example) zunnie.cpp and zunnie.h in the filter (folder) you just created.
The script example above when built becomes available in the Editor and Game as "zunnie_hello" which can then be attached to objects or spawners etc.
When it is attached to an object in the Editor (or by other means), that object, as soon as it gets created in the game, will display the message "zunnie says hello!" once.
For example if you have a spawner that spawns a bot, and you attach the script "zunnie_hello" to it, everytime that bot spawns and respawns it will say the string "zunnie says hello!" once.
When you wrote your code you goto Build->Rebuild Solution and it will rebuild all files for this configuration (Release).
when succeeded, switch the configuration mode to Release SSGM and do Build->Rebuild Solution one more time.
When everything is completed successfully, the image of above should be the result.
If you have errors, feel free to post them here or in a new topic.
Goto your bin folder, here is where you will find the built items.
Release folder is for the GAME ONLY, copy all binary files (.exe and .dll) to the Game folder and overwrite the existing files.
Release SSGM folder is for the SERVER ONLY, you copy all the binary files (.exe and .dll) to the server root folder and overwrite the existing files.
If we attach the script to the GDI Barracks Building Controller (the blue house icon), when the map is loaded the Barracks is "Created" and it will say "zunnie says hello!" in the chat area once.

Have fun experimenting with this. I will probably write some more simple scripts in tutorial style soon for this.


Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.