and something like that will work without getting super specific and messing it up like i did?
btw thx for looking at this lummox you've been the most help for my problems.
1
2
In response to Lummox JR
|
|
In response to Jp
|
|
You're still off, Jp. The flag is not the atom that's entering. And in any case, doing repetitive code for multiple type paths is just plain ridiculous. This calls for a design change.
Lummox JR |
In response to Lummox JR
|
|
It could be the atom entering, though - I'm fairly sure he wants to drop the flag on the CTF turf thingy, and that the other flag also needs to be on the turf for it to work. So I set up drop so that the flag does, in fact, call Entered(), and then checked there.
|
In response to Jp
|
|
Jp wrote:
It could be the atom entering, though - I'm fairly sure he wants to drop the flag on the CTF turf thingy, and that the other flag also needs to be on the turf for it to work. So I set up drop so that the flag does, in fact, call Entered(), and then checked there. This generally is not the mechanic of a CTF game. Most such games would not have you 1) drop the flag, or 2) drop it on a square already containing another flag. Rather, they'd just have you walk into a base area. Lummox JR |
In response to Lummox JR
|
|
Ok, I'm doing this similar to the way it is on a NON byond game but I'm sure it will work using byond. Here is what i want to do:
When the player enters the special turf, if the opposing teams flag (if their team is red, then the green flag) is in their inventory and their teams flag (in this example, red) is on the turf they just entered (the special CTF turf), then it will remove the opposing teams flag from their inventory, and add a point to their team. I don't think I can get much more specific than that. That is exactly what I'm trying to do. Thanks much guys. |
1
2
No put usr in proc. Ungh.
Okay, now to the meat of it. CaptFalcon's code is a complete disaster; don't use it. Let's go over some of the obvious problems:
Well here's a huge problem already. Whenever you're using the in operator within a more complicated if() statement, you need to surround the expression with parentheses, like so:
Then of course, you should not check if A==locate(87,76,3), since that would be a turf, and A is clearly not a turf because it's the atom entering src.
Above that we have this:
Why would you want to locate flags in the world when you can locate them within the mob that's entering, which is the point?
Beyond that, though, there are some major design flaws you need to address. You made the right move in giving mobs a Teamcolor var, but you didn't take that concept far enough; all atoms should have that var. Then you can give turfs, flags, defenses, etc. team colors. Hard-coding the flags to /obj/item/furniture/CTF_Red_Flag and /obj/item/furniture/CTF_Green_Flag is simply a very bad idea. And instead of hard-coding base locations, you should simply keep the base location stored in a var.
Where scores and such are concerned, do not use separately named vars like red_team_points and green_team_points. Instead, you can do this right one of two ways. The first is to use an associative list, e.g. points["Red"], but the other is to create a datum. A datum is probably closer to what you really need:
Ideally, then, your code would look more like this:
Notice how clean that code is. It also supports a CTF mode with more than two teams.
Lummox JR