Banjo Posted April 6, 2020 Share Posted April 6, 2020 Is there a way to have an item spawn in the player's inventory *only* if they select a certain map when starting (for example, a map of Rosewood when starting in Rosewood) or for a specific spawn point (say, they key to the prison when spawning inside the prison). I can do this based on traits or professions, but I have no idea what code to use to make it start spawn dependant! I presume you can't set it by spawn point (i.e. the house you randomly start it) as that would be even better, but I'm assuming doing this by map choice - or even better, spawn point - is possible? For traits, it's: if player:HasTrait("traitnamehere") then player:getInventory():AddItem("Base.itemnamehere"); ...right? But does anyone know if (and how) this is possible if I wanted to give a key or weapon only to someone who starts in Rosewood or only spawns in the mall? Link to comment Share on other sites More sharing options...
ZombiesLoveBrainiacs Posted April 7, 2020 Share Posted April 7, 2020 I'd simply do this: - take the area's coordinates from blindcoder's map - check if the player's position is in that area when he spawns - then use modData to check if he's already received the items, kinda like this: if not player:getModData().startingItems then player:getInventory():AddItem("Base.itemnamehere") player:getModData().startingItems = true end Maybe there's a smarter way, but this should do the trick. Link to comment Share on other sites More sharing options...
Banjo Posted April 7, 2020 Author Share Posted April 7, 2020 (edited) Thanks so much for that! How do I get "z" co-ordinates (presumably height)? I used RoboMat's co-ordinates viewer to get x and y. Edited April 7, 2020 by Banjo Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now