Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » START_TIMER Parameters
Re: START_TIMER Parameters [message #434649 is a reply to message #434519] Thu, 12 August 2010 11:50 Go to previous messageGo to previous message
T0tNl
Messages: 63
Registered: July 2007
Karma:
Recruit
I have fixed the code( I think(it compiles without errors)) but does not work. Do you see anything wronge? I just change to the "CnC_Nod_FlameThrower_2SF" preset and thats it.

MySwapCharScript.cpp


#include "scripts.h"
#include "engine.h"
#include "MySwapCharScript.h"

void MySwapCharScript::Created(GameObject *obj)
{
    float maxH = Commands->Get_Max_Health(obj);
    float curH = Commands->Get_Health(obj);
    float maxS = Commands->Get_Max_Shield_Strength(obj);
    float curS = Commands->Get_Shield_Strength(obj);

    Change_Character(obj, "clown"); //Change preset

     Commands->Set_Health(obj,curH); //Set health to that of the previous preset
     Commands->Set_Shield_Strength(obj,curS); //Set shield to that of the previous preset
     Set_Max_Health(obj, maxH); //Set max health to that of the previous preset
     Set_Max_Shield_Strength(obj, maxS); //Set max shield to that of the previous preset 
}


MySwapCharScript.h

class MySwapCharScript : public ScriptImpClass
{
 void 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: Thu, 12 August 2010 12:43]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: build error
Next Topic: Update_PT_Data
Goto Forum:
  


Current Time: Wed Dec 18 04:56:55 MST 2024

Total time taken to generate the page: 0.01081 seconds