You'll need a way to actually call the function you're making to attach that script...
For example, in SSGM there is the level_loaded event, which looks like this:
void Level_Loaded() {
strncpy(Data->CurrMap,The_Game()->MapName,29);
Settings->Load();
Attach_Script_All_Buildings_Team(2,"MDB_SSGM_Building","",true);
Attach_Script_All_Turrets_Team(2,"MDB_SSGM_Base_Defense","",true);
if (Settings->EnableNewCrates) {
Crate_Level_Loaded();
}
if (Settings->Gamelog) {
Gamelog_Level_Loaded();
}
if (Settings->GameMode == 2) {
CTF_Level_Loaded();
}
if (Settings->LogPlayerPurchase) {
Data->PlayerPurchaseHookID = AddCharacterPurchaseMonHook(SSGM_Purchase_Hook,0);
}
if (Settings->LogPowerupPurchase) {
Data->PowerupPurchaseHookID = AddPowerupPurchaseMonHook(SSGM_Purchase_Hook,0);
}
if (Settings->LogVehiclePurchase) {
Data->VehiclePurchaseHookID = AddVehiclePurchaseMonHook(SSGM_Purchase_Hook,0);
}
if (!Data->Plugins.empty()) {
std::vector<PluginInfo*>::const_iterator it;
for (it = Data->Plugins.begin();it != Data->Plugins.end(); ++it) {
if ((*it)->Type == Plugin) {
if ((*it)->LevelLoadedHookHandle) {
(*it)->LevelLoadedHookHandle();
}
}
}
}
}
And in the SSGM plugin, there is a level_loaded event which looks like this (although you may wish to remove the settings loader part if you're not using it):
DLLEXPORT void SSGM_Level_Loaded_Hook() {
ExampleSettings->Load();
}
Depending on whether you're putting this in a plugin, or SSGM directly, I would recomend using One of the above locations to put your function call in.
Your function may look like this:
void Wubs_Tick();
void Wubs_Tick()
{
GameObject *ref = Find_Refinery(0);
{
Attach_Script_Once(ref, "JFW_Tiberium_Refinery", "5,1.00");
}
ref = Find_Refinery(1);
if (ref)
{
Attach_Script_Once(ref, "JFW_Tiberium_Refinery", "5,1.00");
}
}
So then after the level_loaded line in either SSGM or the plugin, you could simply call your function, like this:
DLLEXPORT void SSGM_Level_Loaded_Hook() {
Wubs_Tick();
}
I made a simple extra tick rae plugin a little while ago, you can download the binary and source from my download page.
http://spencerelliott.co.uk/downloads.html
[Updated on: Thu, 16 September 2010 10:48]
Report message to a moderator