• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[JASS] My first jass trigger

Status
Not open for further replies.
Level 7
Joined
Feb 25, 2007
Messages
286
Ok I'm making the simplist jass trigger ever. yeah I know I suck. Every time I do it, it asks me for a end of the line statement. I have no idea what that is.
JASS:
Function Mi_First_Jass_trigger takes nothing and returns nothing

local unit u = GetTriggerUnit (BladeMaster 001)
call KillUnit (u)

I just wanted to start off simple but supponsdly theres 4 things wrong. First line has a end of a code error along with second line
The third line has something wierd wrong (i think)
and the fouth has a problem.
The problems are Expected end of line (x2), Expected a name, Expected a line statement.
Please help!
 
  • decapitalize F on function.
  • remove the 'and' from the first line.
  • remove 'BladeMaster 001' from the brackets of GetTriggerUnit()
  • add 'endfunction' on a new line at the end.

[jass=Solution]function My_First_Jass_Function takes nothing returns nothing
local unit u = GetTriggerUnit()
call KillUnit(u)
//note, the following line would NOT be needed for it to compile, but is antileak
set u = null
endfunction[/code]
 
"Function" worng. its "function". case matters.

"takes nothing and returns" wrong. "takes nothing returns nothing" there should be no and...

"BladeMaster 001" ??? the hell? variables can't have spaces... and... wtf is that?

also, you're missing "endfunction".

Go read JASS tutorials. you quite obviously have no idea what you're doing, and the tutorials that are all over should help you understand.
 
I did thought i added end function (im on a labtob that im not used to) didnt mean to caps the "f" its just out of habit from posting here. Also theres still three problems but the first line is good. expected a name (x2) expected a code statement. I matched exactly what you said and when I added the null trigger it came up with another error.

JASS:
function Mi_First_Jass_Trigger takes nothing returns nothing
local unit u = GetTriggeringUnit()
call KillUnit(u)
set u = null
endfunction
For null it saids it needs a varible.
 
Last edited:
Just make the correction I pointed out and your trigger well work, I don't completely understand your question.

JASS:
function OMG takes unit rak returns region
call RemoveUnit(rak)
return CreateRegion()
endfunction
Now that function doesn't really do anything useful, but you can call it like this.
JASS:
call OMG(X)
Where X is a unit.
 
Last edited:
If you know PHP or C (I think), functions can take parameters. In JASS, it is similar.

Say you do this:
JASS:
    call KillUnit(GetTriggerUnit())

This parses correctly.
JASS:
  native KillUnit takes unit whichUnit returns nothing

The "takes unit" means that you must put a unit variable or function within the parentheses.

In this case, GetTriggerUnit() is our unit.
JASS:
  native GetTriggerUnit takes nothing returns unit

Since GetTriggerUnit returns unit, it is a valid entry for the parentheses.

What a function takes is called parmeter(s).

So, KillUnit takes GetTriggerUnit because GetTriggerUnit returns a unit and "unit" is what the KillUnit takes. That might be a bit confusing... Reread this post a couple of times until you understand it. :wink:
 
The problem is
JASS:
 GetTriggeringUnit()
It should be
JASS:
 GetTriggerUnit()
He didn't write that =o

Isnt it if you put something in the () after something itll make it? or am I just somehow not comprehending that tut right ;\
GetTriggerUnit() just returns the Triggering Unit of an event that's just run and has called the function you're calling GetTriggerUnit() in as an action. (Or a parent-func on the stack)

Just make the correction I pointed out and your trigger well work, I don't completely understand your question.

JASS:
 function OMG takes unit rak returns Region
call UnitRemove(rak)
return CreateRegion()
endfunction
Now that function doesn't really do anything useful, but you can call it like this.
JASS:
 OMG(X)
Where X is a unit.
Actually, yours doesn't fix anything and leaves a lot wrong - mine and EFs solve it.

Also, it's "region" not "Region", "RemoveUnit()" not "UnitRemove()", you need "call" in front of "OMG(X)", and a "region" is not the "Region" from GUI - that's a "rect".
 
I'm sorry about that, I was in a hurry. I fixed all my stupid little errors. Sorry for any confusion I caused. *Feels like an idiot*
 
Status
Not open for further replies.
Back
Top