• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ HD Level Design Contest #1 POLL is now OPEN! Check out the stunning visuals of the final entries. 🔗Click here to cast your vote!

Change Hero String + Looking for Out of Range system

Status
Not open for further replies.

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,171
It is impossiable to change a heroe's name ingame sadly. Many have tried but all have failed in finding a decent method of doing it.

As for the system, please describe in more detail as I last played that map over a year ago and I am sure many people have not played it at all.
 
Level 24
Joined
Nov 9, 2006
Messages
2,558
Ok i got the system here, thats in NvS legends (got the map unprot.).
Its made by chuckles:
JASS:
function Attack_IsOutOfRange takes unit attacked, unit attacker returns boolean
  local string name = GetObjectName(GetUnitTypeId(attacker))
  local real range
  local real dist = SquareRoot((GetUnitX(attacker) - GetUnitX(attacked)) * (GetUnitX(attacker) - GetUnitX(attacked)) + (GetUnitY(attacker) - GetUnitY(attacked)) * (GetUnitY(attacker) - GetUnitY(attacked)))
  set name = SubString(name,4,7)
  set range = S2R(name) * 2
  //call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10,"Range: "+R2S(range)+"\nDistance: "+R2S(dist))
  return dist > range
endfunction

function Attack_RangeCheck takes nothing returns nothing
  local unit damaged = GetTriggerUnit()
  local unit damager = GetEventDamageSource()
  local real life = GetUnitState(damaged,UNIT_STATE_LIFE)
  
  //Now we find out if the unit is out of range
  if Attack_IsOutOfRange(damaged,damager) and IsUnitType(damager,UNIT_TYPE_MELEE_ATTACKER) then
    call AddAbilityTimed(damaged,'A01Y',1,0)
    call ResetLifeToVal(damaged,life)
    call AddFadingTextTag("missed",GetUnitX(damager),GetUnitY(damager),255,0,0,255)
  endif
  //Boobs - ( . Y . )
  set damaged = null
  set damager = null
endfunction

//===========================================================================
function InitTrig_Out_of_Range_Attacks takes nothing returns nothing
  call GenericDamage_QueueFuncByAttack("Attack_RangeCheck")
endfunction

Heres the errors i get with jass helper (All of em are saying Undeclared function thingy):

call AddAbilityTimed(damaged , 'A01Y' , 1 , 0)
call ResetLifeToVal(damaged , life)
call AddFadingTextTag("missed" , GetUnitX(damager) , GetUnitY(damager) , 255 , 0 , 0 , 255)
call GenericDamage_QueueFuncByAttack("Attack_RangeCheck")

I found out the trigger also requires a spell based of with name "Life Bonus - OutOfRange (Least)" and it has max life gained 10000.
As for other values they are absolutely 0 and the spell is an item.

If you can help me plz keep it simple, im quite noob in jass, but i do know a little at least! :)

Dont ask me about the boob parts btw...
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,171
You basically have to include those functions in your map header so they exist in your map.

Simply copy them since you have a legitimate unprotected version and paste them in your map script header (ofcourse giving credits for the orignal makers of the system).
 
Status
Not open for further replies.
Top