HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trackable and a invisible model

05-10-2008, 04:25 PM#1
Zandose
I tried using an model with no animations (Vex's dummy model from the caster system) but it doesn't work. Using a normal model works fine (like wisp). Any ideas of how to get an invisible model to work?

Here's my code if your interested:
Collapse JASS:
scope Trackables

globals
    //private constant string TRACKABLE_MODEL = "war3mapImported\\dummy.mdl" //A model with no animations (Thanks Vex)
    private constant string TRACKABLE_MODEL = "units\\nightelf\\Wisp\\Wisp.mdl"
    private constant integer ARRAY_SIZE = 143360 //256x256 map
    private real array x[ARRAY_SIZE]
    private real array y[ARRAY_SIZE]
    private gamecache gc
endglobals

private function H2I takes handle h returns integer
    return h
    return 0
endfunction

private function Hit takes nothing returns nothing
    local integer i = GetStoredInteger(gc, "Trackables", I2S(H2I(GetTriggeringTrackable())))
    debug call BJDebugMsg("Hit: " + R2S(x[i]) + "/" + R2S(y[i]))
endfunction

private function Over takes nothing returns nothing
    local integer i = GetStoredInteger(gc, "Trackables", I2S(H2I(GetTriggeringTrackable())))
    debug call BJDebugMsg("Over: " + R2S(x[i]) + "/" + R2S(y[i]))
endfunction

private function Setup takes nothing returns nothing
    local trigger t1 = CreateTrigger()
    local trigger t2 = CreateTrigger()
    local trackable track
    local integer i1 = 0 //x
    local integer i2 = 0 //y
    local integer i3 = 0 //counter
    local rect gwb = GetWorldBounds()
    local real MinX = GetRectMinX(gwb)
    local real MaxX = GetRectMaxX(gwb)
    local real MinY = GetRectMinY(gwb)
    local real MaxY = GetRectMaxY(gwb)
    local integer width = R2I(MaxX - MinX) / 128 //in 128 blocks
    local integer height = R2I(MaxY - MinY) / 128 //^
    debug call BJDebugMsg("Trackables - Starting")
    call RemoveRect(gwb)
    set gwb = null
    //call FlushGameCache(gc)
    set gc = InitGameCache("Trackables.w3v")
    loop
        loop
            set track = CreateTrackable(TRACKABLE_MODEL, MinX+(i1*128), MaxY-(i2*128), 0)
            call TriggerRegisterTrackableHitEvent(t1, track)
            call TriggerRegisterTrackableTrackEvent(t2, track)
            call StoreInteger(gc, "trackables", I2S(H2I(track)), i3)
            set x[i3] = MinX+(i1*128)
            set y[i3] = MaxY-(i2*128)
            set i3 = i3 + 1
            set i1 = i1 + 1 //x
            debug call BJDebugMsg(I2S(i3))
            exitwhen i1 == width
        endloop
        set i1 = 1
        set i2 = i2 + 1 //y
        exitwhen i2 == height
        call TriggerSleepAction(.01)
    endloop
    call TriggerAddAction(t1, function Hit)
    call TriggerAddAction(t2, function Over)
    debug call BJDebugMsg("Trackables - Done")
endfunction

//Trackables need to be setup after the game starts, thus this.
public function InitTrig takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterTimerEvent(t, .01, false)
    call TriggerAddAction(t, function Setup)
endfunction

endscope
05-10-2008, 04:37 PM#2
Alexander244
I think it's because the dummy model has no collision spheres; which is why it's not clickable. You would need a new/edited model with collision spheres for this purpose.
05-10-2008, 04:46 PM#3
Zandose
I see. Are there still people in the "Artist's Discussion and Queries" forum doing requests?
05-10-2008, 04:48 PM#4
Alexander244
You can always ask, I'm sure someone will be willing :)
05-10-2008, 08:51 PM#5
Silvenon
You go Alex.

Why don't you try the model that KaTTaNa used (www.wc3jass.com)? I think it works fine (and it's invisible), I see no reason not to use it.

Well, actually I do see a reason, but, apparently, that problem only happens to me: for some reason they don't work, I did exactly like KaTTaNa said, but nooooooo..... why would something work for me......

If you ask me, trackables are haunted, use RtC instead (except if you have a good reason not to).
05-10-2008, 10:58 PM#6
Zandose
KaTTaNa uses the peasent model if I'm not mistaken. I want a invisible one.
05-10-2008, 11:31 PM#7
Vexorian
Quote:
If you ask me, trackables are haunted, use RtC instead (except if you have a good reason not to).
I think there are more good reasons not to use a hack that's not portable and wouldn't work in bnet than to use it.
05-10-2008, 11:53 PM#8
TEC_Ghost
Doodads\Terrain\InvisiblePlatform\InvisiblePlatform.mdl

There's also a smaller one you can use, I'm using this model for my tackable movement tiles in my upcoming map.
05-11-2008, 08:20 AM#9
masda70
I attached the one I use. It's based off KaTTaNa's trackable model. I only removed all the unnecessary vertices, leaving only 4, which is the minimum you need to make a square. The model's dimensions are 256x256x0, so you might want to scale it for your own use (using your favourite model editor), and the (0,0,0) point is located at the center of the square. Since I've been using this for a file, it should work for you.
Attached Files
File type: zip8x8Trackable.zip (926 bytes)
05-11-2008, 09:34 AM#10
Troll-Brain
if the model path of a trackable is empty for a player the trackables events will be detected anyway ?
so even if you "attach" a player and a trackable you can't be sure which player fire the trackable event ?
05-11-2008, 10:06 AM#11
Alexander244
Have a look at the Trackables in Multiplayer section in KaTTaNa's Trackable Tutorial on wc3jass.
05-11-2008, 10:10 AM#12
Troll-Brain
Quote:
Originally Posted by Alexander244
Have a look at the Trackables in Multiplayer section in KaTTaNa's Trackable Tutorial on wc3jass.
i've already read that but it doesn't answer my question.
I know that i can test myself but i need to ask an other to test with me and why if someone had already test it ?
05-11-2008, 10:25 AM#13
Alexander244
It says that by giving an emtpy string the trackable does not detect events...

Just tested the following code with 2 players:
Expand JASS:

It works fine.
05-11-2008, 10:27 AM#14
Troll-Brain
thx, sorry i didn't see this sentence