still:
1>.\MySwapCharScript.cpp(1) : error C2653: 'MySwapCharScript' : is not a class or namespace name
1>.\MySwapCharScript.cpp(1) : error C2065: 'GameObject' : undeclared identifier
1>.\MySwapCharScript.cpp(1) : error C2065: 'obj' : undeclared identifier
1>.\MySwapCharScript.cpp(2) : error C2448: 'Created' : function-style initializer appears to be a function definition
Getting this issue again. Do you mind taking a look?
I have kepth the code that you have posted since mine with the timer's obviousily fail's.
MySwapCharScript.cpp file
#include "engine.h"
#include "scripts.h"
#include "MySwapCharScript.h
void MySwapCharScript::Created(GameObject *obj)
{
int maxH = Commands->Get_Max_Health(obj);
int curH = Commands->Get_Health(obj);
int maxS = Commands->Get_Max_Shield_Strength(obj);
int curS = Commands->Get_Shield_Strength(obj);
Change_Character(obj, "clown"); //Change preset
Commands->Set_Max_Health(maxH); //Set max health to that of the previous preset
Commands->Set_Health(curH); //Set health to that of the previous preset
Commands->Set_Max_Shield_Strength(maxS); //Set max shield to that of the previous preset
Commands->Set_Shield_Strength(curS); //Set shield to that of the previous preset
}
MySwapCharScript.h file
class MySwapCharScript : public ScriptImpClass
{
Created(GameObject *obj);
};
gmmain.cpp
class testChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
GameObject *obj = Get_GameObj(ID);
float Credits = Commands->Get_Money(obj);
int Team = Get_Object_Type(obj);
Vector3 position;
position = Commands->Get_Position(obj);
{
if(Credits >= 10 && (Team == 0) ){
Commands->Give_Money(obj,-10,false);
char message[256];
Change_Character(obj, "CnC_Nod_FlameThrower_2SF");
Commands->Attach_Script(obj, "MySwapCharScript" , "");
sprintf(message,"msg %s has bought a test character.", Get_Player_Name_By_ID(ID));
Console_Input(message);
Commands->Set_Position(obj,position);
}
else{
Console_Input(StrFormat("ppage %d You need 10 credits for this selection!.",Get_Player_ID(obj)).c_str());
}
}
}
};
ChatCommandRegistrant<testChatCommand> testChatCommandReg("!test",CHATTYPE_ALL,0,GAMEMODE_AOW);
[Updated on: Wed, 11 August 2010 16:59]
Report message to a moderator