mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-28 22:15:54 -04:00
78 lines
1.9 KiB
Plaintext
78 lines
1.9 KiB
Plaintext
include library.create;
|
|
include library.pclib;
|
|
include library.utils;
|
|
include java.util.StringTokenizer;
|
|
|
|
trigger OnHearSpeech(obj_id speaker, string text)
|
|
{
|
|
|
|
if(speaker != self)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
text = toLower(text);
|
|
|
|
if(text.startsWith("playparticleme"))
|
|
{
|
|
StringTokenizer st = new StringTokenizer(text);
|
|
int numArgs = st.countTokens();
|
|
|
|
if(numArgs > 2)
|
|
{
|
|
sendSystemMessage(self, "Incorrect number of arguments. [Syntax] playParticleMe <particle name.prt>", null);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
st.nextToken();
|
|
string particleName = st.nextToken();
|
|
|
|
LOG("particleP", "Playing " + particleName + " on me");
|
|
playClientEffectObj(self, "appearance/" + particleName, self, "root");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else if(text.startsWith("playparticletarget"))
|
|
{
|
|
StringTokenizer st = new StringTokenizer(text);
|
|
int numArgs = st.countTokens();
|
|
|
|
if(numArgs > 2)
|
|
{
|
|
sendSystemMessage(self, "[Syntax] playParticleTarget <particle name.prt> -- Plays the specified particle at your current look at target", null);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
st.nextToken();
|
|
string particleName = st.nextToken();
|
|
obj_id myTarget = getLookAtTarget(self);
|
|
|
|
if (!isIdValid(myTarget)||myTarget == null)
|
|
{
|
|
sendSystemMessage(self, "Invalid target.", null);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else
|
|
playClientEffectObj(self, "appearance/" + particleName, myTarget, "root");
|
|
|
|
}
|
|
else if(text.startsWith("playparticleloc"))
|
|
{
|
|
StringTokenizer st = new StringTokenizer(text);
|
|
int numArgs = st.countTokens();
|
|
|
|
if(numArgs > 2)
|
|
{
|
|
sendSystemMessage(self, "[Syntax] playParticleLoc <particle name.prt> -- Plays the specified particle at your current location", null);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
st.nextToken();
|
|
string particleName = st.nextToken();
|
|
playClientEffectLoc(self, "appearance/" + particleName, getLocation(self), 0.0f);
|
|
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|