1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  4. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  5. The results are out! Check them out.
    Dismiss Notice
  6. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  7. The raddest synthwave tracks were chosen - Check out our Music Contest #12 - Results and congratulate the winners!
    Dismiss Notice
  8. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[JASS] Not working at all...

Discussion in 'Triggers & Scripts' started by Saishy, Dec 12, 2008.

  1. Saishy

    Saishy

    Joined:
    Mar 23, 2008
    Messages:
    947
    Resources:
    0
    Resources:
    0
    Code (vJASS):
    private function DamageType takes nothing returns nothing
        local group kunit = GetUnitsInRectAll(gg_rct_Region_000)
        local unit tempunit = FirstOfGroup(kunit)

            call DisplayTextToForce(GetPlayersAll(), "Casting a 100 damage chain lighting")
            call CreateUnitAtLoc(Player(PLAYER_NEUTRAL_AGGRESSIVE), 'n000', GetRectCenter(gg_rct_Region_001), 90)
            call IssueTargetOrderBJ(GetLastCreatedUnit(), "chainlightning", tempunit)
            call UnitApplyTimedLife(GetLastCreatedUnit(), 'BTLF', 3)
            call FDamage()
        call DestroyGroup(kunit)
        set kunit = null
        set tempunit = null
    endfunction
     

    The unit don't cast the chain lighting and stay forever in the map...
     
  2. TheBlooddancer

    TheBlooddancer

    Joined:
    Jun 24, 2008
    Messages:
    2,911
    Resources:
    0
    Resources:
    0
    Does it show the text?

    And i think you should use DBugMsg instead.
     
  3. Skullclaimer

    Skullclaimer

    Joined:
    Nov 25, 2008
    Messages:
    76
    Resources:
    0
    Resources:
    0
    Ah yeah DisplayTextToForce is not a good way to display text. You can use
    Code (vJASS):
    DisplayTextToPlayer(GetLocalPlayer())
    for the same thing for more efficiency.

    Also check if the unit can actually *cast* the ability. Make sure that the ability is added to the unit you want. I had cases when the exact same thing happened to me... Hope this helps

    Edit: I'm not quite sure but I believe
    Code (vJASS):
    GetRectCenter
    leaks. You could assign it to a local variable then remove the location in the end.
     
  4. Shadow Daemon

    Shadow Daemon

    Joined:
    Nov 23, 2008
    Messages:
    184
    Resources:
    3
    Tools:
    3
    Resources:
    3
    I noticed that you picking all units in region 000, but dummy unit is created in center of region 001. Make sure your dummy unit is enough close to target.

    Or check some fields of ability (range, mana cost, requirements) in OE.
     
  5. Saishy

    Saishy

    Joined:
    Mar 23, 2008
    Messages:
    947
    Resources:
    0
    Resources:
    0
    About leaks and performance, Its just a test to see the damage of a chain lighting on my unit, don't need to be perfect.

    The message shows, also shows that unit took 0 damage, the dummy caster is created, I took control over him and I can cast manually the chain lighting, also, I tried preloading the unit... Nothing worked.

    Also, the unit don't have the expiration timer, why?

    Edit: Uploaded the test map.
    Ps: A cookie to anyone that kills saishy. (The isle in the down / right)

    Edit2: Attach removed!
     
    Last edited: Dec 13, 2008
  6. Skullclaimer

    Skullclaimer

    Joined:
    Nov 25, 2008
    Messages:
    76
    Resources:
    0
    Resources:
    0
    I'm still noob at this so it might be way off,but I think its the GetLastCreatedUnit native that is making the problem here. Try doing something else with it. I tried to get the location (the x y z) of the dummycaster and print it on screen, it just printed all 0's. Also tried to issue a move order to it, wouldn't budge. It just seems the trigger cannot reach the dummy...
     
  7. Shadow Daemon

    Shadow Daemon

    Joined:
    Nov 23, 2008
    Messages:
    184
    Resources:
    3
    Tools:
    3
    Resources:
    3
    Blah... I realized. You have used native CreateUnitAtLoc (not CreateUnitAtLocSaveLast), that's why GetLastCreatedUnit() returns null. I just wonder, how we didn't noticed that earlier...

    So the right code would look like this:

    Code (vJASS):
    private function DamageType takes nothing returns nothing
      local group kunit = GetUnitsInRectAll(gg_rct_Region_000)
      local unit tempunit = FirstOfGroup(kunit)
      local unit dummy = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_AGGRESSIVE), 'n000', GetRectCenter(gg_rct_Region_001), 90)
      // --->>
      call DisplayTextToForce(GetPlayersAll(), "Casting a 100 damage chain lighting")
      call IssueTargetOrderBJ(dummy, "chainlightning", tempunit)
      call UnitApplyTimedLife(dummy, 'BTLF', 3)
      call FDamage()
      // <<---
      call DestroyGroup(kunit)
      set kunit = null
      set tempunit = null
      set dummy = null
    endfunction
     
  8. Saishy

    Saishy

    Joined:
    Mar 23, 2008
    Messages:
    947
    Resources:
    0
    Resources:
    0
    Thanks! I used SaveLast. Worked!

    +rep!

    (I think nobody killed me, right? xD)