Jump to content

Frozen

Inactive Member
  • Posts

    199
  • Joined

  • Last visited

  • Days Won

    7
  • Feedback

    0%

Posts posted by Frozen

  1. Try this one:

    quest nowe_pety begin
        state start begin
        
            function get_pet_info(itemVnum)
            
                local pet_info_map = {
                    [1500] = {33011, "Misio", 0}
                }
                return pet_info_map[tonumber(itemVnum)]
                
            end
            
            function get_spawn_effect_file(idx)
                local effect_table = {
                    [0] = nil,
                    [1] = "d:\\\\ymir work\\\\effect\\\\etc\\\\appear_die\\\\npc2_appear.mse"
                }
                return effect_table [idx]
            end
            
            when 1500.use begin 
            
                local pet_info = pet_system.get_pet_info(item.get_vnum())
                
                if nil != pet_info then
                
                    local mobVnum = pet_info[1]
                    local petName = pet_info[2]
                    local spawn_effect_file_name = pet_system.get_spawn_effect_file(pet_info[3])
                    
                    if pet.is_summon(mobVnum) then
                        if spawn_effect_file_name != nil then pet.spawn_effect (mobVnum, spawn_effect_file_name) end
                        pet.unsummon(mobVnum)
                        
                    else
                        if pet.count_summoned() < 1 or pc.is_gm() then pet.summon(mobVnum, " ".. petName, false)
                        else syschat("Nie możesz przywołać kilku zwierzaków.") end
                        
                        if spawn_effect_file_name != nil then pet.spawn_effect(mobVnum, spawn_effect_file_name) end
                        
                    end
                end
            end
        end
    end
  2. Hey guys, so there is a thing that really annoys when loggin in to a closed server.. whenever i try to cancel loggin in, the Processing Popup closes, but the popup with the error still appears after a few seconds...

    So here is how you stop it from appearing:

    Open intrologin.py

    Add somewhere in __init__ function:

    self.isLoginCanceled = False

    Add somewhere in Close function:

    self.isLoginCanceled = None

    Search:

    def OnConnectFailure(self):

    Search for:

    if self.isNowCountDown:
                return  

    Add under:

    if self.isLoginCanceled:
                self.isLoginCanceled = False
                return 

    Search:

    def Connect(self, id, pwd):

    Search this:

    self.stream.popupWindow.Open(localeInfo.LOGIN_CONNETING, localeInfo.UI_CANCEL)

    Replace with:

    self.stream.popupWindow.Open(localeInfo.LOGIN_CONNETING, self.OnProcessingCancel, localeInfo.UI_CANCEL)

    Add under the Connect function this:

    def OnProcessingCancel(self):
            self.isLoginCanceled = True
            self.stream.popupWindow.Close()

     

    Save, and its done.

    I know this is useless and easy to make but its meant to the people who find it anoying and dont know how to solve.

    Kind Regards,

    Frozen

    • Love 4
  3. On 4/2/2016 at 7:50 PM, 'PACI said:

    I've seen a similar function made like 2/3 years ago (can even tell you that some var names are equal), but yours seems better. Nice one :)

    Just a tip.

    
    if type(tonumber(line)) ~= "number" and not bAllLines then  return end

    The tonumber() function tries to convert the arg into a number, if it can't do that, it'll return a nil value, so you can do this instead:

    
    if not tonumber(line) and not bAllLines then  return end

    Yes there is actually a function made by pacificador a long time ago, it is good too, both do almost the same..

    I just tried to make my own function and add some new features.

    Thanks for the tip i will edit :D

    Kind Regards

  4. 2 hours ago, Motumbo said:

    i wanted to add a little text like in this image

    rcCFGSf.png


    a friend helped me a lot
    and the funny thing is that

    to him its working 100%

    For me no... thats pretty strange ah?


    ________


            ##testo
            {
                "name" : "ConnectName",
                "type" : "text",
                "x" : 15,
                "y" : 0,
                "vertical_align" : "left",
                "text_vertical_align" : "left",
                "text" : "CIAO",
            },



    __________



    Thats from loginwindow.py  of locale.


    i dont know why to me its not working at all!


    do i need to do something else in any other file? root\locale\uiscript


    Thanks for your time and help.

     


    Regards

    There is not  "vertical_align" : "left" , only center or bottom so or erase it or change it to one of these.

    Kind Regards

    • Love 1
  5. 1 hour ago, Faq said:

    i think its not fair, we see lots of guys in here with the devoleper medal and the only thing they can do is ask for help here in the forum.
    And this guy make lots of helpfoul things and he is just a member.
    What can some one do to have the devoleper medal/tag name?
    Be freind of some one here?
    Thanks for shering that Frozen.

    Thanks my friend, i appreciate it :) 

  6. 4 minutes ago, ds_aim said:

    wow fuck This will help me to make patchs for my customers.

    Auto install updates. :wub:

    Thanks. :)

    No problem ;) Im glad i helped.

    4 minutes ago, ZenkoKXO. said:

    A friendly guy who really helped me with this function; thank you Frozen :)

    Thanks, no problem :D you gave the idea .

    Kind Regards

  7. M2 Download Center

    This is the hidden content, please
    ( Internal )

    Hello guys, i made a simple function that allows you to easily manage files. This function let you create, read, write, rewrite or erase lines of text or the hole text.

    • Examples on how to use it:
    Spoiler

     

    Reading:

    
    
    
    code: manage_file("/locale/test/test.txt", "read", "1", "")
    what is doing: reading first line if the file test.txt
    output: the first line of your file test.txt

     

    Adding:

     

    
    
    
    code: manage_file("/locale/test/test.txt", "add", "", "example text")
    what is doing: it will add a line of file saying "example text"
    output: nothing

     

    Rewriting:

     

    
    
    
    code: manage_file("/locale/test/test.txt", "rewrite", "2", "example text")
    what is doing: it will rewrite line 2 of file to "example text"
    output: nothing

     

    Erasing:

    
    
    
    code: manage_file("/locale/test/test.txt", "erase", "3", "")
    what is doing: it will erase line 3 of file to "example text"
    output: nothing
    Ps: when you erase a line the code will automaticly move all lines up for example if i erase line 1, my line 2 will be my line 1 now.
    

     

     

     

     

    • Here is the function:
    Spoiler

     

    
    
    
    --This function was made by Frozen
    --arguments: path of the file, type, line, text
    
    function manage_file(filename, ctype, line, value)
    
        if type(value) ~= "string" then  return end
    
        local file = io.open(filename, "r")
        if not file then
            if sType == "create" then
                local file = io.open(filename, "w")
                file:write("")
                file:close()
            else return end
        end
    
        local sType = ctype
        local Nline = 0
        local bAllLines = line == "all"
    
    
        if not tonumber(line) and not bAllLines then return end
    
        Nline = tonumber(line)
    
        if sType == "add" then
            local file = io.open(filename, "a")
            file:write(value, "\n")
    
    
        elseif sType == "rewrite" or sType == "erase" or sType == "read" then
            local ltable = {}
    
            for i in file:lines() do table.insert(ltable, i) end
    
            if sType == "read" then
                if bAllLines then return ltable
                else return ltable[line] end
            end
    
            file = io.open(filename, "w+")
    
            if line == "-1" then Nline = table.getn(ltable) end --last line
            if ltable[Nline] == nil and not bAllLines then return end
    
            if sType == "rewrite" then
                if bAllLines then file:write(value, "\n")
                else
                    ltable[Nline] = value
                    for idx, v in ipairs(ltable) do file:write(v, "\n") end
                end
    
            elseif sType == "erase" then
                if bAllLines then file:write("")
                else
                    for idx, v in ipairs(ltable) do
                        if idx ~= Nline then file:write(v, "\n") end
                    end
                end
            end
    
        else return end
    
        file:close()
    
    end

     

    Aditional Information:

    1. You can put in line "all" , and the function will erase/add/rewrite all lines.
    2. You can put in line "-1" and it will count as the last line of the file.
    3. Types: "add", "create", "erase", "rewrite" and "read".

    I hope it will be usefull :) ,

    Kind Regards,

    Frozen

    • Good 2
    • Love 14
  8. Hello, does somewone know how to load uiscripts from a python loader?

    Everytime i try to run a uiscript, it runs but nothing appears in screen. But if i call the IsShow() function it tells me that the window is show.

    Anywone have any idea how to make it work?

     

    Thanks for the attention,

    Kind Regards

    I didnt mean to spam the button was stuck i just clicked a few times D: the page was loading and nothing was appearing and i dont know how to delete topics im really sorry.

  9. 7 minutes ago, avertuss said:

    But I need a function that spawns item on which coordinates with the owner.

    This should work:

    Spoiler

     

    
    int game_drop_map(lua_State* L)
        {
            if (lua_isnumber(L, 1))
            {
                const char * playername = lua_tostring(L, 1);
    			LPCHARACTER ch = CHARACTER_MANAGER::instance().FindPC(playername);
            }else{
    			sys_err("Need to have player name in first argument!");
    			return 0
    		}
    
            LPITEM item = NULL;
    
            PIXEL_POSITION pos;
    
            long kordx = 0;
            long kordy = 0;
    
            // Id Itemu
            if (lua_isnumber(L, 2))
            {
                item = ITEM_MANAGER::instance().CreateItem((DWORD)lua_tonumber(L, 1));
            }
            //Kord x
            if (lua_isnumber(L, 3))
            {
                kordx = ((DWORD)lua_tonumber(L, 3));
            }
            // kord y
            if (lua_isnumber(L, 4))
            {
                kordy = ((DWORD)lua_tonumber(L, 4));
            }
            
    
            pos.x = kordx;
            pos.y = kordy;
    
            item->AddToGround(ch->GetMapIndex(), pos);
            item->StartDestroyEvent();
            item->SetOwnership(ch);
    
            return 0;
        }

     

     

     

     

    Kind Regards,

    Frozen

     

  10. try this, im not sure it will work:

    Spoiler


    
    quest pet_system begin
        state start begin
            function get_pet_info(itemVnum)
                pet_info_map = {
                    [53001] = {34033, "pet1", 0},
                    [53002] = {34031, "pet2", 0},
                    [53003] = {34003, "pet3", 0},
                    [53005] = {34004, "pet4", 1},
                    [53006] = {34009, "pet5", 1},
                    [53007] = {34010, "pet6", 0},
                    [53008] = {34011, "pet7", 0},
                    [53009] = {34012, "pet8", 0},
                    [53010] = {34008, "pet9", 0},
                    [53011] = {34007, "pet10", 0},
                    [53012] = {34005, "pet11", 0},
                    [53013] = {34006, "pet12", 0},
                    [53014] = {34031, "pet13", 0},
                    [53016] = {34033, "pet14", 0},
                }
                itemVnum = tonumber(itemVnum)
                return pet_info_map[itemVnum]
            end
            function get_spawn_effect_file(idx)
                effect_table = {
                    [0] = nil,
                    [1] = "d:\\\\ymir work\\\\effect\\\\etc\\\\appear_die\\\\npc2_appear.mse",
                }
                return effect_table [idx]
            end
            when login with pc.getqf('summoned') > 0 begin
                timer('pet_time', 15)
            end
            when 53001.use or 53002.use or 53003.use or 53005.use or 53006.use or 53007.use or 53008.use or 53009.use or 53010.use or 53011.use or 53012.use or 53013.use or 53014.use or 53016.use begin
                local pet_info = pet_system.get_pet_info(item.vnum)
                if null != pet_info then
                    local mobVnum = pet_info[1]
                    local petName = pet_info[2]
                    local spawn_effect_file_name = pet_system.get_spawn_effect_file(pet_info[3])
                    if true == pet.is_summon(mobVnum) then
                        if spawn_effect_file_name != nil then
                            pet.spawn_effect (mobVnum, spawn_effect_file_name)
                        end
                        pet.unsummon(mobVnum)
                    else
                        if pet.count_summoned() < 1 or pc.is_gm() then
                            pet.summon(mobVnum, " ".. petName, false)
                            pc.setqf('summoned_pet', mobVnum)
                            pc.setqf('pet_name', petName)
                            pc.getqf('summoned', 1)
                        else
                            syschat("Too much pets.")
                        end
                        if spawn_effect_file_name != nil then
                            pet.spawn_effect(mobVnum, spawn_effect_file_name)
                        end
                    end
                end
            end
    
            when pet_time.timer begin
                pet.summon(pc.getqf('summoned_pet'), pc.getqf('pet_name'), false)
            end
        end
    end

     


     

     

  11.  

    when login with pc.getqf("summoned_pet") > 0 begin
                pet.summon(pc.getqf("summoned_pet"), pc.getqf("pet_name"), false)
            end
            when 53001.use or 53002.use or 53003.use or 53005.use or 53006.use or 53007.use or 53008.use or 53009.use or 53010.use or 53011.use or 53012.use or 53013.use or 53014.use or 53016.use begin
                local pet_info = pet_system.get_pet_info(item.vnum)
                if null != pet_info then
                    local mobVnum = pet_info[1]
                    local petName = pet_info[2]
                    local spawn_effect_file_name = pet_system.get_spawn_effect_file(pet_info[3])
                    if true == pet.is_summon(mobVnum) then
                        if spawn_effect_file_name != nil then
                            pet.spawn_effect (mobVnum, spawn_effect_file_name)
                        end
                        pet.unsummon(mobVnum)
                    else
                        if pet.count_summoned() < 1 or pc.is_gm() then
                            pet.summon(mobVnum, " ".. petName, false)
                            pc.setqf("summoned_pet", mobVnum)
                            pc.setqf("pet_name", petName)
                        else
                            syschat("Too much pets.")
                        end
                        if spawn_effect_file_name != nil then
                            pet.spawn_effect(mobVnum, spawn_effect_file_name)
                        end
                    end
                end
            end
    
     

    replace with this

  12.  

    quest spawnpet_after_tp begin
    	state start begin
    		
    		when pet_item_vnum.use begin
    			local pet_list = {[pet_item_vnum] = {mobvnum, petname}}
    			local mobvnum = pet_list[item.vnum][1]
    			local pet_name = pet_list[item.vnum][2]
    			pc.setqf('summoned_pet', mobvnum)
    			pc.setqf('pet_name', pet_name)
    			pet.summon(mobvnum, pet_name, false)
    		end
    		when login with pc.getqf('summoned') > 0 begin pet.summon(pc.getqf('summoned_pet'), pc.getqf('pet_name'), false) end
    	end
    end

    This is just a basic pet quest example. You need to adapt it to your quest

     

     

     

    • Love 1
  13. 17 hours ago, qMentosan said:

    If i put the items on me , and then when i take off the items there appears "new"

    Sorry for my english

    A, when i logout or change caracter the symbol still appears

    I made a update solving that bug, go check.

    Ps: the update only solves changing character and logging out not exiting.

  14. 5 hours ago, WhoIsNice said:

    Try this way, put some items in the first inventory and other items in the second inventory, pass the mouse over the items to disappear the symbol (inventory one and two), now log out with the second inventory open. Log in and look to see if it shows up again the symbol

    Oh i see, the problem there is that when you logout the client send server your items and make all the items new again.

    So the only solution i find here is:

    1. I rewrite the hole code and define a new boolean variable (isNew) in item class, so it will be more simple ot work with it, but also more difficult.
    2. The other solution is to clear new items list when logout.

    The first one has the advantage to see the new items even tho you logged out and login again.

    The second one has a disadvantage that is if you logout there will be no longer new items.

    If somewone knows another solution please post.

    I need the opinion of you guys, is a big deal if you cant see your new items after you logged out?

     

    If you want clear new items after change character or logout:

    Spoiler

     

    Go to uiinventory.py

    Serch for:

    
    class InventoryWindow(ui.ScriptWindow):
    
    under that you will see this function:
    
    
    def __init__(self):

    add after ui.ScriptWindow.__init__(self) :

    
    constInfo.NEWITEMS = []
    
    
    
     

    #EDIT

    I found here a solution to keep the right new items only when you logout or change character. If you exit game it will clean.

    If you want to keep the new items when change character or logout:

    Spoiler

    Go to uiinventory.py

    Search for:

    
    class InventoryWindow(ui.ScriptWindow):
    
    under that you will see this function:
    
    
    def __init__(self):

    add after ui.ScriptWindow.__init__(self) :

    
    constInfo.NEWITEMS = constInfo.SAVENEWITEMS

    Save it.

    Goto constInfo.py

    add:

    
    SAVENEWITEMS = []
    
    Save it.

    Goto uisystem.py

    search for:

    
    def __ClickChangeCharacterButton(self):
    
    
     

    add under self.Close():

    
    constInfo.SAVENEWITEMS = constInfo.NEWITEMS
    del constInfo.NEWITEMS
    
    search for:
    
    
    def __ClickLogOutButton(self):
    
    replace with
    
    
    def __ClickLogOutButton(self):
    	self.Close()
    	constInfo.SAVENEWITEMS = constInfo.NEWITEMS
    	del constInfo.NEWITEMS
    	net.LogOutGame()
    
    
     

    Kind Regards,

    Frozen

    • Love 2
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.