Jump to content

Change Race [Arrows slot BUG]


Go to solution Solved by Mali,

Recommended Posts

  • Honorable Member

I hope you are disconnected when the change race

Here is a check when items loading

Find input_db.cpp - void CInputDB::ItemLoad(LPDESC d, const char * c_pData):

					if (item->CheckItemUseLevel(ch->GetLevel()) == true )

Change:

					if (item->CheckItemUseLevel(ch->GetLevel()) && item->CanUsedBy(ch))

If you don't disconnect for change race, put your race change func in here

 

  • Love 1

 

Link to comment
Share on other sites

  • Premium
26 minutes ago, Mali61 said:

I hope you are disconnected when the change race

Here is a check when items loading

Find input_db.cpp - void CInputDB::ItemLoad(LPDESC d, const char * c_pData):


					if (item->CheckItemUseLevel(ch->GetLevel()) == true )

Change:


					if (item->CheckItemUseLevel(ch->GetLevel()) && item->CanUsedBy(ch))

If you don't disconnect for change race, put your race change func in here

 

 

This is my quest:

quest schimbarasa begin
	state start begin
		when 40003.use begin
			say_title("Schimba Rasa :")
			say_verde("Salut ".. pc.get_name() ..", doresti sa schimbi rasa actuala ?")
			say("")
			say_reward("Atentie !!!")
			say_verde("Odata ce ti-ai schimbat rasa nu vei mai putea")
			say_verde("reveni la cea veche decat daca vei folosi un")
			say_verde("nou Inel !")
			say_item_vnum("40003")
			say("")
			wait ()
			say_title("Schimba rasa !")
			say_reward("Esti sigur ca vrei sa-ti schimbi rasa caracterului?")
			say("")
			local main_set = select ("Da","Nu")
			if main_set == 2 then
				return
			end
			if main_set == 1 then
				say_title("Schimba Rasa:")
				say_verde("Ce rasa ai vrea sa aiba caracterul tau ?")
				say("")
				local schimbarasa = select ("Razboinic","Ninja","Sura","Saman","Inchide")
				if schimbarasa == 1 then
					say_title("Schimba Rasa:")
					say_verde("Ce sex vrei sa aiba caracterul tau ?")
					say("")
					local sexwar = select ("Masculin","Feminin","Inchide")
					if sexwar == 1 then
						pc.polymorph("4")
						pc.change_sex()
					elseif sexwar == 2 then
						pc.polymorph("4")
						pc.change_sex()
						pc.polymorph("20032")
						pc.polymorph("1")
						pc.change_sex()
						pc.polymorph("20032")
					elseif sexwar == 3 then
						return
					end
				elseif schimbarasa == 2 then
					say_title("Schimba Rasa:")
					say_verde("Ce sex vrei sa aiba caracterul tau ?")
					say("")
					local sexninja = select ("Masculin","Feminin","Inchide")
					if sexninja == 2 then
						pc.polymorph("5")
						pc.change_sex()
					elseif sexninja == 1 then
						pc.polymorph("5")
						pc.change_sex()
						pc.polymorph("20032")
						pc.polymorph("1")
						pc.change_sex()
						pc.polymorph("20032")
					elseif sexninja == 3 then
						return
					end
				elseif schimbarasa == 3 then
					say_title("Schimba Rasa:")
					say_verde("Ce sex vrei sa aiba caracterul tau ?")
					say("")
					local sexsura = select ("Masculin","Feminin","Inchide")
					if sexsura == 1 then 
						pc.polymorph("6")
						pc.change_sex()
					elseif sexsura == 2 then
						pc.polymorph("6")
						pc.change_sex()
						pc.polymorph("20032")
						pc.polymorph("1")
						pc.change_sex()
						pc.polymorph("20032")
					elseif sexsura == 3 then
						return
					end
				elseif schimbarasa == 4 then
					say_title("Schimba Rasa:")
					say_verde("Ce sex vrei sa aiba caracterul tau ?")
					say("")
					local sexshamy = select ("Masculin","Feminin","Inchide")
					if sexshamy == 2 then 
						pc.polymorph("7")
						pc.change_sex()
					elseif sexshamy == 1 then
						pc.polymorph("7")
						pc.change_sex()
						pc.polymorph("20032")
						pc.polymorph("1")
						pc.change_sex()
						pc.polymorph("20032")
					elseif sexshamy == 3 then
						return
					end
				elseif schimbarasa == 5 then
					return
				end
				pc.removeitem(40003, 1)
			end
		end
	end
end

@Mali61

Edited by DemOnJR

plague.png.1f5de75b42146262dcd655a5a8078

Link to comment
Share on other sites

  • Honorable Member
  • Solution

polymorph isn't changing race??

 

------------------------

here is an example for real change race:

int pc_change_race(lua_State* L)
	{
		const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();

		if (!lua_isnumber(L, 1) || !ch)
			return 0;

		const BYTE race = static_cast<BYTE>(lua_tonumber(L, 1));

		if (race < 0 || race >= MAIN_RACE_MAX_NUM)
			return 0;

		ch->SetRace(race);
		ch->SetSkillGroup(0);
		ch->ClearSkill();
		ch->ClearSubSkill();
		if (ch->GetDesc())
			ch->GetDesc()->SetPhase(PHASE_SELECT);
		return 0;
	}
12 hours ago, Mali61 said:

Find input_db.cpp - void CInputDB::ItemLoad(LPDESC d, const char * c_pData):


					if (item->CheckItemUseLevel(ch->GetLevel()) == true )

Change:


					if (item->CheckItemUseLevel(ch->GetLevel()) && item->CanUsedBy(ch))

 

 

Edited by Mali61
PHASE_SELECT
  • Love 1

 

Link to comment
Share on other sites

  • Premium

@Mali61

Is working but the arrows is not unequiped when my race is changed!

  int pc_change_race(lua_State* L)
  {
    const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();

    if (!lua_isnumber(L, 1) || !ch)
      return 0;

    if (ch->GetWear(WEAR_BODY) || ch->GetWear(WEAR_WEAPON)) {
      ch->ChatPacket(CHAT_TYPE_INFO, "Unequip weapon and armor first!");
      return 0;
    }

    ch->SetRace(lua_tonumber(L, 1));
    ch->SetSkillGroup(0);
    ch->ClearSkill();
    ch->ClearSubSkill();
    ch->SetPolymorph(101);
    ch->SetPolymorph(0);
    
    ///Check items
    for (int i = 0; i < INVENTORY_MAX_NUM; ++i) {
      const LPITEM item = ch->GetInventoryItem(i);
      if (item && !item->CanUsedBy(ch)) {
        item->RemoveFromCharacter();
        ch->AutoGiveItem(item);
      }
    }
    return 0;
  }

 

Edited by DemOnJR

plague.png.1f5de75b42146262dcd655a5a8078

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



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