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)