Page 1 of 2

Within Range

Posted: Thu Jul 09, 2009 4:07 am
by manstie
A unit comes within (range) of Unit Type???

Code: Select all

function InitTrig_Jumper takes nothing returns nothing
    set gg_trg_Jumper = CreateTrigger(  )
    call TriggerRegisterUnitInRange( gg_trg_Jumper, 100, unittype==Jumper )
    call TriggerAddAction( gg_trg_Jumper, function Trig_Jumper_Actions )
endfunction
:?

Re: Within Range

Posted: Thu Jul 09, 2009 10:57 am
by 3ICE
Undeclared variable: unittype
Undeclared variable: Jumper
Cannot convert an integer to unit
Cannot convert boolean to real
Not enough arguments passed to function
Failed with 5 errors.

EDIT: Yes, I type that.

Re: Within Range

Posted: Thu Jul 09, 2009 11:53 am
by manstie
Okay,
I was just asking if there was such an event in jass

Re: Within Range

Posted: Thu Jul 09, 2009 11:54 am
by 3ICE
Why not use GUI?

Re: Within Range

Posted: Thu Jul 09, 2009 11:58 am
by manstie
Because in gui, you can't make it:
"Unit comes in range of (variable or unit-type)"

Anyway in your system I do syntax checks and it says undeclared variable everywhere.

So is there an event in jass?

Re: Within Range

Posted: Thu Jul 09, 2009 12:05 pm
by 3ICE
manstie wrote:Because in gui, you can't make it
Ever heard of conditions? They are between event and action.

EDIT:
manstie wrote:Anyway in your system I do syntax checks and it says undeclared variable everywhere.
You are doing it wrong. My system has zero syntax errors, otherwise it would not work. JASS is not forgiving. If you leave so much as one syntax error in it, it will refuse to run until you fix it completely.

You shouldn't run syntax checks on my code. I have already made sure it works. The missing variables are declared in the trigger editor, and you forgot to feed that to your syntax checker. Practice a lot and you'll understand it soon enough.

EDIT2: If you really want to syntax check something that works fine already, here is the part you missed:

Code: Select all

globals
  group    udg_H            = null
  real     udg_Speed        = 0
  integer  udg_TerrainKill  = 0
  integer  udg_Slide        = 0
endglobals
Put that on the top.

Re: Within Range

Posted: Thu Jul 09, 2009 12:49 pm
by manstie
Oh yea, if it was possible to make it:
A unit comes within range of (A unit, any unit!)
Then I wouldn't have asked that.

Re: Within Range

Posted: Thu Jul 09, 2009 12:59 pm
by 3ICE
Great.

Add an event for each object you need. You can even do it dynamically with ForGroup or loop and "Trigger - Add New Event". Don't ask how, if you can't, then do it one by one.

Re: Within Range

Posted: Thu Jul 09, 2009 10:47 pm
by manstie
Can't make it "A unit comes within range of (Any unit from unit group)"

Re: Within Range

Posted: Fri Jul 10, 2009 6:46 am
by 3ICE
3ICE wrote:Add an event for each object you need.