| Author |
Sticky:
Post Working Scripts Here |
|
Irritatus
|
Posted: Thursday, 27 June 12:04AM
|
Hi all, here is my first script, I haven't read the docs's yet, so if you improve it, let me know!
Script Name: CowardlyCrier
What it does: a crier that spouts random nay sayer phrases on perceiving the PC's, walks around randomly, and flees from attacks with random retorts.
Notes: Three functions. All intended to be dropped into the OnUserDefined event.
sorry for the oddnaming, my pile of words is low today
NWScript: float fCrierDelay=8.0f;
int nAttackRepMod=-2;
string xGetNaySayerCry()
{
string sCryString;
int nRandNum=d6(1);
switch(nRandNum){
case 1:
sCryString="We're All Doomed!";
break;
case 2:
sCryString="The End is Near";
break;
case 3:
sCryString="Repent now sinners! Judgement Awaits!";
break;
case 4:
sCryString="Bewared the Beast of Reckoning!";
break;
case 5:
sCryString="The Dark Queen approaches!";
break;
default:
sCryString="Run Henny Penny, Run! The sky is falling";
break;
}
return sCryString;
}
string xGetHelpCry()
{
string sHelpCry;
int nRand=d6(1);
switch(nRand){
case 1:
sHelpCry="Help I'm being repressed";
break;
case 2:
sHelpCry="I Fart in your general direction";
break;
case 3:
sHelpCry="You cowardly bastard!";
break;
case 4:
sHelpCry="The better part of valor...";
break;
case 5:
sHelpCry="Na Na Na Na Na, you can't catch me!";
break;
default:
sHelpCry="OW";
break;
}
return sHelpCry;
}
void main()
{
int nUser = GetUserDefinedEventNumber();
object oCreature;
int nSeen;
if(nUser == 1001)
{
ActionRandomWalk();
}
else if(nUser == 1002)
{
oCreature = GetLastPerceived();
if ((GetLastPerceptionSeen()) && (GetIsPC(oCreature)))
{
SetFacingPoint(GetPosition(oCreature));
SpeakString(xGetNaySayerCry(),TALKVOLUME_SHOUT);
ClearAllActions();
ActionWait(fCrierDelay);
}
}
else if(nUser == 1005)
{
oCreature=GetLastAttacker(OBJECT_SELF);
if((GetIsNight()) || (GetIsDusk()) )
{
SetLocalInt(OBJECT_SELF,"nSeen",(d10(1)<5));
}
else
{
SetLocalInt(OBJECT_SELF,"nSeen",1);
}
if(GetLocalInt(OBJECT_SELF,"nSeen")==1)
{
AdjustReputation(oCreature,OBJECT_SELF,nAttackRepMod);
}
string sRandomString=xGetHelpCry();
SpeakString("Help I'm being repressed!!",TALKVOLUME_SHOUT);
ActionMoveAwayFromLocation(GetLocation(OBJECT_SELF),TRUE,40.0f);
DelayCommand(2.0f,SpeakString(sRandomString,TALKVOLUME_SHOUT));
}
return;
}
|
|