• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] desprate hero help needed

Status
Not open for further replies.
Level 5
Joined
Mar 21, 2007
Messages
155
hi, i am making a map with a lot of heros. i want to make a trigger that when a hero dies, a timer box window comes up, set to 20 x hero lvl. and when the hero resurects, for him to lose 2 levels. i can do this in normal GUI, but i've heared that the only way that i know how to do this, is a bad idea, the trigger could get very confuzed if more than 2 heros are dead at the same time. so , i followed his advice on jass. now i have spent 5 hours... trieing to find, A SIMPLE, GUIDE, HOW TO DO THIS!!

but in the end, i gave up. i found it hopeless! i cannot learn jass, weither its me or guides (probably me) so i am asking, on my knees, if some1, who rocks at this stuff, to make some form of trigger where a hero dies, the timer window comes up, waiting 20 x hero lvl, and when the hero revives, for him to lose 2 levels. i bet for some1 who knows how jass works they'll be thinking
*what a noob* but, for 5 hours, i cannot grasp jass:sad:. any replies would be VERY aprechiated.

p.s if some1 dose design it, could please they tell me in a simple idiot proff way, how to change the location of the revival, for diffrent kinds of heros
(i.e firehero only resurects in regoin 56, water hero only resurects in region 87 e.c.t)
 
Level 5
Joined
Mar 21, 2007
Messages
155
no no, just 1 hero per player, i don't want it any more complicated, i don't wish for any leaderboards, just a timer window to show how long untill the players hero will be revived that appears when the hero dies, and goes when the hero revives
 
Last edited:
Level 20
Joined
Apr 22, 2007
Messages
1,960
roflpwntomg

That's exactly what I was doing -.-

Here it is anyway:
JASS:
function Trig_HeroRevive_Conditions takes nothing returns boolean
    return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO)
endfunction
function Trig_HeroRevive_Actions takes nothing returns nothing
	local timer t=CreateTimer()
	local timerdialog td=CreateTimerDialog(t)
	local unit hero=GetTriggerUnit()
	call TimerDialogSetTitle(td,"Hero Revives In:")
    call TimerDialogDisplayForPlayerBJ(true,td,GetOwningPlayer(hero))
	call TimerStart(t,GetHeroLevel(hero)*20,false,null)
	call PolledWait(GetHeroLevel(hero)*20)
	call ReviveHeroLoc(hero,udg_PlayerReviveLoc[GetPlayerId(GetOwningPlayer(hero))+1],true)
	call SetHeroLevel(hero,GetHeroLevel(hero)-2,false)
	call PanCameraToLocForPlayer(GetOwningPlayer(hero),udg_PlayerReviveLoc[GetPlayerId(GetOwningPlayer(hero))+1])
	call DestroyTimerDialog(td)
	call DestroyTimer(t)
	set hero=null
	set td=null
endfunction
function InitTrig_HeroRevive takes nothing returns nothing
    set gg_trg_HeroRevive = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_HeroRevive, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_HeroRevive, Condition( function Trig_HeroRevive_Conditions ) )
    call TriggerAddAction( gg_trg_HeroRevive, function Trig_HeroRevive_Actions )
endfunction
Paste all of that code into a trigger called "HeroRevive" without the quotes. Also, since you said you wanted different respawn places for different heroes/players, you need a variable called PlayerReviveLoc of type Point, with an array size of 12. In another trigger, assign a value to PlayerReviveLoc using whatever way you want. Something like this:
  • Set PlayerReviveLoc[1] = (Center of (Playable map area))
That would be Player 1 - red's hero revive location (the index of the array variable is the player's index number).
 
Level 5
Joined
Mar 21, 2007
Messages
155
thats all soo great! tyvm!!! =D




theres just 1 tinsey wincey thing, i think it could be easy to fix though.

when i said diffrent revival locations, i ment for diffrent types of heros, not for diffrent types of players. sorry, i think that was my fault when asking for this, they way i said diffrent revival locations.
but if you could fix that (which i'm sure a genius of your calaboure could do easily) you would be the best =D
 
Level 20
Joined
Apr 22, 2007
Messages
1,960
Well I can't know exactly which heroes you use, so you'd have to do that part yourself. Like at the hero creation part, do this:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Unit-type of (Last created unit)) Equal to Archmage
    • Then - Actions
      • Set PlayerReviveLoc[(Player number of (Owner of (Last created unit)))] = (Center of (YourRegion))
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Last created unit)) Equal to Mountain King
        • Then - Actions
          • Set PlayerReviveLoc[(Player number of (Owner of (Last created unit)))] = (Center of (YourRegion))
        • Else - Actions
 
Level 5
Joined
Mar 21, 2007
Messages
155
AHHHHHHHHHHHHHHHHHHHHHHHHHHH ok big problem!! my map won't save, it says theres somthing wrong with the trigger??? what did i do wrong??

1-created a new trigger named HeroRevive
2-went into edit (with file, module, window e.c.t) and clicked on the option "convert to custom text"
3-warnings came up saying ONE YOU DO THIS, YOU CAN'T GO BACK, clicked ok
4-some mumbo jumbo came up where the jass is supose to go, deleted it
5-copied + paste ur words into the big space.
6-clicked save
7-said the trigger had to be disabled because there was errors, it found 2 errors?? invalid argument type. and it highlited the line which says to reduce the hero lvl by 2 + the line which says "destroy timerdialogue td"

sorry, i bet you its me though, i'm a total newbie-noobie noob noob with jass,
 
