Attempting to make reincarnation revive with a % of max hp

For fulfilled maps that most likely don't work on the latest patch (1.24 or later).

Moderator: Cheaters

User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: SOLVED- make reincarnation revive with a % of max hp

Post by Aero »

Don't run either trigger on map init.
Make sure rawcodes match (And the hero actually learns the reincarnate ability).
Make sure "ReincarnationUnits" was spelled correctly.

If it's still not working, send the map over and I can debug it.
4Duck7
Newcomer
Posts: 5
Joined: November 26th, 2007, 10:23 pm

Re: Attempting to make reincarnation revive with a % of max hp

Post by 4Duck7 »

After some more testing with rogue Tauren chieftans (I did get the trigger to work with them), I'm almost certain that the cause of the problem is that the custom heroes don't actually learn the skills. The level up ability screen in this game has 4 placeholder icons that say like "Level Up Offensive/Defensive/Misc/Ultimate Skill," instead of showing the icons of the skills you actually chose at the beginning.

Here's how the author explained it in an old forum:
Basically, for my map, I set the skills you choose to variables, and then when you level up one of the dummy abilities, I add 1 to the level of that skill for your hero (obviously you only control one hero, which is also set to a variable) it's basically a bunch of arrays and some error-checking to make sure that levelling up works correctly.
Here's the relevant coding for getting reincarnation:

"buying" the skill from the shop (I01M is the rawcode for the Reincarnation item):
Spoiler:

Code: Select all

function O48711 takes nothing returns boolean
	return(GetItemTypeId(GetManipulatedItem())=='I01M')
endfunction

Code: Select all

if(O48711())then
		set udg_integers03[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))]='AOre'
	else
		call DoNothing()
	endif
And here's the process for leveling up the skill. (A008 is the placeholder icon "LevelUp Ultimate") The phrases 'Add Ability' 'Remove Abilty' and 'Unit Abilty Level Swapped,' lead me to believe that the skills aren't actually learned, but I can't really read JASS :P
Spoiler:

Code: Select all

function O50284 takes nothing returns boolean
	if(not(GetLearnedSkillBJ()=='A008'))then
		return false
	endif
	return true
endfunction

function O50298 takes nothing returns boolean
	if(not(GetUnitAbilityLevelSwapped(udg_integers03[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))],GetLearningUnit())==0))then
		return false
	endif
	return true
endfunction

function O50406 takes nothing returns boolean
	if(not(GetUnitAbilityLevelSwapped(udg_integers03[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))],GetTriggerUnit())==4))then
		return false
	endif
	return true
endfunction

function O50482 takes nothing returns boolean
	if(not(GetUnitAbilityLevelSwapped(udg_integers03[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))],GetLearningUnit())==3))then
		return false
	endif
	if(not(GetHeroLevel(GetTriggerUnit())>=24))then
		return false
	endif
	return true
endfunction

function O50534 takes nothing returns boolean
	if(not(GetUnitAbilityLevelSwapped(udg_integers03[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))],GetLearningUnit())==2))then
		return false
	endif
	if(not(GetHeroLevel(GetTriggerUnit())>=18))then
		return false
	endif
	return true
endfunction

function O50589 takes nothing returns boolean
	if(not(GetUnitAbilityLevelSwapped(udg_integers03[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))],GetLearningUnit())==1))then
		return false
	endif
	if(not(GetHeroLevel(GetTriggerUnit())>=12))then
		return false
	endif
	return true
endfunction

function O50672 takes nothing returns nothing
	if(O50298())then
		call UnitAddAbilityBJ(udg_integers03[GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))],GetTriggerUnit())
		call UnitRemoveAbilityBJ('A008',GetTriggerUnit())
		return
	else
	endif
	if(O50589())then
		call IncUnitAbilityLevelSwapped(udg_integers03[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))],GetTriggerUnit())
	else
		if(O50534())then
			call IncUnitAbilityLevelSwapped(udg_integers03[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))],GetTriggerUnit())
		else
			if(O50482())then
				call IncUnitAbilityLevelSwapped(udg_integers03[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))],GetTriggerUnit())
			else
				if(O50406())then
					call DisplayTextToForce(GetForceOfPlayer(GetOwningPlayer(GetLearningUnit())),"TRIGSTR_815")
					call UnitRemoveAbilityBJ('A008',GetTriggerUnit())
					call ModifyHeroSkillPoints(GetLearningUnit(),bj_MODIFYMETHOD_ADD,1)
					call TransmissionFromUnitWithNameBJ(GetForceOfPlayer(GetOwningPlayer(GetLearningUnit())),null,"TRIGSTR_3144",udg_sound03,"TRIGSTR_3145",bj_TIMETYPE_ADD,0,true)
					return
				else
					call DisplayTextToForce(GetForceOfPlayer(GetOwningPlayer(GetLearningUnit())),"TRIGSTR_2213")
					call UnitRemoveAbilityBJ('A008',GetTriggerUnit())
					call ModifyHeroSkillPoints(GetLearningUnit(),bj_MODIFYMETHOD_ADD,1)
					call TransmissionFromUnitWithNameBJ(GetForceOfPlayer(GetOwningPlayer(GetLearningUnit())),null,"TRIGSTR_3146",udg_sound03,"TRIGSTR_3147",bj_TIMETYPE_ADD,0,true)
					return
				endif
			endif
		endif
	endif
	call UnitRemoveAbilityBJ('A008',GetTriggerUnit())
endfunction
And here's another piece that's referenced to in there^^^
Spoiler:

Code: Select all

call TriggerRegisterAnyUnitEventBJ(udg_trigger23,EVENT_PLAYER_HERO_SKILL)
	call TriggerAddCondition(udg_trigger23,Condition(function O50284))
	call TriggerAddAction(udg_trigger23,function O50672)
I'm pretty sure that's the relevant stuff. The DisplayTexttoForce is something like "You cannot level up this ability at this time"

Sorry, I really should have looked in to this sooner. If the trigger is too much trouble to program within these paramaters, then I don't mind if you just play the old "Screw This Noob" card. Completely removing Reincarnation from the map wouldn't be too much of a bother.

Thanks for the help though!
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Attempting to make reincarnation revive with a % of max hp

Post by Aero »

Code: Select all

function RegOnDeath takes nothing returns nothing
call TriggerRegisterUnitEvent(gg_trg_Reincarnate_Percent,GetLearningUnit(),EVENT_UNIT_DAMAGED)
endfunction
call TriggerRegisterUnitEvent(gg_trg_Reincarnate_Percent,GetLearningUnit(),EVENT_UNIT_DAMAGED)

This line of code just needs to be executed for the trigger to work.
Just have it so that "GetLearningUnit()" becomes the unit who acquires the ability.

I just assumed it would be standard ability acquistion.