HoS_PRC8/_mod/_module/nss/squadl_make_sql.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

28 lines
1.0 KiB
Plaintext

// SQUADL_MAKE_SQL - Make the target a Squad Leader
#include "color_header"
void main()
{
object oPC=GetPCSpeaker();
object oTarget=GetLocalObject(oPC,"oTarget");
object oMod=GetModule();
object oItem;
int nNum=0;
string sID=GetLocalString(oPC,"sTeamID");
if (GetIsObjectValid(GetLocalObject(oMod,"oSquadLead"+sID+"1"))==FALSE) nNum=1;
else if (GetIsObjectValid(GetLocalObject(oMod,"oSquadLead"+sID+"2"))==FALSE) nNum=2;
else if (GetIsObjectValid(GetLocalObject(oMod,"oSquadLead"+sID+"3"))==FALSE) nNum=3;
if (nNum!=0)
{ // squad found
SetLocalObject(oMod,"oSquadLead"+sID+IntToString(nNum),oTarget);
SetLocalInt(oTarget,"nSquadNum",nNum);
if (GetItemPossessedBy(oTarget,"rts_it_squadbadge")==OBJECT_INVALID)
{ // OI
oItem=CreateItemOnObject("rts_it_squadbadg",oTarget);
sID="You have been promoted to the position of Squad Leader by your leader "+GetName(oPC)+".";
sID=ColorRGBString(sID,0,4,1);
SendMessageToPC(oTarget,sID);
} // OI
} // squad found
}