Level 5
Joined
Mar 21, 2007
Messages
155
o....................




yey! ur watery wisdom saved me =D it will let me enable it. just 2 questions though.....
1= theres a tick box at the top next to enable trigger which says "run on instilasation" should i tick it?
2=whats the diff between a point and a regoin?? either way i have to specify a region??
 
Level 20
Joined
Apr 22, 2007
Messages
1,960
1. Don't check Run on Initialization. Enable Trigger has to be checked though.

2. A region (or should I say, rect) is a 4 sided rectangle area determined with 4 values: x minimum, x maximum, y minimum, y maximum. A point (or should I say, location) is formed of 2 coordinates: x,y. A location can be contained inside a rect/region. If you want to make a rect for where a hero will respawn, just use "Center of (YourRectHere)" for the location.
 
Level 5
Joined
Mar 21, 2007
Messages
155
BUG ALERT! BUG ALERT!

sorry to disturb you all again, but there appears to be a bug.

everything works perfectly! i just need to perfect the loacation, but that will be no problem. but the bug is, the levels. when the hero revives, the level of the hero dose not change. i just tested the map out. i killed a lvl 5 hero, and after waiting, he revived but he was still lvl 5. this is the jass trigger, see if theres anything wrong with the way i copied + pasted it

function Trig_HeroRevive_Conditions takes nothing returns boolean
return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO)
endfunction
function Trig_HeroRevive_Actions takes nothing returns nothing
local timer t=CreateTimer()
local timerdialog td=CreateTimerDialog(t)
local unit hero=GetTriggerUnit()
call TimerDialogSetTitle(td,"Hero Revives In:")
call TimerDialogDisplayForPlayerBJ(true,td,GetOwningPlayer(hero))
call TimerStart(t,GetHeroLevel(hero)*20,false,null)
call PolledWait(GetHeroLevel(hero)*20)
call ReviveHeroLoc(hero,udg_PlayerReviveLoc[GetPlayerId(GetOwningPlayer(hero))+1],true)
call SetHeroLevel(hero,GetHeroLevel(hero)-2,false)
call PanCameraToLocForPlayer(GetOwningPlayer(hero),udg_PlayerReviveLoc[GetPlayerId(GetOwningPlayer(hero))+1])
call DestroyTimerDialog(td)
call DestroyTimer(t)
set hero=null
set td=null
endfunction
function InitTrig_HeroRevive takes nothing returns nothing
set gg_trg_HeroRevive = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_HeroRevive, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_HeroRevive, Condition( function Trig_HeroRevive_Conditions ) )
call TriggerAddAction( gg_trg_HeroRevive, function Trig_HeroRevive_Actions )
endfunction

have i done somthing wrong or did you maybe misspell somthing?? please help!!
 
Level 20
Joined
Apr 22, 2007
Messages
1,960
My fault.

Replace that code by this:
JASS:
function Trig_HeroRevive_Conditions takes nothing returns boolean
return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO)
endfunction
function Trig_HeroRevive_Actions takes nothing returns nothing
local timer t=CreateTimer()
local timerdialog td=CreateTimerDialog(t)
local unit hero=GetTriggerUnit()
call TimerDialogSetTitle(td,"Hero Revives In:")
call TimerDialogDisplayForPlayerBJ(true,td,GetOwningPla yer(hero))
call TimerStart(t,GetHeroLevel(hero)*20,false,null)
call PolledWait(GetHeroLevel(hero)*20)
call ReviveHeroLoc(hero,udg_PlayerReviveLoc[GetPlayerId(GetOwningPlayer(hero))+1],true)
call UnitStripHeroLevel(hero,2)
call PanCameraToLocForPlayer(GetOwningPlayer(hero),udg_ PlayerReviveLoc[GetPlayerId(GetOwningPlayer(hero))+1])
call DestroyTimerDialog(td)
call DestroyTimer(t)
set hero=null
set td=null
endfunction
function InitTrig_HeroRevive takes nothing returns nothing
set gg_trg_HeroRevive = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_HeroRevive, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_HeroRevive, Condition( function Trig_HeroRevive_Conditions ) )
call TriggerAddAction( gg_trg_HeroRevive, function Trig_HeroRevive_Actions )
endfunction
 
Level 5
Joined
Mar 21, 2007
Messages
155
hi, umm i think i did somthing wrong. sorry about the long reply, ma mom kicked me off comp coz it was soo late. (2.30 here)
but when i pasted that trigger, the same thing came up, that error thing. this time. it said "expected a name" and it pointed to theese 2 lines:

call TimerDialogDisplayForPlayerBJ(true,td,GetOwningPla yer(hero))
+
call PanCameraToLocForPlayer(GetOwningPlayer(hero),udg_ PlayerReviveLoc[GetPlayerId(GetOwningPlayer(hero))+1])

did i paste it wrong? or is somthing else in my other triggers wrong?
 
Level 20
Joined
Apr 22, 2007
Messages
1,960
hindy is nothing. Hindi is a language, but I don't speak it nor have I ever tried to speak it. My username is just some random thing that I said when I was like 9 years old, and I kept it...

Dunno why there were spaces there. Must've been an accident when pasting or something, because they weren't there when I tested it, and it worked fine :/

EDIT: Oh I see, it was when you posted the big bug alert, the spaces were there, and I copied that and fixed the line, but to test it, I used the old script without the spaces and fixed the line, so it worked for me in the editor. By removing the spaces, it should work fine.
 
Status
Not open for further replies.
Top