it shows a message x times based on ability level

jackall

You can change this now in User CP.
Reaction score
37
these are supposed to teleport a unit x.y seconds after its been ordered to move somewhere but for some reason...
JASS:
function Trig_learn_Actions takes nothing returns nothing
    if (GetLearnedSkill() == 'A000') then
      call TriggerRegisterUnitEvent( gg_trg_teleport, GetTriggerUnit(), EVENT_UNIT_ISSUED_POINT_ORDER )
    endif
endfunction

function InitTrig_learn takes nothing returns nothing
    set gg_trg_learn = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_learn, EVENT_PLAYER_HERO_SKILL )
    call TriggerAddAction( gg_trg_learn, function Trig_learn_Actions )
endfunction


JASS:
function Trig_teleport_Actions takes nothing returns nothing
  local integer i = GetIssuedOrderId()
  local location whereTo = GetOrderPointLoc()
  local unit u = GetTriggerUnit()
  local location origin = GetUnitLoc(u)
  local real distToGo = DistanceBetweenPoints(whereTo,origin)
  local real toWait = distToGo / (GetUnitAbilityLevel(u,'A000') * 1000)
  local effect SFX
    if (i == 851986) or (i == 851971) then
      if distToGo <= 200 then
        call DisplayTextToPlayer(GetOwningPlayer(u),0,0,"Target is inside minimum range")
        return
      endif
      call IssueImmediateOrder(u,"stop")
      call TriggerSleepAction(toWait)
      set SFX = AddSpecialEffectLoc("Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl",whereTo)
      call SetUnitPositionLoc(u,whereTo)
      call DestroyEffect(SFX)
      call RemoveLocation(whereTo)
      call RemoveLocation(origin)
    elseif i != 851986 or i != 851971 then
      call DoNothing()
    endif
endfunction

function InitTrig_teleport takes nothing returns nothing
    set gg_trg_teleport = CreateTrigger(  )
    call TriggerAddAction( gg_trg_teleport, function Trig_teleport_Actions )
endfunction

...the second trigger shows the "Target is inside minimum range" 1/2/3 times, based on 'A000' level

edit: this could be used for a timed blink
also, the unit wont stop when its ordered
 

Nestharus

o-o
Reaction score
84
JASS:

if (GetLearnedSkill() == 'A000') then
      call TriggerRegisterUnitEvent( gg_trg_teleport, GetTriggerUnit(), EVENT_UNIT_ISSUED_POINT_ORDER )
    endif


Not sure if that would be a problem, but it looks like it'd be registering the ability every time you skilled it. If the ability is 3, it'd be running 3x, etc.


JASS:

call DoNothing()


Why...

JASS:

DistanceBetweenPoints(whereTo,origin)


why...




Shouldn't that be TriggerAddCondition? No point in using actions unless you plan on having dynamic triggers similar to Linux's grep command.

JASS:

local location whereTo = GetOrderPointLoc()


why.. lol


That's all for now. Fix up your script and I'll take another look : )
 

jackall

You can change this now in User CP.
Reaction score
37
why why why

JASS:
call DoNothing()
not sure about this one
JASS:
DistanceBetweenPoints(whereTo,origin)
because its distance based(notice the TriggerSleepAction line)
why condition?
JASS:
local location whereTo = GetOrderPointLoc()
because that trigger has to know where the unit is supposed to move

EDIT: thanks for the tip, it looks like the first one was the problem
JASS:
function Trig_learn_Actions takes nothing returns nothing
    if (GetLearnedSkill() == 'A000') and GetUnitAbilityLevel(GetTriggerUnit(),'A000') == 1 then
      call TriggerRegisterUnitEvent( gg_trg_teleport, GetTriggerUnit(), EVENT_UNIT_ISSUED_POINT_ORDER )
    endif
endfunction

function InitTrig_learn takes nothing returns nothing
    set gg_trg_learn = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_learn, EVENT_PLAYER_HERO_SKILL )
    call TriggerAddAction( gg_trg_learn, function Trig_learn_Actions )
endfunction

i added the GetUnitAbilityLevel so that it will only register the event once
 

Nestharus

o-o
Reaction score
84
DoNothing() does nothing.. so why are you calling it...


DistanceBetweenPoints is not a native, it's a function... go into Function List and retrieve the contents and put them in inside of using the function :eek:.



You don't need a location handle unless you plan on using a given coordinate a lot, like in a trigger for 10 minutes or something. Just use x, y coordinates. GetOrderPointX and GetOrderPointY.

And why condition? Because it's faster, lol. It has to go through a whole mess to get to the actions, so only use actions if you must : ).


Oh yea, and don't use this-
JASS:


Use SetUnitX and SetUnitY. They are better : ).


Finally, add comments to the line where the script bugs.

I'm assuming it's this line, but add comments to clarify-
JASS:
      if distToGo <= 200 then
        call DisplayTextToPlayer(GetOwningPlayer(u),0,0,"Target is inside minimum range")
        return
      endif


And if it is that line, that means this is the issue-
JASS:
local real distToGo = DistanceBetweenPoints(whereTo,origin)



Oh yea, and get rid of this-
JASS:
call TriggerSleepAction(toWait)


Use timers mate : )



----------------------
Edit
----------------------

Ahh, apparently you solved the problem, good job : ).

Oh well, those tips for your script are still very handy ^^
 

jackall

You can change this now in User CP.
Reaction score
37
im just at the beginning :p... how do you expect me to use functions/natives that take up less memory than others? im still learning it although im finding the use of locations instead of coordinates alot easier
 
General chit-chat
Help Users
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top