Ресурс мобов/Resources NPC

12082 теперь. о_О

Ты точно SetMaxPower добавил в ядро?

Ну да

Тоесть ты сам неуверен? Или Тринити чего опять намутила.

https://github.com/TrinityCore/TrinityCore/commit/bba7b6a554c3be59edc2a9b520e5ba132b0efc52

Глянь на это. Может это подскажет чего.

Set Health. в SmartScriptMgr.cpp?

Нет, также как добавлял [COLOR=rgb(39,42,52)]SMART_ACTION_SET_MAX_POWER - также добавляй и SetHealth.

На гитхаб выкладывать уже не вижу смысла. Там такое не будут рассматривать.

так?

src/server/game/AI/SmartScripts/SmartScriptMgr.h

					[546](https://github.com/TrinityCore/TrinityCore/blob/0c113b8731dc397f4ad30d375fd8be5f180d5728/src/server/game/AI/SmartScripts/SmartScriptMgr.h#L546)
				
				
					SMART_ACTION_SUMMON_CREATURE_GROUP = [COLOR=rgb(0,134,179)]107, [COLOR=rgb(150,152,150)]// Group, attackInvoker
				
			
					[547](https://github.com/TrinityCore/TrinityCore/blob/0c113b8731dc397f4ad30d375fd8be5f180d5728/src/server/game/AI/SmartScripts/SmartScriptMgr.h#L547)
				
				
					SMART_ACTION_SET_HEALTH = [COLOR=rgb(0,134,179)]108, [COLOR=rgb(150,152,150)]// Smart Action set health

C++

	[src/server/game/AI/SmartScripts/SmartScriptMgr.cpp](https://github.com/TrinityCore/TrinityCore/blob/0c113b8731dc397f4ad30d375fd8be5f180d5728/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp) 


		
						[1091](https://github.com/TrinityCore/TrinityCore/blob/0c113b8731dc397f4ad30d375fd8be5f180d5728/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp#L1091)
					
					
						[COLOR=rgb(167,29,93)]if (![COLOR=rgb(0,134,179)]IsMinMaxValid(e, e.[COLOR=rgb(51,51,51)]action.[COLOR=rgb(51,51,51)]randTimedActionList.[COLOR=rgb(51,51,51)]entry1, e.[COLOR=rgb(51,51,51)]action.[COLOR=rgb(51,51,51)]randTimedActionList.[COLOR=rgb(51,51,51)]entry2))
					
				
						[1092](https://github.com/TrinityCore/TrinityCore/blob/0c113b8731dc397f4ad30d375fd8be5f180d5728/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp#L1092)
					
					
						[COLOR=rgb(167,29,93)]return [COLOR=rgb(0,134,179)]false;
					
				
						[1093](https://github.com/TrinityCore/TrinityCore/blob/0c113b8731dc397f4ad30d375fd8be5f180d5728/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp#L1093)
					
					
						[COLOR=rgb(167,29,93)]break;
					
				
						[1094](https://github.com/TrinityCore/TrinityCore/blob/0c113b8731dc397f4ad30d375fd8be5f180d5728/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp#L1094)
					
					
						}
					
				
						[1095](https://github.com/TrinityCore/TrinityCore/blob/0c113b8731dc397f4ad30d375fd8be5f180d5728/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp#L1095)
					
					
						[COLOR=rgb(167,29,93)]case [I]SMART_ACTION_SET_POWER[/I]:
					
				
						[1096](https://github.com/TrinityCore/TrinityCore/blob/0c113b8731dc397f4ad30d375fd8be5f180d5728/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp#L1096)
					
					
						[COLOR=rgb(167,29,93)]case SMART_ACTION_SET_HEALTH:
					
				


C++

	

	[src/server/game/AI/SmartScripts/SmartScript.cpp](https://github.com/TrinityCore/TrinityCore/blob/0c113b8731dc397f4ad30d375fd8be5f180d5728/src/server/game/AI/SmartScripts/SmartScript.cpp) 

struct

    {
		            uint32 healthpoint;
		            uint32 healthpointmod;
		            int32 healthpointpercent;
		        } sethealthpointorpercent;
	

	case SMART_ACTION_SET_HEALTH:
		        {
		            ObjectList* targets = GetTargets(e, unit);
		            if (!targets)
		                break;

        for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
		            {
		                if (IsUnit(*itr))
		                {
		                    if (e.action.sethealthpointorpercent.healthpointmod == 0)
		                    {
		                        int32 healthpct = int32(e.action.sethealthpointorpercent.healthpointpercent);
		                        (*itr)->ToUnit()->ModifyHealth(int32((*itr)->ToUnit()->CountPctFromMaxHealth(healthpct)));
		                    }
		                    else if (e.action.sethealthpointorpercent.healthpointmod == 1)
		                    {
		                        int32 missingHealth = int32((*itr)->ToUnit()->GetMaxHealth() - (*itr)->ToUnit()->GetHealth());
		                        (*itr)->ToUnit()->ModifyHealth(missingHealth);
		                    }
		                    else if (e.action.sethealthpointorpercent.healthpointmod == 2)
		                        (*itr)->ToUnit()->SetHealth(me->GetHealth());
		                    else if (e.action.sethealthpointorpercent.healthpointmod == 3)
		                        me->SetHealth((*itr)->ToUnit()->GetHealth());
		                    else if (e.action.sethealthpointorpercent.healthpointmod == 4)
		                        (*itr)->ToUnit()->SetMaxHealth(me->GetMaxHealth());
		                    else if (e.action.sethealthpointorpercent.healthpointmod == 5)
		                        me->SetMaxHealth((*itr)->ToUnit()->GetMaxHealth());
		                    else if (e.action.sethealthpointorpercent.healthpointmod == 6)
		                    {
		                        uint32 health = uint32(e.action.sethealthpointorpercent.healthpoint);
		                        (*itr)->ToUnit()->SetMaxHealth(health);
		                    }
		                    else if (e.action.sethealthpointorpercent.healthpointmod == 7)
		                    {
		                        uint32 health = uint32(e.action.sethealthpointorpercent.healthpoint);
		                        (*itr)->ToUnit()->SetHealth(health);
		                    }
		                    else
		                    {
		                        TC_LOG_ERROR("sql.sql", "SmartScript: Invalid type for SMART_ACTION_SET_HEALTH, skipping");
		                        break;
		                    }
		                }
		            }
		            delete targets;
		            break;
		        }

SmartScriptMgr.h для примера. Смотри последнее число и используй по аналогии.

https://github.com/Ulduar/TrinityCore/commit/1bf03ddb7a755095cbebacd07324f96029dbbba0

SmartScriptMgr.cpp

https://github.com/Ulduar/TrinityCore/commit/8d969796bf65fa118cb0a1b9ee80fa29ca473869

Это для валидности - чтобы ядро знало, что эта команда существует.

https://github.com/Ulduar/TrinityCore/commit/5e4cb457c5d566b6ebd57737fdd1fa4fadbc7bfa

Сама команда и принцип действия.

Как успехи?

Пока все норм, теперь как проверить?)

Проверь на каком-нибудь мобе. На Каззаке например.

а вообще щас смогу просто написать кол-во хп, без всяких расчетов или как?)

Да. [COLOR=rgb(51,51,51)]healthpointmod[COLOR=rgb(51,51,51)] == [COLOR=rgb(0,134,179)]6 позволяет менять хп и мобу, но и игроку тоже! Я с помощью команды .npc add temp при логине в игру меняю максимальное значение себе на 10000000 хп.

Призываю custom npc. Добавляю ему SAI. А с помощью .npc add temp вызываю его и он скриптом меняет мне хп.

healthmodifer напишу 200к и появится 200к?))

healthmodifer это в creature_template. Я же говорю про SmartAI.

так еще и не понял как проверить :frowning:

http://paste2.org/K6Z44Kgt

Вместо 102000 поставь номер своего нпц.

117 - номер команды. Но у тебя в ядре может быть другое число. Смотри в скомпилированных исходниках номер в SmartScriptMgr.h

Вот тебе ссылка сверху. Так и неизвестно, что за затруднения у тебя это вызывает.

80 хп у нее.

У кого у неё. Покажи скрипт хоть свой.