字幕列表 影片播放 列印英文字幕 what's going on? Everybody. And we're gonna part three of our hell light 2018 slash highlight three tutorial series. In the previous tutorial we covered getting the surrounding cardinals as well as working locally with Hallie. Um and we're gonna continue building on that and hopefully actually getting our ships to navigate here. So let's get into it s So once we have the choices, these air gonna be ship positions. And when you once you have a position you could do Now this is gonna be kind of pseudo Cody. But game map, and then you would take that position and then you can do it dot Hal, I amount. And with that, you can get how much Hal it is at that exact position. It doesn't have to be a position that surround your ship. Your ship has access to the data because it's all in game map in game app updates every single frame. So, uh, anyway, so that's what we're going to wind up using now, before we start iterating over ships, basically, we need to know. So this gets your surrounding cardinals, which are your positions. Ah, but then we also want to get information on. So not only do we get those positions, those positions are just simply positions. They're not like, as far as I understand it you don't actually get like so if we just search surrounding cardinals, Um, what it returns to you is the surrounding positions. But I don't believe their relative to your ship. So later on you tell your ship to move up, down left, right, not move to, you know, Thio X coordinate. Right. So anyways, we need to know the order that surrounding cardinals are given to us. So looking here, it returns the directional offset for current location in direction dot Get all cardinals. So now we need get all cardinals, which is here, and it returns in this very specific order. North, south, east, west. So now we know basically the actual movements associate ID. So these direction movements are also part of position ALS, and they correspond to exactly what you are going to pass your ship's north. To get your ship to move north is actually move nothing in your ex coordinates and move negative one or up in your why coordinates south the opposite of that and so on and that's we need to. That's the thing that we passed worship at the very end to actually get it to move. But before we move, we need to get the actual when we get the surrounding coordinates. Those are not, nor, you know, north, South, East West is not mapped to that. Anyway, um, that might sound really confusing. Let's just right at the coat. So? So the first thing we want to do is we're gonna do direction, underscore Werder, and that is going to just be what I just copied. So I didn't need to add the list already had it. So it's gonna be North, South, East, west. Now, the only thing that I'm gonna add is a final one, which is direction dot Still, and we make sure that we did important direction. Make sure we had it. Um, because that's gonna be the final thing. So this is the order that were we already it? We're gonna collect. Hal, I TTE now for the north position, the South position, the east position, the West position or don't move position. Okay, so once we have that, um, we've got choices. Now, your choices are going to be, Um, I'm gonna change this to position options, and that's gonna be ship dot position dot Get surrounding cardinals. Um, plus the current ship dot position. So all of the positional choices that we might make our the surrounding positions plus our current ship position, because many times you don't actually want to have to move your ship. Sometimes you might actually want your ship to hold. Still. If you're on enough, how light you should. You should stay on that. How light and collect as much as you can until you think it's a wise decision to move off so that I'm gonna make a position dicked right now that's going to be empty. And then I'm gonna make a Hal I TTE addict and basically the position dicked is going to contain the movement mapped to the actual coordinate. So an example here would be, let's say, the movement of 01 that's gonna be mapped to a natural physical coordinate on the game map like 1938 or something, something like that. So we'll have one for each of the five choices. Move up, down, left, right, or stay still. That's That's the position dicked now, the Hal I dicked is going to be the actual movement. Um, 01 let's say associated with how much How light? So 500 for example. Um, so those air those What? What we're planning to pass into those two dictionaries. Now. What we want to do is populate those two dictionaries. So I'm just gonna come down here and say for end in direction in in numerous eighths direction. Order. Um, we're going to say position dicked for that direction is equal to position options, Ken. So this maps, um, this, you know, fills out that positional addict, and then now we want to actually fill out the hal addict itself Is Well, so now what we're gonna say is for direction in position dicked we're gonna say the actual position itself is just, you know, position, position dicked for that direction. So that gives us the position itself. Now we want to know how much Hal I TTE is located at that position. So we're gonna say how it amount. That makes me nervous. For some reason, that was pre defined. I'm not really sure why. How light amount was pretty like a thing that we've used already. Oh, maybe it's this dot Hallet amount makes sense. Okay. Anyway, Helen amount, um, is equal to game map at that position, Not how light amount. That's a typo position. So now we have the Hal. I'd amount, and then now we're ready to actually populate the hell addict. So now we say highlight dicked for the position equals Hal. I TTE amount. Okay, so then the final thing that we want to do is we actually want to be able to choose which of you know which movement should we go with. Well, the movement that we want to go with is whatever key has the highest value. So to get the key for the highest value would be Max for Hal It Dix. Where the key? Well, basically, this is the max of Hal addict in the max that we're looking for is Hal. I TTE dicks dot Get so we're curious What? The highest? Because, Hal addict, if you were to iterated over Hal addict, that would be the keys. But in this case, key is in reference to the thing that we're gonna get the max off. And that is the value the actual value from that hal addict based on each key as you iterated over it. So now, rather than a random not choice move, all we want to do is ship dot move, and we want to do a ship dot move and the highlight dicked itself. These are the movements that you would actually pass to your ship. You have to pass a to pull. That is 01 is your negative one negative 10 or 10 So all we have to do is pass exactly what I just wrote. So, uh, this really let's just cut this paste, and, uh, that's it. So now if the let's see So if the ship is full, it's gonna hold. Still, that's fine. Eventually, airships are gonna probably stop moving, but we'll work on that in a little bit. Um, we don't need to log that anymore. So it's going to say that and let's run that and make sure that we're not hitting some other issue. So run the game again. A really quick finish there. Hopefully, we're not having tab issue again. That would be annoying. Uh, so let's go ahead and open this. Let's edit ISS. I guess the game is just simply ending Last input receives and tax air. So we've got some sort of else. If you going on here. If game, ma'am else, What would be the issue here else? Coming? I'm assuming we don't have any replays. Uh, did we may be okay, community. So this is not fully closed off. I deleted too many things. I'm guessing. That's probably the extent of the issue. Let's try this again. No. Still still giving me this, man? Maybe a typo. Now to rush and go back here. I don't know if this is just getting truncated or what? Direction, direction, direction Maybe still might be a casing. Is she there? Let's save that again. Um, and just so it's clear, this is, you know, these correspondent North, south, east, west. But then we also want to get you know we want to add shipped Opposition for hold still. Okay, let's run this one more time. Are you? Are you serious with me right now? Okay, I just made another typo position. OK? 78th time's No. 70 times. A charm is not gonna work on hash will type position. I'm not seeing it immediately We'll see how addict position equals how. I'm not sure why that would be giving me a hard time. I'm not seeing it clearly. See how addict? Oh, let's see. So how? Edict. I'm not sure why that's airing, but we actually want that to be Hal. Addict direction equals Hal. I'd amount who that was way too complicated. Um, okay, let's see. So let's go to the replays. Pull this up and let me throw the most recent one in which to 56. So we see we've made some bots. Part of the issue is they quickly they just run into each other because they all see, like the most Hal I TTE from the same position basically on these guys are probably full. Now would be my guess. Usually you can get Let's see. Yes. So these ships are full with Hal, I So Anyways, s o, the next thing is, we need to get these ships to actually start navigating back to the actual you know, the actual depot, or drop off location. So these are actually shipyards. And then, for some reason, I started calling them depots, and I have no idea. Fred cut that terminology from, but they're called drop offs and shipyards, but I'm gonna call him Depot is probably a lot, and I'm not sure why. But anyways, we need to turn these ships around and get them back to drop off and then come back out to collect more highlights. So that's why we're gonna be focusing on in the coming videos. Hopefully, my heirs weren't too annoying for you. Uh, but I I'm gonna leave him in. I'm not gonna edit those about because, um, you're gonna find that you've got to do a lot of debugging. Um, and this is not the easiest way to do the debugging. It won't be a way that you're used to sew because you can't just run this script straight. You've got to get the debugging error either from the console and then sometimes later on from here. Although the main error that I tend to get here is a time out. So if something's happening and you don't know why and you didn't get air in the console, you didn't get anything in your logs that would suggest what the air is. You go into replays and read the error log in there. You'll probably see that you timed out. But maybe something else, anyway. So I'm actually gonna leave those in because some of those were heirs that you'll probably come across, you know, maybe not the exact ones, but you'll come across airs like that and have to debug them. So anyway, uh, that's all for now, if you've got questions, comments, concerns, whatever, feel free to leave them below. Otherwise, I will see you guys in the next video where we, uh, one fix ships heading towards the same spot, but also to we're going to start working on sending them back and actually dropping off their highlight. Um, both of equal importance. We don't want to be our ships to be sinking, but we also I need to return our, you know, drop off the highlights. So that's we're gonna be doing the next tutorials. I will see you there.