Jump to content
  • 0

give_basic_weapon


flygun

Question

  • Former Staff
quest give_basic_weapon begin
    state start begin
        when login with pc.get_level() <= 1 begin
            local item_vnum = 19
            local item_vnum2 = 11209
            local item_vnum3 = 12209
            if pc.get_job() == 1 then
                item_vnum = 1009
                item_vnum2 = 11409
                item_vnum3 = 12349
            elseif pc.get_job() == 2 then                
                item_vnum2 = 11609
                item_vnum3 = 12489
            elseif pc.get_job() == 3 then
                item_vnum = 7009
                item_vnum2 = 11809
                item_vnum3 = 12629
            end
            pc.give_item2(item_vnum)
            pc.give_item2(item_vnum2)
            pc.give_item2(item_vnum3)
            pc.give_item2(27003, 200)
            pc.give_item2(27006, 200)
            pc.give_item2(72702)
            pc.give_item2(71050, 20)
            pc.give_item2(70038, 20)
            pc.give_item2(13200)
            pc.give_item2(14200)
            pc.give_item2(15200)
            pc.give_item2(16200)
            pc.give_item2(17200)
            pc.give_exp(66640600)
            pc.set_skill_level ( 131 , 59 )
            horse.set_level ( 21 )
            horse.ride ()
            notice_all ( " نرحب باللاعب " .. pc . get_name ( ) .. " في ماتين 2 فيقا نتمنا لك حظا موفقا " )
            chat ( " تذكر لن يطلب منك المراقب حسابك " )
            chat ( " الرجاء الدخول الى المنتدى من وقت الى اخر للحصول على اخر اخبار اللعبه  " )
            chat ( " اذا لم يكن هناك مراقب الرجاء وضع الاستفسار في المنتدى " )
            chat ( " نتوقع منك حسن السلوك والاحترام مع الاعبين الاخرين " )  
        end
    end    
end

guys i made edit my give_basic_weapon .quest

but every time i enter the game with the same character i got items and exp and the notice 

 

i want to give items and exp to the person just once

and notice just once too

 

:/

Link to comment

5 answers to this question

Recommended Posts

  • 0

Toxic, what you did is not helpful. Well, it is, but just partially.

It's pointless to give a solution without explaining why it is a solution! That way next time the person will probably have to ask again. And if someone finds this thread and has the same doubt as the OP, the thread is way less useful.

 

Okay, so, thread-related, and for the sake of completeness, you have two easy solutions:

 

Add a quest flag

You can set a quest flag with

pc.setqf("name_of_flag", value_of_flag)

In this case, you could use something like pc.setqf("done", 1) at the end of the quest, and then a check for it at the start (right after the when)

if pc.getqf("done") != 0 then
    return
end

That way the quest would go "player logins -> the quest flag is 0, continue -> give all -> set quest flag to 1", and the next time the player logins, it will do

"player logins -> the quest flag is NOT 0, stop (return)".

 

---

Now, solution 2 (The one Toxic did), which is better, because it does not involve a quest flag.

 

Change state

Quests can have several states. State "start" is the default, which is the one you have on your quest. And when a quest is on a state, it only executes the code on that particular state.

So... if you just want for a quest to stop doing anything (and never come back), all you need is to redirect it to an empty state!

 

That's why Toxic added

state __complete begin
end

To jump to a state you have to use the set_state function, so instead of setting a flag like on the other solution, you can just do set_state("__complete")

 

Hope it's understandable enough.

Regards!

  • Love 4
Link to comment
  • 0
quest give_basic_weapon begin
    state start begin
        when login with pc.get_level() <= 1 begin
            local item_vnum = 19
            local item_vnum2 = 11209
            local item_vnum3 = 12209
            if pc.get_job() == 1 then
                item_vnum = 1009
                item_vnum2 = 11409
                item_vnum3 = 12349
            elseif pc.get_job() == 2 then                
                item_vnum2 = 11609
                item_vnum3 = 12489
            elseif pc.get_job() == 3 then
                item_vnum = 7009
                item_vnum2 = 11809
                item_vnum3 = 12629
            end
            pc.give_item2(item_vnum)
            pc.give_item2(item_vnum2)
            pc.give_item2(item_vnum3)
            pc.give_item2(27003, 200)
            pc.give_item2(27006, 200)
            pc.give_item2(72702)
            pc.give_item2(71050, 20)
            pc.give_item2(70038, 20)
            pc.give_item2(13200)
            pc.give_item2(14200)
            pc.give_item2(15200)
            pc.give_item2(16200)
            pc.give_item2(17200)
            pc.give_exp(66640600)
            pc.set_skill_level ( 131 , 59 )
            horse.set_level ( 21 )
            horse.ride ()
            notice_all ( " نرحب باللاعب " .. pc . get_name ( ) .. " في ماتين 2 فيقا نتمنا لك حظا موفقا " )
            chat ( " تذكر لن يطلب منك المراقب حسابك " )
            chat ( " الرجاء الدخول الى المنتدى من وقت الى اخر للحصول على اخر اخبار اللعبه  " )
            chat ( " اذا لم يكن هناك مراقب الرجاء وضع الاستفسار في المنتدى " )
            chat ( " نتوقع منك حسن السلوك والاحترام مع الاعبين الاخرين " )  
            set_state("__complete")
        end
    end  
    state __complete begin
   end
end
 
Link to comment
  • 0
  • Former Staff

Toxic, what you did is not helpful. Well, it is, but just partially.

It's pointless to give a solution without explaining why it is a solution! That way next time the person will probably have to ask again. And if someone finds this thread and has the same doubt as the OP, the thread is way less useful.

 

Okay, so, thread-related, and for the sake of completeness, you have two easy solutions:

 

Add a quest flag

You can set a quest flag with

pc.setqf("name_of_flag", value_of_flag)

In this case, you could use something like pc.setqf("done", 1) at the end of the quest, and then a check for it at the start (right after the when)

if pc.getqf("done") != 0 then
    return
end

That way the quest would go "player logins -> the quest flag is 0, continue -> give all -> set quest flag to 1", and the next time the player logins, it will do

"player logins -> the quest flag is NOT 0, stop (return)".

 

---

Now, solution 2 (The one Toxic did), which is better, because it does not involve a quest flag.

 

Change state

Quests can have several states. State "start" is the default, which is the one you have on your quest. And when a quest is on a state, it only executes the code on that particular state.

So... if you just want for a quest to stop doing anything (and never come back), all you need is to redirect it to an empty state!

 

That's why Toxic added

state __complete begin
end

To jump to a state you have to use the set_state function, so instead of setting a flag like on the other solution, you can just do set_state("__complete")

 

Hope it's understandable enough.

Regards!

 

thank you a lot .....

 

lol i will save your answer for me XD

 

#best answer

 

Link to comment
  • 0

The advantage of setting a new state is that it might be possible to get the items again after reloading ingame if you're still in start state.

I would solve it with a new state like toxic did.

Link to comment
  • 0
  • Former Staff

The advantage of setting a new state is that it might be possible to get the items again after reloading ingame if you're still in start state.

I would solve it with a new state like toxic did.

 

yeah i make it like toxic :)

 

but no problem with anything cus I'm still begginer and i must learn XD

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


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