Files

92 lines
1.9 KiB
Markdown

# IScriptEntity.unlockRotation
[← IScriptEntity](index.md) · [← Master](../../wiki.md)
Parça 14/17 · [önceki](unlockRotation-13.md) · [sonraki](unlockRotation-15.md)
Get entity's states (if it has some, only players and NPCs have states).
function main(c)
{
var states = c.getSubject().getStates()
states.add("run", 1)
c.send("state run: §6"+states.getNumber("run"))
}
Returns:
entity's states, or null if this entity doesn't have states.
getMorph
AbstractMorph getMorph()
Get entity's morph (works with player and NPCs).
// Assuming s is a player
var s = c.getSubject();
var morph = mappet.createMorph("{Name:\"blockbuster.alex\"}");
var entityMorph = s.getMorph();
if (entityMorph != null && entityMorph.equals(morph))
{
c.send(s.getName() + " is morphed into Alex morph!");
}
setMorph
boolean setMorph(AbstractMorph morph)
Set entity's morph (works with player and NPCs).
var morph = mappet.createMorph("{Name:\"blockbuster.alex\"}");
// Assuming c.getSubject() is a player or an NPC
c.getSubject().setMorph(morph);
Returns:
if entity's morph was changed successfully.
displayMorph
default void displayMorph(AbstractMorph morph,
int expiration,
double x,
double y,
double z)
Display a world morph to all players that see this entity (including themselves).
function main(c)
{
var s = c.getSubject();
var morph = mappet.createMorph('{Name:"item"}');
s.displayMorph(morph, 100, 0, s.getHeight() + 0.5, 0);
}
displayMorph
default void displayMorph(AbstractMorph morph,
int expiration,
double x,
double y,
double z,
boolean rotate)
Display a world morph to all players that see this entity (including themselves) with toggleable following rotation.
var s = c.getSubject();
var morph = mappet.createMorph('{Name:"item"}');
s.displayMorph(morph, 100, 0, s.getHeight() + 0.5, 0, true);