Nostalrius 7.7

tomekat

New Member
Joined
Mar 14, 2019
Messages
6
Best answers
0
Reaction score
0
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 ?
 
Top