JASS 101 Classroom

Status
Not open for further replies.
I

IKilledKEnny

Guest
Rodead, next time please send next time assignments to me by Private Massaging. Also the second part of the assignment requests that you add at least 5 comments around the trigger.
 

Hero

─║╣ero─
Reaction score
250
this is my homework i atacked it in a map here is the code

Code:
function Trig_create_unit_Conditions takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'hfoo' ) ) then
        return false
    endif
    return true
endfunction

function Trig_create_unit_Actions takes nothing returns nothing
    call CreateNUnitsAtLocFacingLocBJ( 1, 'hfoo', Player(0), GetRectCenter(GetPlayableMapRect()), GetUnitLoc(GetDyingUnit()) )
endfunction

//===========================================================================
function InitTrig_create_unit takes nothing returns nothing
    set gg_trg_create_unit = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_create_unit, Player(0), EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_create_unit, Condition( function Trig_create_unit_Conditions ) )
    call TriggerAddAction( gg_trg_create_unit, function Trig_create_unit_Actions )
endfunction


Lol...I told you to clean it up...I even showed you how..learn from it even if you didn't optimize it you can still learn from it


__________________



IKilledKEnny I'll take a nice look at this thread every now and then to see how your doing..also willing to check homework :D
 

elmstfreddie

The Finglonger
Reaction score
203
Oops... Forgot to make it have the condition of that the triggering unit is a footman. Smart. Hold on...
Code:
function Trig_Untitled_Trigger_001_Conditions takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'hfoo' ) ) then
        return false
    endif
    return true//Ok that all seemed retarded, can't you just remove the "not" and then have return true for the then...?
endfunction

function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )//creates a footman (hfoo) at centre of playable map area (get rect centre etc) facing the bj facing (default building facing)
endfunction//ends the function, lol

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )//Eh eh eh? This doesn't seem necessary =/
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Untitled_Trigger_001, Player(0), EVENT_PLAYER_UNIT_DEATH )//Runs the trig if a unit owned by player 1 (or player 0 in JASS) dies
    call TriggerAddCondition( gg_trg_Untitled_Trigger_001, Condition( function Trig_Untitled_Trigger_001_Conditions ) )//Makes it check the condition I believe =/
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
There, my ugly long comments. If I do write down comments on my JASS, there will probably be tonnes and they will be 3 miles long lol
 

Slywolf15

Member
Reaction score
5
Oops... Forgot to make it have the condition of that the triggering unit is a footman. Smart. Hold on...
Code:
function Trig_Untitled_Trigger_001_Conditions takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'hfoo' ) ) then
        return false
    endif
    return true//Ok that all seemed retarded, can't you just remove the "not" and then have return true for the then...?
endfunction

function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )//creates a footman (hfoo) at centre of playable map area (get rect centre etc) facing the bj facing (default building facing)
endfunction//ends the function, lol

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )//Eh eh eh? This doesn't seem necessary =/
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Untitled_Trigger_001, Player(0), EVENT_PLAYER_UNIT_DEATH )//Runs the trig if a unit owned by player 1 (or player 0 in JASS) dies
    call TriggerAddCondition( gg_trg_Untitled_Trigger_001, Condition( function Trig_Untitled_Trigger_001_Conditions ) )//Makes it check the condition I believe =/
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
There, my ugly long comments. If I do write down comments on my JASS, there will probably be tonnes and they will be 3 miles long lol


I'm quite sure he said you needed to pm your homework. Probably to keep people from copying.
 

Hero

─║╣ero─
Reaction score
250
Optimize it

Code:
function Trig_create_unit_Conditions takes nothing returns boolean
    return GetUnitTypeId(GetTriggerUnit()) == 'hfoo' 
endfunction

function Trig_create_unit_Actions takes nothing returns nothing
    call CreateUnitAtLoc(Player(0),'hfoo',GetRectCenter(GetPlayableMapRect()),0)
endfunction

//===========================================================================
function InitTrig_create_unit takes nothing returns nothing
    set gg_trg_create_unit = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_create_unit, Player(0), EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_create_unit, Condition( function Trig_create_unit_Conditions ) )
    call TriggerAddAction( gg_trg_create_unit, function Trig_create_unit_Actions )
endfunction

yes it leaks...but I don't think they learned about that yet
 

pheonixashes

Those who misplace trust in gods learn their fate.
Reaction score
65
I'm not in the class, KEnny, but I think it would be useful to put a link or an attachment on the first page, for easy reading.

Just a thought. ^_^.

EDIT: Oh nvm you already have it.
 

Hero

─║╣ero─
Reaction score
250
I wonder where IKilledKEnny is at...hmhmh...maybe I should help him with this thread..lol

________
I'll be the substitute teacher for now...go ahead post questions and what not..lol
 

Hero

─║╣ero─
Reaction score
250
---Removed The Script for Copying Reasons----


Looks good for what knowledge you should know..I can't wait until you all become JASS scripters...it's like watching a child grow up :D
 

Hero

─║╣ero─
Reaction score
250
Just edit them and write something like

Removed The Script

I'll do it in my post too
 
I

IKilledKEnny

Guest
Thanks for fixing it hero12341234 but we are no there yet. :) If an admin could clean the posts from this one to Rodead's that would be great, I want to prevent copying and confusion.

I have gotten few assignment already, however not everyone sent them, remember, you have until Friday if you want to get a grade!
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
Wait, we just have to convert a GUI trigger into JASS and then comment the action(Not actionS) for the assignment?
 
I

IKilledKEnny

Guest
And add a few comments. Also you get extra grade if you say what each line do.

Sorry to disappoint you Andrewgosu, but all I taught until now is what is JASS and how to work with it.
 

Omni

Ultra Cool Member
Reaction score
37
>you have until Friday if you want to get a grade!
My stupidity will get rated OH NO!
;)
 

Knocksious

Sweet, I got 2 little green bars!
Reaction score
46
hey, is there a JASS editor that works on a mac? Or do I have to install virtual PC...

I could work directly on WE, but he said that wasn't a good option
 
Status
Not open for further replies.
General chit-chat
Help Users
  • No one is chatting at the moment.

      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