Help: Trackables

jnZ

I
Reaction score
64
Ok here is what i am trying to do: i want to create a "movementsystem" (more or less) that allows moving 1 hero (for each player) without having him selected.
I asked and searched arround and noticed that the only way to do this is via trackables.

So i looked at some trackable turtorials but because i understand a sh*t of jass in rly understood nothing >.<

I would be rly glad (and +rep) if anyone here could edit the trigger below (from 1 of the turtorials) so that the above mentioned features work. (in my map up to 10 players will be able to play to it would be awesome if this could be MPI but every player only got 1 hero so no need for MUI (makes no sense here anyway ^^)

> when i tried to edit the Trackable trigger i noticed that its quiet easy and a nice feature to let the hero face wherever the mouse currently is.

When i tried to edit this trigger i got critical errors everytime so i thought it would be the best to ask here arround for help

JASS:
function TrackableTrack takes nothing returns nothing
    local real x = GetTrackableX(GetTriggeringTrackable())
    local real y = GetTrackableY(GetTriggeringTrackable())
    local location loc = Location(x,y)
    call SetUnitFacingToFaceLocTimed(udg_Hero, loc, 0.5) // I GUESS THIS IS THE FACING PART QUIET EASY TILL HERE
endfunction
function TrackableHit takes nothing returns nothing
    local real x = GetTrackableX(GetTriggeringTrackable())
    local real y = GetTrackableY(GetTriggeringTrackable())
    local effect fx
    local group bombs 
    local unit bomb
    local real d
    if ( udg_Overheated or udg_GameOver ) then
        return
    endif
    set udg_ShotsFired = udg_ShotsFired + 1
    set bombs = CloneGroup(udg_Bombs)
    set fx = AddSpecialEffect(&quot;Abilities\\Weapons\\Mortar\\MortarMissile.mdl&quot;, x, y)
    call DestroyEffect(fx)
    call SetUnitAnimation(udg_Tower, &quot;attack spell&quot;)
    loop
        set bomb = FirstOfGroup(bombs)
        exitwhen bomb == null
        set d = (GetUnitX(bomb)-x)*(GetUnitX(bomb)-x) + (GetUnitY(bomb)-y)*(GetUnitY(bomb)-y)
        if ( d &lt;= udg_ShootAOE*udg_ShootAOE ) then
            if ( GetHandleInt(bomb, &quot;super&quot;) == 1 ) then
                set udg_SuperrocketsShot = udg_SuperrocketsShot + 1
            else
                set udg_RocketsShot = udg_RocketsShot + 1
            endif
            call GroupRemoveUnit(udg_Bombs, bomb)
            call KillUnit(bomb)
        endif
        call GroupRemoveUnit(bombs, bomb)
    endloop
    call DestroyGroup(bombs)
    set udg_OverheatShots = udg_OverheatShots + 1
    call TriggerExecute(gg_trg_Update_Leaderboard)    // NO NEED FOR ALL THOSE EFFECTS // OVERHEAT THINGS ETC I JUST WANT THE HERO OF THE TRACKABLE HITTING PLAYER TO MOVE TO THE LOCATION OF THE TRACKABLE
endfunction

function Trig_Init_Trackables_Actions takes nothing returns nothing
    local trigger hit = CreateTrigger()
    local trigger track = CreateTrigger()

    local real x
    local real y = GetRectMinY(gg_rct_Bomb_area) + 64
    local real maxY = GetRectMaxY(gg_rct_Bomb_area)
    local real maxX = GetRectMaxX(gg_rct_Bomb_area)
    loop
        exitwhen y &gt; maxY - 64
        set x = GetRectMinX(gg_rct_Bomb_area) + 64
        loop
            exitwhen x &gt; maxX - 64
            call NewTrackable(&quot;war3mapImported\\4x4Trackable.mdl&quot;, x, y, GetPlayersAll(), track, hit)
            set x = x + 128
        endloop
        set y = y + 128
    endloop
    
    call TriggerAddAction(hit, function TrackableHit)
    call TriggerAddAction(track, function TrackableTrack)
endfunction

//===========================================================================
function InitTrig_Init_Trackables takes nothing returns nothing
    set gg_trg_Init_Trackables = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Init_Trackables, function Trig_Init_Trackables_Actions )
endfunction
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
Which tutorials did you read?
There is a really good one over at wc3campaigns, and no offence, but if you don't understand JASS you really shouldn't try and use these. As from what I gather, not many people do!
 

UndeadDragon

