Jump to content
Александр

НПС "Телепортер"

Recommended Posts

Данный нпс проверят на наличие профессии магических классов и перемещает персонажа, если же персонаж не является магом, отмена диалога.
Профессии,карту можно изменить на ваш вкус, у меня на примере это Аббадон для магических классов:)

Добавляем нашего НПС resource/garner/garnernpc.txt

1    Телепортер1    1    11    7    219200,278700    219200,278700    360    Argent City    1    0    r_Anonymous    0

Добавляем фукнцию для НПС resource/script/MisScript/NpsScript01.lua

 

function r_Anonymous()
local CurMapName1 = "hell"
--кординаты
local GoTo05X = 158
local GoTo05Y = 99
local GoTo05M = CurMapName1
Talk( 1, "Ты хочешь отправиться в Аббадон? ")
InitTrigger()
TriggerCondition( 1, CheckJobbla )
TriggerAction( 1,  GoTo, GoTo05X, GoTo05Y, GoTo05M )
TriggerFailure(1, JumpPage, 2)
Text( 1, " Да, отправь меня. ", MultiTrigger, GetMultiTrigger(), 1 )
Talk( 2, "Ты не соответствуешь требованиям. ")
Text( 2, "Хорошо, я понял. ")
end

Добавляем функцию проверки профессии у персонажа resource/script/calculate/functions.lua

function CheckJobbla ( role )
local job = GetChaAttr(role, ATTR_JOB)
if job==13 or job==14 or job==16 then
  return 1
else
  return 0
end
end

Проверяете функцию CheckJobbla c помощью поиска в файле MissionSdk.lua(resource/script/MisSdk)

Если у вас ничего не найдено открываете вот эту функцию :
 

function ConditionsTest( character, conditions, param1, param2, npc )
    if conditions == nil then
        SystemNotice( character, "ConditionsTest: condition test function conditions parameter cannot be as null!" )
        return LUA_FALSE
    end
    if conditions[1] == nil then
        PRINT( "ConditionsTest: condition as null return real!" )
    else
        local num = TR_MAXNUM_CONDITIONS
        if conditions.count ~= nil then
            num = conditions.count
        end
        for i = 1, num, 1 do --јмІвґҐ·ўЖчПЮЦЖМхјюЧо¶а12ёцМхјю
            if conditions[i] == nil then            
                break;
            end

И ниже добавляем :

    elseif conditions[i].func == CheckJobbla then
                PRINT( "ConditionsTest:CheckJobbla, p1 = ", conditions[i].p1 )
                local ret = CheckJobbla( character, conditions[i].p1 )
                if ret ~= LUA_TRUE then
                    PRINT( "ConditionsTest: CheckJobbla = false" )
                    return LUA_FALSE
                end

 

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...