![]() | |
| | #1 |
![]() Join Date: Jun 2008
Posts: 33
![]() | respawn hero code a friend of mine gave me this code to revive heros on my orpg map, but i seem to be getting errors, it works on his map but not on mine, what am i doing wrong? this is the code:
ive included my map to show the errors. can anyone help me out? would be greatly appricieted ![]() thanks in advance, Phoenix |
| | |
| | #2 | ||
![]() Join Date: Sep 2006 Location: Denmark (GMT+1)
Posts: 2,173
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Re: respawn hero code Functions optimized and renamed for better overview (You don't need to rename the functions to one letters to save space as Vex's optimizer does that for you).
Do notice through if a hero dies while another is waiting to get revival, it will bug out and not revive the second hero. This is because of the trigger sleep.
"In the end there is no greater motivation than revenge" SO I HERD U LEIK MUDKIPZ?! Last edited by Mr. Zero; 06-25-2008 at 04:50 PM. | ||
| | |
| | #3 |
![]() Join Date: Jun 2008
Posts: 33
![]() | Re: respawn hero code dam xD ideas on fixing that trigger sleep problem? also theres a worry that it will revive enemy bosses and spawn them at the hero spawn? xD nearly there! after this i just need to figure how to make creeps spawn after death, im not much for spawn creeps every 30 seconds method, due to the fact it will lag alot if nobody kills them ![]() edit: im still geting errors :S such as : expected a name, expected a variable name and expected a function name ideas? it wont let me enable the trigger till they are sorted xD sorry to sound greedy but im terrible with jass related code :Pthanks in advance |
| | |
| | #4 |
![]() Join Date: Sep 2006 Location: Denmark (GMT+1)
Posts: 2,173
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Re: respawn hero code Make sure your trigger is called "Revive" (without quotes). It's likely you just made a copy and paste the code. ![]() The trigger sleep workaround takes some time to make so let me sleep on it (00:03 over here ) and I will get back to you. |
| | |
| | #5 |
![]() Join Date: Sep 2006 Location: Denmark (GMT+1)
Posts: 2,173
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Re: respawn hero code !! Important !! The trigger shall be called "Revival" Code: constant function Revival_BaseTime takes nothing returns real
return 30.00 // The base waiting time.
endfunction
constant function Revival_LevelMultiply takes nothing returns real
return 0.00 // Adds the heroes level to the time with a multiplier.
// E.g. return 1 will cause heroes to wait basetime + the hero's level + distance.
// Return 2 will cause basetime + hero's level * 2 + distance and so on...
endfunction
constant function Revival_DistMultiply takes nothing returns real
return 0.00 // Will add more time the futher away the hero dies from revival point.
// Return 0 will remove the add distance time.
// Return 1 will simply add the distance to the time. E.g. a unit is 400 units away from revival point means it will add 400 seconds to the time.
// So try keep it low (Like 0.002).
endfunction
constant function Revival_ShowBeam takes nothing returns boolean
return true // Show revival beam.
endfunction
constant function Revival_X takes nothing returns real
return -145.00 // X coord of revival.
endfunction
constant function Revival_Y takes nothing returns real
return -3811.00 // Y coord of revival.
endfunction
function Revival_Cond takes nothing returns boolean
return (IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) and GetPlayerController(GetOwningPlayer(GetTriggerUnit())) == MAP_CONTROL_USER)
// Is the dying unit a hero and owned by a player then return true
endfunction
function Revival_MainFunc takes nothing returns nothing
local unit hero = GetTriggerUnit() // Get dying hero
local real x = GetUnitX(hero) - Revival_X() // Get x distance from revival point to hero x.
local real y = GetUnitY(hero) - Revival_Y() // Get y distance from revival point to hero y.
local real sleepTime = Revival_BaseTime() + (Revival_LevelMultiply() * GetHeroLevel(hero)) + (Revival_DistMultiply() * SquareRoot((x * x) + (y * y))) // Basetime + ( LevelMultiplier * Hero Level ) + ( DistanceMultiplier * Distance from revival point )
call PolledWait(sleepTime)
call ReviveHero( hero, Revival_X(), Revival_Y(), Revival_ShowBeam() )
set hero = null
endfunction
function InitTrig_Revival takes nothing returns nothing
local integer index = 0
set gg_trg_Revival = CreateTrigger( )
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Revival, Player(index), EVENT_PLAYER_UNIT_DEATH, null)
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition( gg_trg_Revival, Condition( function Revival_Cond ) )
call TriggerAddAction( gg_trg_Revival, function Revival_MainFunc )
endfunction |
| | |
| | #6 |
![]() Join Date: Jun 2008
Posts: 33
![]() | Re: respawn hero code awesome ! it works fine :Pi know its not jass related but ideas on these questions, raising max level to 80 for all heros? Bounty on Spawning creeps in a zone when they have all been killed, not the time elaspse thing and then i think my maps ready for some fun ![]() thanks so much for all this help ! |
| | |
| | #7 |
![]() Join Date: Jan 2007
Posts: 44
![]() | Re: respawn hero code The level 80 thing is in "Gameplay Constants" under Advanced tab. Just change it from 10 to 80. |
| | |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Hero Ideas! | luigi_fan64 | Broken Alliances | 8 | 01-28-2008 06:51 PM |
| Some Hero Changes i would like to see | luigi_fan64 | Broken Alliances | 0 | 01-06-2008 01:17 PM |
| Unit editor basic guide | Halakbalakbalak | Submit a Tutorial [World Editor] | 1 | 10-19-2007 02:18 PM |
| Respawning + Hero Selection on Circle | DarkBlade | Tutorials | 4 | 09-07-2007 07:56 PM |
| Final Hero | Killzor2 | New Feature Requests | 15 | 12-04-2006 05:16 PM |