setguild, sethp, setlanguage, setnexthpevent, setnextinchpevent, setskill, setsky, setstat, settarget, settime, settimer, settimerMS

TurmoilToad
2019-01-09 22:30:21 -05:00
parent 4d26c0568e
commit ab6d945f91
+270 -14
@@ -3384,26 +3384,282 @@ F | Forever | Never expires.
```perl
#:: Set the qglobal "Example", to a value of "1", for all NPCs and zone, and last forever
quest::setglobal("Example", 1, 5, "F"
quest::setglobal("Example", 1, 5, "F");
```
## setguild
      **Parameter(s):**
      guild_id _(int)_, guild_rank_id _(int)_
      **Usage:**
      Sets the specified guild, by Guild ID, and the specified guild rank, by Rank ID, for the client character that triggered the event. Ranks are: 0=Member, 1=Officer, 2=Leader.
      **Example:**
```perl
#:: Add to guild 24
quest::setguild(24,0);
```
## sethp
      **Parameter(s):**
      mob_health_percentage _(int)_
      **Usage:**
      Used to set the percentage (0 to 100) of health for the NPC.
      **Example:**
```perl
#:: Restore HP to 50 percent
quest::sethp(50);
```
## setlanguage
      **Parameter(s):**
      skill_id _(int)_, value _(int)_
      **Usage:**
      Used to set the specified [Language](https://github.com/EQEmu/Server/wiki/Languages) to the specified skill level (0 to 100).
      **Example:**
```perl
sub EVENT_ENTERZONE {
#:: Set common tongue to 1 for any new player that is not human
if ($race ne "Human") {
if (!defined $qglobals{"newbiecommon"}) {
$client->SetLanguageSkill(0, 1);
quest::setglobal("newbiecommon", 1, 5, "F");
}
}
}
```
## setnexthpevent
      **Parameter(s):**
      at_mob_percentage _(int)_
      **Usage:**
      Used to set an HP event (to trigger EVENT_HP). When the NPC's health decreases to reach this threshold, the event will be triggered.
      **Example:**
```perl
sub EVENT_SPAWN {
#:: Trigger EVENT_HP at 90 percent
quest::setnexthpevent(90);
}
sub EVENT_HP {
#:: Match if HP is 90 percent
if ($hpevent == 90) {
quest::shout("My hit points have reached 90 percent!");
#:: Trigger EVENT_HP at 80 percent
quest::setnexthpevent(80);
}
elsif ($hpevent == 80) {
quest::shout("My hit points have reached 80 percent!");
}
}
```
## setnextinchpevent
      **Parameter(s):**
      at_mob_percentage _(int)_
      **Usage:**
      Used to set an HP event (to trigger EVENT_HP). When the NPC's health increases to reach this threshold, the event will be triggered.
      **Example:**
```perl
sub EVENT_SPAWN {
#:: Trigger EVENT_HP at 90 percent
quest::setnexthpevent(90);
}
sub EVENT_HP {
#:: Match if hit points decrease to 90 percent
if ($hpevent == 90) {
quest::shout("My hit points have reached 90 percent--you better keep trying!");
#:: Trigger EVENT_HP at 91 percent
quest::setnextinchpevent(91);
}
#:: Match if hit points increase to 91 percent
if ($inchpevent == 91) {
quest::shout("You are no match for my power!");
quest::sethp(100);
}
}
```
## setskill
      **Parameter(s):**
      skill_id _(int)_, value _(int)_
      **Usage:**
      Used to set the specified [Skill](https://github.com/EQEmu/Server/wiki/Skills) to the specified value.
      **Example:**
```perl
#:: Set baking to 100
quest::setskill(60, 100);
```
## setsky
      **Parameter(s):**
      sky _(uint8)_
      **Usage:**
      Sets the parameter for the sky (0 to 255)
      **Example:**
```perl
#:: Turn the sky red
quest::setsky(250);
```
## setstat
      **Parameter(s):**
      stat_id _(int)_, value _(int)_
      **Usage:**
      Sets the specified stat to the specified value (0 to 252). Stats are: STR=0, STA=1, AGI=2, DEX=3, INT=4; WIS=5, CHA=6.
      **Example:**
```perl
#:: Set STR to 250
quest::setstat(0, 250);
```
## settarget
      **Parameter(s):**
      target_enum _(string)_, target_id _(int)_
      **Usage:**
      Sets the target, by Target ID, for the specified target_enum (either npc_type ID or entity ID).
      **Example:**
```perl
sub EVENT_SPAWN {
my @clist = $entity_list->GetClientList();
foreach my $c (@clist) {
#:: Tell Fippy to kill!
quest::settarget(2001, $c);
}
}
```
## settime
      **Parameter(s):**
      new_hour _(int)_, new_min _(int)_, update_world _(bool)_
      **Usage:**
      Sets the time for the zone or the world to the specified hour and minute. Update world is optional, but defaults to true--setting it to false makes the time change only apply to the current zone.
      **Example:**
```perl
#:: Make it 5 o'clock somewhere
quest::settime(17,0);
#:: No--make it 5 o'clock everywhere!
quest::settime(17);
```
## settimer
      **Parameter(s):**
      timer_name _(string)_, seconds _(int)_
      **Usage:**
      Sets a timer (in seconds) that will loop until you stop it. Gets caught by EVENT_TIMER.
      **Example:**
```perl
sub EVENT_SPAWN {
#:: Set a timer that loops every 300 seconds (5 min)
quest::settimer("despawn", 300);
}
sub EVENT_TIMER {
if ($timer eq "despawn") {
#:: Stop the timer from looping over and over
quest::stoptimer("despawn")
#:: Depop
quest::depop();
}
}
```
## settimerMS
      **Parameter(s):**
      timer_name _(string)_, milliseconds _(int)_
      **Usage:**
      Sets a timer (in milliseconds) that will loop until you stop it. Gets caught by EVENT_TIMER. Note that the Lua timer function is in milliseconds as well.
      **Example:**
```perl
sub EVENT_SPAWN {
#:: Set a timer that loops every 300000 milliseconds (5 min)
quest::settimerMS("despawn", 300000);
}
sub EVENT_TIMER {
if ($timer eq "despawn") {
#:: Stop the timer from looping over and over
quest::stoptimer("despawn")
#:: Depop
quest::depop();
}
}
```
(Work in Progress)
```perl
quest::setguild(int guild_id, int guild_rank_id)
quest::sethp(int mob_health_percentage [0-100])
quest::setlanguage(int skill_id, int value)
quest::setnexthpevent(int at_mob_percentage)
quest::setnextinchpevent(int at_mob_percentage)
quest::setskill(int skill_id, int value)
quest::setsky(uint8 sky)
quest::setstat(stat_id, int_value)
quest::settarget(string target_enum ['npc_type', 'entity'], int target_id)
quest::settime(int new_hour, int new_min, [bool update_world = true])
quest::settimer(string timer_name, int seconds)
quest::settimerMS(string timer_name, int milliseconds)
quest::sfollow()
quest::shout(string message)
quest::shout2(string message)