• 🏆 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] custom script help

Status
Not open for further replies.
Level 4
Joined
Apr 30, 2007
Messages
62
Hello can someone help my with a a custom scipt. i dont know how to change the location. This is the trigger and REVIVE is the name of the lacation.
JASS:
 call ReviveHeroLoc(OURHERO, GetRectCenter(gg_rct_REVIVE, true)
this trigger is wrong coz it shows errors.
 
Last edited by a moderator:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Simply add this to you jass trigger.

JASS:
local location l = GetRectCenter(gg_rct_REVIVE)
call ReviveHeroLoc(OURHERO,l,true)
call RemoveLocation(l)
set l = null

You basicly did not close your call and gave the boolean to the wrong function.

If you are using GUI (not recomended), you need to put the local before any actions in the actions part of the trigger or it will fail syntax. The other 3 lines can be called directly after each other.
 
Level 11
Joined
Jul 12, 2005
Messages
764
If you use a location, whether or not it is a global or a local, it will leak if you use it without removing it.
He is talking about storing the location at map init, and use that location everywhere instead of GetRectCenter(..). You don't have to remove this (single) leak, as you use it over and over again as a global. You do not create new locations to that variable, so you don't have to remove it. UnMi is right, this is a good way to optimize triggers that use the same point on each run. It's true that it'll leave one leak per location, but that does not matter...
 
Level 4
Joined
Apr 30, 2007
Messages
62
this is mine trigger

  • function Trig_revive_Actions takes nothing returns nothing
    • local timerdialog WINDOW
    • local integer HEROWAIT
    • local timer OURTIMER
    • local unit OURHERO
    • set OURHERO = GetDyingUnit()
    • set HEROWAIT = ( GetHeroLevel(OURHERO) )
    • set OURTIMER = CreateTimer()
    • call StartTimerBJ( OURTIMER, false, ( I2R(HEROWAIT) ))
    • call CreateTimerDialogBJ ( OURTIMER, GetPlayerName(GetOwningPlayer(OURHERO)) )
    • set WINDOW = GetLastCreatedTimerDialogBJ()
    • call TimerDialogDisplayForPlayerBJ( true, WINDOW, GetOwningPlayer(OURHERO) )
    • call PolledWait( HEROWAIT )
    • call ReviveHeroLoc(OURHERO, GetRectCenter(gg_rct_REVIVE, true)
    • call PanCameraToTimedLocForPlayer( GetOwningPlayer(OURHERO), GetUnitLoc(OURHERO), 0.60 )
    • call DestroyTimerDialog(WINDOW)
  • endfunction
and this dont work
  • call ReviveHeroLoc(OURHERO, GetRectCenter(gg_rct_REVIVE, true)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Your opening 2 functions befor closing 1. GUI actions by default open a function, and you open another function.

And why are you using GUI? Switch over to pure JASS since it is easier to work with text and you can write triggers more efficently.

Also I recomend you look at one of our many jass tutorials to get some good starting jass know how before atempting anything with JASS.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
this is mine trigger

  • function Trig_revive_Actions takes nothing returns nothing
    • local timerdialog WINDOW
    • local integer HEROWAIT
    • local timer OURTIMER
    • local unit OURHERO
    • set OURHERO = GetDyingUnit()
    • set HEROWAIT = ( GetHeroLevel(OURHERO) )
    • set OURTIMER = CreateTimer()
    • call StartTimerBJ( OURTIMER, false, ( I2R(HEROWAIT) ))
    • call CreateTimerDialogBJ ( OURTIMER, GetPlayerName(GetOwningPlayer(OURHERO)) )
    • set WINDOW = GetLastCreatedTimerDialogBJ()
    • call TimerDialogDisplayForPlayerBJ( true, WINDOW, GetOwningPlayer(OURHERO) )
    • call PolledWait( HEROWAIT )
    • call ReviveHeroLoc(OURHERO, GetRectCenter(gg_rct_REVIVE, true)
    • call PanCameraToTimedLocForPlayer( GetOwningPlayer(OURHERO), GetUnitLoc(OURHERO), 0.60 )
    • call DestroyTimerDialog(WINDOW)
  • endfunction
and this dont work
  • call ReviveHeroLoc(OURHERO, GetRectCenter(gg_rct_REVIVE, true)

PurplePoot said:
Should have a closing bracked after gg_rct_REVIVE. And super, I know that trigger, OURHERO is a local
JASS:
call ReviveHeroLoc(OURHERO, GetRectCenter(gg_rct_REVIVE),  true)
That should work

PurplePoot said:
Even better...
JASS:
call ReviveHero(OURHERO,GeRectCenterX(gg_rct_REVIVE),GetRectCenterY(gg_rct_REVIVE),true)
He was just asking why that wasn't compiling ><

o_O Please read a bit more next time, Ultimatus
 
Status
Not open for further replies.
Top