60 lines
2.0 KiB
Plaintext
60 lines
2.0 KiB
Plaintext
// rts_it_uw10 - Manual of The Wood Golem
|
|
// 100 mana and some oak, elm, and iron wood
|
|
#include "rtsh_multiplay"
|
|
#include "components_h"
|
|
|
|
void main()
|
|
{
|
|
object oPC=GetItemActivator();
|
|
int nMana=fnGetTeamMana(oPC);
|
|
string sComponents="some oak, elm, and iron wood";
|
|
string sRes="cwoodgolem";
|
|
string sID=GetLocalString(oPC,"sTeamID");
|
|
object oProxy=GetObjectByTag(sID+"_PROXY");
|
|
object oGolem;
|
|
int nManaCost=100;
|
|
int bCheck=FALSE;
|
|
object oItem=GetItemActivated();
|
|
object oWP;
|
|
string sWP;
|
|
int nR;
|
|
if (nMana>(nManaCost-1))
|
|
{ // has sufficient mana
|
|
bCheck=GetHasComponents(oPC,"x2_it_cmat_elmw",1);
|
|
if (bCheck) bCheck=GetHasComponents(oPC,"x2_it_cmat_oakw",1);
|
|
if (bCheck) bCheck=GetHasComponents(oPC,"x2_it_cmat_ironw",1);
|
|
if (bCheck)
|
|
{ // has components
|
|
ConsumeComponents(oPC,"x2_it_cmat_elmw",1);
|
|
ConsumeComponents(oPC,"x2_it_cmat_oakw",1);
|
|
ConsumeComponents(oPC,"x2_it_cmat_ironw",1);
|
|
nMana=nMana-nManaCost;
|
|
fnSetTeamMana(oPC,nMana);
|
|
oGolem=CreateObject(OBJECT_TYPE_CREATURE,sRes,GetLocation(oPC));
|
|
SetLocalString(oGolem,"sTeamID",sID);
|
|
ChangeFaction(oGolem,oProxy);
|
|
if (oProxy==OBJECT_INVALID) SendMessageToPC(oPC,"ERROR: Could not find proxy "+sID+"_PROXY!!");
|
|
if(d100()<26)
|
|
{ // move book
|
|
nR=d100();
|
|
if (nR>9) sWP="RL_"+IntToString(nR);
|
|
else { sWP="RL_0"+IntToString(nR); }
|
|
oWP=GetWaypointByTag(sWP);
|
|
if (oWP!=OBJECT_INVALID)
|
|
{ // move book
|
|
CreateObject(OBJECT_TYPE_ITEM,GetResRef(oItem),GetLocation(oWP));
|
|
DelayCommand(1.0,DestroyObject(oItem));
|
|
} // move book
|
|
} // move book
|
|
} // has components
|
|
else
|
|
{ // missing components
|
|
SendMessageToPC(oPC,"This book requires "+sComponents+" to create a golem.");
|
|
} // missing components
|
|
} // has sufficient mana
|
|
else
|
|
{ // not enough mana
|
|
SendMessageToPC(oPC,"This book requires 100 mana to create a golem.");
|
|
} // not enough mana
|
|
}
|