Super Moderator
Reaction score
447
(in my map up to 10 players will be able to play to it would be awesome if this could be MPI but every player only got 1 hero so no need for MUI (makes no sense here anyway ^^)

I don't think you can make trackables MPI because you can't actually get triggering player from the player who moused over or selected the trackable.
 

jnZ

I
Reaction score
64
the whole trigger posted here is all i need (if you make him like 1 want he even would be shorter by some lines)

this movementsystem is essential for my map but the only thing i cant handle because it requiers jass. so you want me to stop my project because of this little piece of jass that is surely easy done by some skilled (and rep needing xD) people here?

EDIT:

>I don't think you can make trackables MPI because you can't actually get triggering player from the player who moused over or selected the trackable.
it is possible i also read this in the turtorial. by creating severeal trackables that are only accessible to certain player. so for 8 players 8 trackables at exactly the same postition
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
Your problem might be the fact that GetTrackableX and Y arn't actual functions... ^^
 

quraji

zap
Reaction score
144
In my opinion, you have two options:

1. Learn JASS and figure it out.

2. Try to find or get someone to make a system that works for you.

The reason I say this is that Trackables are relatively complex to begin with, and adding more players and movement and all that only furthers the complexity.

As people are mentioning, there's really no functions at all for handling trackables and it all needs to be created manually.
 

jnZ

I
Reaction score
64
> Your problem might be the fact that GetTrackableX and Y arn't actual functions... ^^


i didnt post my edited trigger...
the trigger above works, it came with a testmap (ill attach it right now)
 

Attachments

  • Bombs.w3x
    33 KB · Views: 116

AdamGriffith

You can change this now in User CP.
Reaction score
69
Did you copy the trigger out of that map only?
Because there is a ^&*( load of functions in the map header such as the GetTrackableX and Y :p
 

jnZ

I
Reaction score
64
yeah i know about that, i edited things like that. i am a jass noob but iam not an idiot dude

EDIT: however i would never be able to edit the trigger so it does what i want ^^ only making it work in my map wouldnt help
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
You should not touch the function in the map header.
That is a system called Local Handle Variables made by Kattana.
You should also not touch the trackable functions in their.
Only change the functions in triggers.

(What exactly is wrong?)
 

jnZ

I
Reaction score
64
like i said i need the trigger edited: currently its creating a explosion if a trackable is hit and some overheat stuff i dont need. i want to order the hero of the trackable clicking player to move to the postition of the trackable. thats all. and the facing stuff whenever a trackable is tracked at the start of the trigger but thats a piece of a cake.

however iam not capable of editing the trigger without causing XXX errors

>You should not touch the function in the map header.
That is a system called Local Handle Variables made by Kattana.
You should also not touch the trackable functions in their.
Only change the functions in triggers.

(What exactly is wrong?)

did you actually read why i created this thread?
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
YAY!

Try it out and see if its what you want.
I just used a single variable.
But you can use an array if you need more than one player.
Also, if this is the case there is a function something like GetTrackablePlayer(trackable)

View attachment 24357
 

jnZ

I
Reaction score
64
yeah that awesome dude but tell me:

i removed the first function the Trackable track thing because its not needed. will this cause error. the trigger looks like this now and seems to work:

JASS:
function TrackableHit takes nothing returns nothing
    local real x = GetTrackableX(GetTriggeringTrackable())
    local real y = GetTrackableY(GetTriggeringTrackable())
    call IssuePointOrder(udg_Hero, &quot;move&quot;, x, y)
endfunction

function Trig_Init_Trackables_Actions takes nothing returns nothing
    local trigger hit = CreateTrigger()
    local trigger track = CreateTrigger()
    local real x
    local real y = GetRectMinY(gg_rct_Bomb_area) + 64
    local real maxY = GetRectMaxY(gg_rct_Bomb_area)
    local real maxX = GetRectMaxX(gg_rct_Bomb_area)
    loop
        exitwhen y &gt; maxY - 64
        set x = GetRectMinX(gg_rct_Bomb_area) + 64
        loop
            exitwhen x &gt; maxX - 64
            call NewTrackable(&quot;war3mapImported\\4x4Trackable.mdl&quot;, x, y, GetPlayersAll(), track, hit)
            set x = x + 128
        endloop
        set y = y + 128
    endloop
    
    call TriggerAddAction(hit, function TrackableHit)
endfunction

//===========================================================================
function InitTrig_Init_Trackables takes nothing returns nothing
    set gg_trg_Init_Trackables = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Init_Trackables, function Trig_Init_Trackables_Actions )
endfunction



also can you tell me how iam able to change those gg_rct_Bomb_area to the playable map area?
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
I dont know.
Try it.
If you get errors, come back and tell me. I'll look into it :p

EDIT:
I dont see why not. They are only regions. Or you could just drag that region to fill the entire area. Dont drag it right up to the edge though. Trying to create trackables of the edge might not be such a good idea :p
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top