• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

CreatureEvent [TFS 1.3][Modal] The Oracle & The Gatekeeper with Right Click and Choose Window! (Easier and Without Queue)

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,679
Solutions
16
Reaction score
297
Location
Poland
Hello!
I've made this feature for my abandoned 7.4/7.6 project and want to share it with OTLand community.
What is it? It's an feature that allows using NPC The Oracle and The Gatekeeper with many players without staying in queues.
Players can just simply right-click (attack) NPC and modal window with vocation and town selection pop-outs.
"Disclaimer":
(I know in TFS 1.3 NPC Chat exist and everyone can talk with npc's without staying in queue, but as I said above, I made it specially for 7.4/7.6 project [I had crazy modified tfs and client so I made it because as oldschool feelings I disabled NPC Chat [by default 7.4/7.6 client don't have modal windows and shit so.. :p])

Preview:
If preview don't work, just click on this text, lel.

Requirements:
- TFS that handle Modal Windows

- Ability to "do it yourself" - add possibility to "attack NPC" with right-mouse-click; (it's turned off by default in TFS, you must figure out how to add this possibility)

- Client that handle Modal Windows


- Easy C++ knowledge and ability to understand whole code by reading it

In Data/Events/Scripts/Creature.lua add in function Creature : onTargetCombat(target) :
Lua:
    if target:getName() == "The Oracle" or target:getName() == "The Gatekeeper" then
    if self:getPosition():getDistance(target:getPosition()) < 3 then
        if (self:isPlayer() and target:isNpc()) then
                if self:isNone() then
                    if self:getLevel() >= 8 then
                    self:sendTextMessage(MESSAGE_INFO_DESCR, "Choose your destiny. Choose wisely!")
                    -- MODAL : The Oracle --
                    if target:getName() == "The Oracle" then
                        self:registerEvent("ModalWindow_StartOracle")
                        local title = "The Oracle: Choose your way!"
                        local message = "Are you prepared to face your destiny?"
                        local startOracle = ModalWindow(ID_STARTORACLE, title, message)
                        startOracle:addButton(100, "Yes")
                        startOracle:addButton(101, "No")
                        startOracle:setDefaultEnterButton(100)
                        startOracle:setDefaultEscapeButton(101)
                        startOracle:sendToPlayer(self)
                       end
                    if target:getName() == "The Gatekeeper" then
                        self:registerEvent("ModalWindow_StartGkeeper")
                        local title = "The Gatekeeper: Choose your way!"
                        local message = "Are you prepared to face your destiny?"
                        local startOracle = ModalWindow(ID_STARTGKEEPER, title, message)
                        startOracle:addButton(100, "Yes")
                        startOracle:addButton(101, "No")
                        startOracle:setDefaultEnterButton(100)
                        startOracle:setDefaultEscapeButton(101)
                        startOracle:sendToPlayer(self)
                    end
                    -----------
                    self:getPosition():sendMagicEffect(15)
                    else
                    doPlayerPopupFYI(self, "You need to get 8 Level to interact with ".. target:getName() ..".")
                    self:getPosition():sendMagicEffect(14)
                    end
                else
                    doPlayerPopupFYI(self, "Only players without vocation may interact with ".. target:getName() ..".")
                    self:getPosition():sendMagicEffect(3)
                    return RETURNVALUE_NPCCONVERSATION
                end
            return RETURNVALUE_NPCCONVERSATION
        end
    else
        doPlayerPopupFYI(self, "You need to get closer to interact with ".. target:getName() ..".")
        self:getPosition():sendMagicEffect(3)
        return RETURNVALUE_NPCCONVERSATION
    end
    else
        return true
    end
In Data/Creaturescripts/Creaturescripts.xml add those lines:
Lua:
    <!-- Oracle -->
    <event type="ModalWindow" name="ModalWindow_StartOracle" script="modals/oracle/startoracle.lua"/>
    <event type="ModalWindow" name="ModalWindow_CityOracle" script="modals/oracle/cityoracle.lua"/>
    <event type="ModalWindow" name="ModalWindow_VocOracle" script="modals/oracle/vocoracle.lua"/>
    <event type="ModalWindow" name="ModalWindow_ChosenOracle" script="modals/oracle/areyousureoracle.lua"/>
    <!-- Gatekeeper -->
    <event type="ModalWindow" name="ModalWindow_StartGkeeper" script="modals/gatekeeper/startgkeeper.lua"/>
    <event type="ModalWindow" name="ModalWindow_CityGkeeper" script="modals/gatekeeper/citygkeeper.lua"/>
    <event type="ModalWindow" name="ModalWindow_VocGkeeper" script="modals/gatekeeper/vocgkeeper.lua"/>
    <event type="ModalWindow" name="ModalWindow_ChosenGkeeper" script="modals/gatekeeper/areyousuregkeeper.lua"/>
Create in "Data/Creaturescripts/scripts" folder named modals and download & copy-paste in scripts that I attached in attachment in this post.

Have fun!
Have a nice day!
Peace!
 

Attachments

Similar threads

Top