Find multi player starts by Lua

Status
Not open for further replies.

Ors

Custom User Title
Multi player starts don't have an MT_-object, so I tried mapthings.iterate and used "if (thing.type == 33)" to find them. Seems like they aren't listed there.
Still, I tried the script with "if (thing.type == 1)" and it gave the amount of player 1 starts successfully.
Code:
addHook("MapLoad", do
    local startslist = {}
    for thing in mapthings.iterate
        if (thing.type == 33)
            table.insert(startslist,thing)
        end
    end    
    print(#startslist)
end)
If you know how to find them, please tell me. You would be mentioned in the credits for that =)
 
Shouldn't you just check for this?

" if thing.type < 33 ", considering player starts are things 1 to 32, unless I'm wrong.
 
Shouldn't you just check for this?

" if thing.type < 33 ", considering player starts are things 1 to 32, unless I'm wrong.
No... That works for single player starts. This script is trying to find multiplayer starts (type 33). I don't know if any information of them is available for Lua though.
 
Annoyingly, me and Red ran into a couple issues when trying to deal with the various non-singleplayer starts when working on Thokker. It turns out that team starts are removed* on mapload and stored in some inaccessible-to-Lua mechanism. I don't know whether it does it with regular match starts, but if it's not actually providing any information Lua can handle then that's probably the case as well.

Which is really stupid, but what the hey. We ended up dedicating mapthingnums 1 and 2 to Red Thokker team and Blue Thokker team spawnpoints instead.

*look at post below, I was misremembering
 
Last edited:
They're not actually "removed" from what I can tell in the source code, their "type" variable is set to 0 instead. This applies to regular Match starts, Red team starts, and Blue team starts.
 
Thanks a lot! "if (thing.type == 0)" seems to fix the problem pretty well. This helps the project go on very well!
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top