Nostalrius 7.7

tomekat

New Member
Joined
Mar 14, 2019
Messages
6
Best answers
0
Reaction score
1
can i use lua script functions in .npc or create array and doing for there? Im reading behaviors but i need time to learn all.

#edit
im doing tasks with npc and i resolve it like this

Code:
#TASKS

#REWARD
"task",QuestValue(6522002)>0 -> Amount=QuestValue(6522000),"I have something for you, would you like to get a reward? %A", Topic=10
Topic=10,"yes",QuestValue(6522000)=1 -> Amount=10, Create(3043), SetQuestValue(6522000,0), SetQuestValue(6522002,0), SetQuestValue(6522003,1), "Here you go!"
Topic=10,"yes",QuestValue(6522000)=2 -> Amount=50, Create(3043), SetQuestValue(6522000,0), SetQuestValue(6522002,0), SetQuestValue(6522003,2), "Here you go!"
Topic=10,"yes",QuestValue(6522000)=3 -> Amount=100, Create(3043), SetQuestValue(6522000,0), SetQuestValue(6522002,0), SetQuestValue(6522003,3), "Here you go!"
Topic=10 -> "Ok, your loss.", Idle

#TASK ALREADY
"task",QuestValue(6522000)>0 -> "You already have a task, would you like to know name of this task?",Topic=20
Topic=20,"yes",QuestValue(6522000)=1 -> "You already on a Rotworms task."
Topic=20,"yes",QuestValue(6522000)=2 -> "You already on a Dragons task."
Topic=20,"yes",QuestValue(6522000)=3 -> "You already on a Demons task."
Topic=20 -> "Good bye. Dont walk in the dark alone, the evil is just around the corner!", Idle

#ALL DONE
"task",QuestValue(6522003)=3 -> "You have completed all the tasks!"

#SET NEW
"task",QuestValue(6522003)<1 -> SetQuestValue(6522000,1),SetQuestValue(6522001,50),"Started Rotworms task."
"task",QuestValue(6522003)=1 -> SetQuestValue(6522000,2),SetQuestValue(6522001,100),"Started Dragons task."
"task",QuestValue(6522003)=2 -> SetQuestValue(6522000,3),SetQuestValue(6522001,666),"Started Demons task."
but i want to get storage value from my lua object. Its possible? Thanks for answer
 
Last edited:

Kuantikum

Member
Joined
Jul 3, 2015
Messages
40
Best answers
0
Reaction score
2
data/globalevents/globalevents.xml
XML:
<globalevent name="Player Save" interval="1800000" script="playersave.lua" />

data/globalevents/scripts/playersave.lua
Lua:
local function serverSave()
    Game.saveGameState()
    broadcastMessage("Server saved, next save in 30 minutes.", MESSAGE_STATUS_WARNING)
    return true
end

function onThink(interval, lastExecution, thinkInterval)
    broadcastMessage("Automatic Serversave in 10 seconds!", MESSAGE_STATUS_WARNING)
    addEvent(serverSave, 10000)
end

data/talkactions/scripts/saveserver.lua
Lua:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end

    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end

    Game.saveGameState()
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Server is now saved.")
end

data/talkactions/talkactions.xml
XML:
<talkaction words="/saveserver" script="saveserver.lua" />

src/luascript.cpp add on line 1635 ~

C++:
registerMethod("Game", "saveGameState", LuaScriptInterface::luaGameSaveGameState);
and add on line 3939 (after luaGameSetGameState)
C++:
int LuaScriptInterface::luaGameSaveGameState(lua_State* L)
{
    // Game.saveGameState()
    g_game.saveGameState();
    pushBoolean(L, true);
    return 1;
}
src/luascript.h add on line 538 ~
C++:
static int luaGameSaveGameState(lua_State* L);

enjoy

Ty brow, love you! :D
 

c2lg4

New Member
Joined
Dec 27, 2008
Messages
2
Best answers
0
Reaction score
0
Hi,

I'm having some issues with changing the spawn rate of the server.
Whenever I change rateSpawn from 0, it leads to monsters instantly respawning (as soon as the player leaves the screen).

Does anybody know how I could fix this?
 

Kuantikum

Member
Joined
Jul 3, 2015
Messages
40
Best answers
0
Reaction score
2
Hi,

I'm having some issues with changing the spawn rate of the server.
Whenever I change rateSpawn from 0, it leads to monsters instantly respawning (as soon as the player leaves the screen).

Does anybody know how I could fix this?
I changed the time in world/spawn.xml
 

Kuantikum

Member
Joined
Jul 3, 2015
Messages
40
Best answers
0
Reaction score
2
Hello guys!

Is it possible bank system like: Balance, deposit, transfer and withdraw ?
 

Curb

Well-Known Member
Joined
Sep 7, 2014
Messages
47
Best answers
1
Reaction score
5
Location
San Diego CA
This error when compiling. Does anyone knows what am I doing wrong? :p

 

al222

New Member
Joined
Sep 18, 2019
Messages
3
Best answers
0
Reaction score
0
Thank you for sharing this!
I'm brand new here at OTLand, but I played Tibia mainly between 2001-2006. My goal is to just have a private server to re-experience this game the way it was before it, in my opinion, went to shit :) So far I'm having a lot of fun with it, but I am also having a little trouble with the game freezing completely after playing for around 1 hour. When this happens the only solution I've found is to restart the server application, but this sometimes causes all the progress I made in that hour to be lost. Any ideas what could be wrong?
 

al222

New Member
Joined
Sep 18, 2019
Messages
3
Best answers
0
Reaction score
0
I'm also trying to learn how to compile this myself, since I would like to eventually be able to change things to be more like the previous versions of Tibia, before the magic system got updated etc. But I'm running into a lot of trouble compiling in Visual Studio and have spent the past few days troubleshooting, but now I'm completely stuck. I have a little coding experience, but have never worked with Visual Studio. I tried to follow the tutorial here otland/forgottenserver (https://github.com/otland/forgottenserver/wiki/Compiling-on-Windows) but I keep getting errors. I've overcome some of them, but now I'm really stuck.

The errors I'm getting now all seem to be related to Lua. Getting about 100 errors similar to this one:
Error LNK2001 unresolved external symbol _luaL_loadfile

Could someone please help me out? I'd really appreciate it!
 

Curb

Well-Known Member
Joined
Sep 7, 2014
Messages
47
Best answers
1
Reaction score
5
Location
San Diego CA
Does anyone compiled it after the monster.cpp fix? Would you upload it please? o_O
 

pink_panther

Member
Joined
Sep 10, 2016
Messages
95
Best answers
0
Reaction score
17
Is there an easy way to convert/open other maps to import segments of map?

Because all the item ids are different in this RME, all other maps open up all mis-matched.
 
Top