Jump to content
  • 0

unequip costume when change sex


Jordan
Go to solution Solved by Syreldar,

Question

Hey guys,

I'm using the following quest to change sex of characters. The problem im facing is, that when someone wear as example a male costume and change to female, the costume keep equiped.
Does someone know how to solve this problem?

Spoiler
quest item_change_sex begin
	state start begin
		when 71048.use begin 
			if pc.get_level() < 50 then 
				say_title(translate().change_empire._50_sayTitle)
				say(translate().item_change_sex._10_sayReward)
				return
			end
			
			if pc.is_engaged() then
				say_title(translate().change_empire._50_sayTitle)
				say(translate().item_change_sex._30_sayReward)
				return
			end

			if pc.is_married() then
				say_title(translate().change_empire._50_sayTitle)
				say(translate().item_change_sex._30_sayReward)
				return
			end

			if pc.is_polymorphed() then
				say_title(translate().change_empire._50_sayTitle)
				say(translate().item_change_sex._60_sayReward)
				return
			end

			if get_time() < pc.getqf("next_time") then
				say_title(translate().change_empire._50_sayTitle)
				say(translate().item_change_sex._80_sayReward)
				say(translate().item_change_sex._90_say)

				if pc.is_gm() then
					say(string.format(translate().item_change_sex._100_say, time_to_str(pc.getqf("next_time"))))
					say(translate().item_change_sex._110_say)
					local s =  select(translate().locale.guild.yes, translate().locale.guild.no)
					if s == 1 then
						say(translate().change_empire._80_say)
						pc.setqf("next_time", 0)
					end
				end
				return

			end

			say_title(translate().item_change_sex._120_sayTitle)
			say(translate().item_change_sex._130_say)
			wait()
			say_title(translate().item_change_sex._120_sayTitle)
			say(translate().item_change_sex._140_say)
			local s= select(translate().locale.guild.yes, translate().locale.guild.no)

			if 1==s then
				say_title(translate().item_change_sex._120_sayTitle)
				say(translate().item_change_sex._150_say)
				say_reward(translate().change_empire._230_sayReward)
				
				pc.remove_item("71048",1)
				pc.setqf("next_time", get_time() + 0 * 0)

				pc.change_sex()

				local m_sex = pc.get_sex()

				if m_sex == 0 then
				    char_log(0, "CHANGE_SEX", "F -> M")
				else
				    char_log(0, "CHANGE_SEX", "M -> F")
				end

			elseif 2==s then
				say(translate().item_change_sex._160_say)
			end
		end
	end
end		

 



Would appreciate some help.

Thank you!

 

Link to post

6 answers to this question

Recommended Posts

  • 0
  • Developer
  • Solution
Posted (edited)
quest item_change_sex begin
	state start begin
		when 71048.use begin
			say_title(translate().change_empire._50_sayTitle)
			if (pc.get_level() < 50) then
				return say_reward(translate().item_change_sex._10_sayReward);

			elseif (pc.get_wear(19) ~= nil) then
				return say_reward("You have to unequip your body costume first.");

			elseif (pc.is_engaged()) then
				return say_reward(translate().item_change_sex._30_sayReward)

			elseif (pc.is_married()) then
				return say_reward(translate().item_change_sex._30_sayReward)

			elseif (pc.is_polymorphed()) then
				return say_reward(translate().item_change_sex._60_sayReward)
			end -- if/elseif
		
			say(translate().item_change_sex._130_say)
			wait()
			say_title(translate().item_change_sex._120_sayTitle)
			say(translate().item_change_sex._140_say)

			if (select(translate().locale.guild.yes, translate().locale.guild.no) == 1) then
				say_title(translate().item_change_sex._120_sayTitle)
				say(translate().item_change_sex._150_say)
				say_reward(translate().change_empire._230_sayReward)
				
				pc.remove_item(71048, 1);
				pc.change_sex();
  				pc.polymorph(20032); -- So you don't need to relog.
			end -- if
		end -- when
	end -- state
end -- quest

 

Edited by Syreldar
  • Love 1

👑 Premium International Lua Developer 👑

 My service topic: https://bit.ly/2UPly54

 

Ignorant people have the obligation to compensate their ignorance by paying whoever helps them.

Syreldar

Link to post
  • 0

either source or quest, just check before the quest starts if they have something equiped in the Costume slot, If you have you cant use the item.

  • Love 1
Link to post
  • 0
45 minutes ago, ToXiC4000 said:

either source or quest, just check before the quest starts if they have something equiped in the Costume slot, If you have you cant use the item.

Can you help me to solve this please?
To be honest, i don't know who i can do this.

Link to post
  • 0
7 minutes ago, Syreldar said:
quest item_change_sex begin
	state start begin
		when 71048.use begin
			say_title(translate().change_empire._50_sayTitle)
			if (pc.get_level() < 50) then
				return say_reward(translate().item_change_sex._10_sayReward);

			elseif (pc.get_wear(19) ~= nil) then
				return say_reward("You have to unequip your body costume first.");

			elseif (pc.is_engaged()) then
				return say_reward(translate().item_change_sex._30_sayReward)

			elseif (pc.is_married()) then
				return say_reward(translate().item_change_sex._30_sayReward)

			elseif (pc.is_polymorphed()) then
				return say_reward(translate().item_change_sex._60_sayReward)
			end -- if/elseif
		
			say(translate().item_change_sex._130_say)
			wait()
			say_title(translate().item_change_sex._120_sayTitle)
			say(translate().item_change_sex._140_say)

			if (select(translate().locale.guild.yes, translate().locale.guild.no) == 1) then
				say_title(translate().item_change_sex._120_sayTitle)
				say(translate().item_change_sex._150_say)
				say_reward(translate().change_empire._230_sayReward)
				
				pc.remove_item(71048, 1);
				pc.change_sex();
  				pc.polymorph(20032); -- So you don't need to relog.
			end -- if
		end -- when
	end -- state
end -- quest

 

Thank you so much! :)

Link to post
  • 0
  • Honorable Member

alternate

static bool FN_check_item_sex(LPCHARACTER ch, LPITEM item) // char_item.cpp
{
	if (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_MALE))
		return SEX_MALE != GET_SEX(ch);

	if (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_FEMALE))
		return SEX_FEMALE != GET_SEX(ch);

	return true;
}

//Find
					if (item->CheckItemUseLevel(ch->GetLevel()) == true )
  
///Change
					if (item->CheckItemUseLevel(ch->GetLevel()) == true && FN_check_item_sex(ch, item) == true)

input_db.cpp

use with re-login function

  • Love 1

🌛

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



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