Jump to content

Evor

Inactive Member
  • Posts

    84
  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    0%

Posts posted by Evor

  1. Try that:

    quest regenbogen begin
    	state start begin
    		when 50512.use begin
    			local job_name = {
    				[0] = {"Arahan","Partisan"},
                    [1] = {"Ninja","Archer"},
                    [2] = {"Black Magic","Mirage"},
                    [3] = {"Lighting","Dragon"},
    			}
    			local skill_index = {
    				[0] = {
    					[1] = {1,2,3,4,5},
    					[2] = {16,17,18,19,20},
    				},
    					 
    				[1] = {
    					[1] = {31,32,33,34,35},
    					[2] = {46,47,48,49,50},
    				},
    					 
    				[2] = {
    					[1] = {76,77,78,79,80,81},
    					[2] = {61,62,63,64,65,66},
    				},
    				 
    				[3] = {
    					[1] = {106,107,108,109,110,111},
    					[2] = {91,92,93,94,95,96},
    				},
    			}
    			say_title("Rainbow Stone")
    			say("")
    			say("Choose your class!")
    			local a = select(job_name[pc.get_job()][1], job_name[pc.get_job()][2], "Cancel")
    			if tonumber(a) != 3 or tonumber(a) != 0 then
                                 return
                            else
    				say_title("Your skillpath was changed succesfully!")
    				pc.set_skill_group(tonumber(a))
    				for i=1, table.getn(skill_index[pc.get_job()][tonumber(a)]) do
    					pc.set_skill_level(skill_index[pc.get_job()][tonumber(a)][i],59)
    				end
    				item.remove()
    				say("Now, your skills are on the Perfect Master Level!")
    				say("Good luck!")
    			end
    		end
    	end
    end

     

  2. There is a mistake [1] = {"Ninja","Archer","Close",},
    it should be without a comma like:

    quest regenbogen begin
        state start begin
            when 50512.use begin
                local data = {
                    [0] = {
                        [1] = {1,2,3,4,5},
                        [2] = {16,17,18,19,20},
                    },
                     
                    [1] = {
                        [1] = {31,32,33,34,35},
                        [2] = {46,47,48,49,50},
                    },
                     
                    [2] = {
                        [1] = {76,77,78,79,80,81},
                        [2] = {61,62,63,64,65,66},
                    },
                     
                    [3] = {
                        [1] = {106,107,108,109,110,111},
                        [2] = {91,92,93,94,95,96},
                    },
                     
                    ["classNames"] = {
                        [0] = {"Arahan","Partisan","Close"},
                        [1] = {"Ninja","Archer","Close"}, -- there was no needed comma 
                        [2] = {"Black Magic","Mirage","Close"},
                        [3] = {"Lighting","Dragon","Close"},
                    },
                }
                 
                say_title("Rainbow Stone:")
                say("")
                --
                say("Choose your class")
                local s = select_table(data["classNames"][pc.get_job()])
                if(s >= table.getn(data["classNames"][pc.get_job()])) then
                    return
                end
                pc.set_skill_group(s)
                for i = 1,table.getn(data[pc.get_job()][s]),1 do
                    pc.set_skill_level(data[pc.get_job()][s][i],59)
                end
                pc.remove_item(50512,1)
                say_yellow("Your skills are now perfect.. ")
            end
        end
    end

    Hope it works!

    • Love 1
  3. Hello.
    I want to write the new trigger function called "hit".

    I was basically looking at "kill" triggering, but i place 

    quest::CQuestManager::instance().Hit(pkAttacker->GetPlayerID(), pkVictim->GetRaceNum());

    in battle.cpp.
    Also i write some sys_log information to trigger when the function is executed etc.

    Everything seems to be same as kill, but

    when kill begin - works fine

    when hit begin - doesn't work ;/

     

    So my code:


    QuestManager.cpp
    	void CQuestManager::Hit(unsigned int pc, unsigned int npc){
    		PC * pPC;
    		sys_log(0, "CQuestManager::HIT QUEST_HIT_EVENT (pc=%d, npc=%d)", pc, npc);
    		if ((pPC = GetPC(pc))){
    			if (!CheckQuestLoaded(pPC))
    				return;
    			m_mapNPC[npc].OnHit(*pPC);
    		}
    		else
    			sys_err("QUEST: no such pc id : %d", pc);
    
    	}

    QuestNpc.cpp

    	bool NPC::OnHit(PC& pc)
    	{
    		sys_log(0,"NPC::OnHit QUEST_HIT_EVENT PC: %d",pc);
    		if (m_vnum)
    		{
    			//PROF_UNIT puOnKill1("onk1");
    			//return HandleEvent(pc, QUEST_HIT_EVENT);
    			sys_log(0,"NPC::OnHit HandleEvent PC: %d, QUEST_HIT_EVENT",pc);
    			return HandleEvent(pc, QUEST_HIT_EVENT);
    		}
    		else
    		{
    			//PROF_UNIT puOnKill2("onk2");
    			//return HandleReceiveAllEvent(pc, QUEST_HIT_EVENT);
    			sys_log(0,"NPC::OnHit HandleReceiveAllEvent PC: %d, QUEST_HIT_EVENT",pc);
    			return HandleReceiveAllEvent(pc, QUEST_HIT_EVENT);
    		}
    	}

    Ofc. i add QUEST_HIT_EVENT to quest.h and 

    m_mapEventName.insert(TEventNameMap::value_type("hit", QUEST_HIT_EVENT)); 

    to questmanager.cpp.


    Help me :D
    Thanks in advance!

    PS. My quest

    -- EVOR TESTUJE  FUNKCJE npc.
    
    quest npc_function begin
    	state start begin
    		when hit begin
    			chat("test") -- that dosen't work ;/
    		end
    		when kill begin
    			chat("test kill") -- that works just fine
    		end
    	end
    end
    
    

    PS2. Syslog:

    Feb 16 14:16:01.660000 :: [TEST_SERVER] Attack : EvorTest type 0, MobBattleType 0
    Feb 16 14:16:01.660000 :: battle_melee_attack : [EvorTest] attack to [Głodny Wilk]
    Feb 16 14:16:01.660000 :: battle_melee_attack : [EvorTest] attack to [Głodny Wilk]
    Feb 16 14:16:01.660000 :: battle_melee_attack : [EvorTest] attack to [Głodny Wilk]
    Feb 16 14:16:01.660000 :: battle_hit : [EvorTest] attack to [Głodny Wilk] : dam :175 type :244485752
    Feb 16 14:16:01.660000 :: CQuestManager::HIT QUEST_HIT_EVENT (pc=58855, npc=172)
    Feb 16 14:16:01.660000 :: NPC::OnHit QUEST_HIT_EVENT PC: 798260784
    Feb 16 14:16:01.660000 :: NPC::OnHit HandleReceiveAllEvent PC: 798260784, QUEST_HIT_EVENT
    Feb 16 14:16:01.660000 :: Click Quest : MatchingQuest
    Feb 16 14:16:01.660000 :: Powinnno wytrigerować hit
    Feb 16 14:16:01.660000 :: Bonus Exp : Ramadan Candy: 0 MallExp: 0 PointExp: 0
    Feb 16 14:16:01.660000 :: CQuestManager::Kill QUEST_KILL_EVENT (pc=58855, npc=172)
    Feb 16 14:16:01.660000 :: NPC::OnKill HandleReceiveAllEvent PC:798260784
    Feb 16 14:16:01.660000 :: Click Quest : MatchingQuest
    Feb 16 14:16:01.660000 :: Click Quest : MatchingQuest
    Feb 16 14:16:01.676000 :: NPC::OnKill HandleReceiveAllEvent PC:798260784
    Feb 16 14:16:01.676000 :: Click Quest : MatchingQuest
    Feb 16 14:16:01.676000 :: QUEST Setting flag npc_function.__status 0

×
×
  • 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.