67 lines
2.6 KiB
Plaintext
67 lines
2.6 KiB
Plaintext
// promote target to team leader
|
|
#include "header_sounds"
|
|
void fnAnnounce(string sMsg="",int nOption=0);
|
|
|
|
void main()
|
|
{
|
|
object oOld=GetPCSpeaker();
|
|
object oPC=GetLocalObject(oOld,"oTarget");
|
|
string sID=GetLocalString(oOld,"sTeamID");
|
|
object oMod=GetModule();
|
|
object oItem;
|
|
int nGold=GetGold(oOld);
|
|
int nMana=GetLocalInt(oOld,"nManaStore");
|
|
int nSouls=GetLocalInt(oOld,"nSoulStore");
|
|
int nStart=GetLocalInt(oOld,"nStartSoul");
|
|
string sTeamName;
|
|
if (sID=="SPID") sTeamName="Spider Cultists.";
|
|
else if (sID=="DWF") sTeamName="Dwarves.";
|
|
else if (sID=="UND") sTeamName="Undead.";
|
|
else if (sID=="UNC") sTeamName="Unclean.";
|
|
if (oPC!=oOld) SendMessageToPC(oPC,"NOTICE!!!: You have been promoted to leader by "+GetName(oOld)+".");
|
|
if (oPC!=oOld) AssignCommand(oPC,SpeakString("NOTICE!!!: I have been promoted to leader by "+GetName(oOld)+"."));
|
|
DeleteLocalInt(oPC,"nBuilder"); // not needed anymore... you're leader
|
|
SetLocalObject(oMod,"oTeamLead"+sID,oPC); // set leader official
|
|
// remove old leaders tools
|
|
SetLocalInt(oPC,"nManaStore",nMana);
|
|
SetLocalInt(oPC,"nSoulStore",nSouls);
|
|
SetLocalInt(oPC,"nStartSoul",nStart);
|
|
DeleteLocalInt(oOld,"nManaStore");
|
|
DeleteLocalInt(oOld,"nSoulStore");
|
|
DeleteLocalInt(oOld,"nStartSoul");
|
|
if (GetItemPossessedBy(oPC,"RTSCreation_Tool")==OBJECT_INVALID)
|
|
{ // create command tool
|
|
oItem=CreateItemOnObject("rtscreation_tool",oPC);
|
|
} // create command tool
|
|
if (GetItemPossessedBy(oPC,"RTSUnit_Creation")==OBJECT_INVALID)
|
|
{ // create command tool
|
|
oItem=CreateItemOnObject("rtsunit_creation",oPC);
|
|
} // create command too
|
|
if (GetItemPossessedBy(oPC,"rts_it_teamwand")==OBJECT_INVALID)
|
|
{ // create team wand
|
|
oItem=CreateItemOnObject("rts_it_teamwand",oPC);
|
|
} // create team wand
|
|
// delete items off old leader
|
|
oItem=GetItemPossessedBy(oOld,"RTSCreation_Tool");
|
|
DestroyObject(oItem);
|
|
oItem=GetItemPossessedBy(oOld,"RTSUnit_Creation");
|
|
DestroyObject(oItem);
|
|
oItem=GetItemPossessedBy(oOld,"rts_it_teamwand");
|
|
DestroyObject(oItem);
|
|
if (oPC!=oOld) fnAnnounce(GetName(oPC)+" has been promoted to leader of the "+sTeamName+" by "+GetName(oOld)+".");
|
|
}
|
|
|
|
|
|
|
|
void fnAnnounce(string sMsg="",int nOption=0)
|
|
{ // announce message to players
|
|
object oNext=GetFirstPC();
|
|
while(oNext!=OBJECT_INVALID)
|
|
{ // announce
|
|
SendMessageToPC(oNext,"ANNOUNCEMENT:"+sMsg);
|
|
if (nOption==0) AssignCommand(oNext,fnSoundAlert("as_an_owlhoot1"));
|
|
else if (nOption==1) AssignCommand(oNext,fnSoundAlert("as_cv_lute1"));
|
|
oNext=GetNextPC();
|
|
} // announce
|
|
} // fnAnnounce()
|