The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Context Menu for Training
Author Message
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #1
Context Menu for Training
This event allows players to be able to ask for training by using an NPC's context menu. Add this event to whatever NPC's you want to be able to train.

There are some limits however:

1. A context menu has a limit for the number of entries. If the limit is exceeded, not all entries will be shown to the player.
2. Some brain types (monsters, animals, guards, etc) are incapable of training, so the event will first check for that.
3. There is no context menu choice for Spellweaving (unless you edit the client and add a localization string for it.)

Code:
[EVENTS e_trainer]
ON=@ContextMenuRequest
   IF (<NPC> < 2) || (<NPC> == 4) || (<NPC> > 9)
      // Not all brain types can train
      SERV.LOG ERROR: <NAME> (<UID>) has the e_trainer event, but their brain type is not supported
   ELSE
      FOR x 0 57
         LOCAL.PlayerSkill=<SRC.<SERV.SKILL.<dLOCAL.x>.KEY>>
         LOCAL.NpcSkill=<<SERV.SKILL.<dLOCAL.x>.KEY>>
         IF (<LOCAL.NpcSkill> > 30.0)
            IF (<LOCAL.x>!=54) //Spellweaving cannot be trained
               SRC.ADDCONTEXTENTRY <EVAL 100+<LOCAL.x>>,<EVAL 6000+<LOCAL.x>>,<EVAL <QVAL <LOCAL.PlayerSkill> < <LOCAL.NpcSkill> ? 0 : 1>>,1
            ENDIF
         ENDIF
      ENDFOR
   ENDIF
ON=@ContextMenuSelect
   LOCAL.Skill=<EVAL <ARGN>-100>
   LOCAL.PlayerSkill=<SRC.<SERV.SKILL.<dLOCAL.Skill>.KEY>>
   LOCAL.NpcSkill=<<SERV.SKILL.<dLOCAL.Skill>.KEY>>
   SERV.LOG <SRC.NAME> (<FVAL <LOCAL.PlayerSkill>>) wants to train <SERV.SKILL.<dLOCAL.Skill>.KEY> (<FVAL <LOCAL.NpcSkill>>)
   TRAIN <SERV.SKILL.<dLOCAL.Skill>.KEY>
(This post was last modified: 10-01-2012 03:50 AM by RanXerox.)
10-01-2012 03:50 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)