[RM2K3 DYNRPG] LINE OF SIGHT PLUGIN REQUEST

Posts

Pages: first prev 12 last
author=bulmabriefs144
It detects whatever you want it to detect. Stop being a naysayer.
author=bulmabriefs144
If you can get this one working, you don't need terrain detection, you just set the terrain zone as if there is a solid object in the way

You're kind of contradicting yourself here. Essentially he's right, you're not detecting any terrain, you're just working around it in a painful way.

author=bulmabriefs144
This is the equivalent of what you're doing.

I'm not sure whether this was just your way of introducing your method, or stating that your method is in practice equivalent with that of the tutorial, but if the latter, then it's still significantly inferior. The fact that yours is based on rectangular zones alone is a reason for this, as it prevents looking around corners in the same way without making multiple zones, for some obstacles quite many even. Also, the setup itself will end up making your method even more complicated than the tutorial solution the more you try to approximate it correctly.

For a certain kind of rooms and line of sight detection needed, your solution works fine, but for more general situations or room with arbitrary obstacles it works pretty poorly.

Nightowl
Anyone?
*crickets*

I made a tiny attempt at this. It's still has a few flaws (if you're standing on one of the "wall autotiles" you/the target becomes invisible for example), but I'm out of time again. Despite the flaws it should be usable to some extent though.
download
It's does stuff pretty much the same way the tutorial does, except that the plugin detects if the tile has been set to passable or unpassable and determines if you can see through the tile this way. The download contains a tiny demonstration showing how it can be used

Instructions on usage is contained within the ReadMe file.
Can you add my code to your code then?

I at least wanna use it that way. It's handy for long cooridors, for targetting monsters and for areas where I wanna make an invisible maze.

Also, I might wanna create fixed zones (like when you wander in the middle of a large bright area, in Zelda: A Link To The Past and it sets of the boss event if you have the "girl" in your party), or non-standard LOS detection, where it ordinarily would be blocked by terrain (i.e. this guy can see through walls but can only see 5 ft in front of him).

Oh, hell, nvm. I'll look at your source code, and figure out how to fix the variables in mine. Only, you don't have any source that I can see, so I still dunno how to compare to the x/y of the Hero.
Uh... what prevents you from seeing down long cooridors with the current solution?
As for being able to watch through impassable walls (invisible, glass, whatever), this can be kind of done at the moment, by using the directional passable arrows in a way.
Only entirely impassable tiles blocks the sight, so as long as there's at least one passable arrow on the tile, it's possible to see through it.
I wanna use it the way I wanna use it.

Could you help me finish my code? The rest of the people here can use your code, and that's fine. But I'm missing the one variable (the Hero x/y and Event x/y) that would help me finish my code, and that's frustrating.

http://rpgmaker.net/media/content/users/3388/locker/line_of_sight_still_unfinished.rar

I've preprogrammed my guards to have very specific points that they look at, based on where they are, updating at specific points. Redoing it, with the radius system is a non-option because if I make an error, I have to wipe over the thing because the radius is not right. Or because it didn't count a shadowed area as a genuine barrier. I also like having direct control over the process rather than relying on the radius.

Also, I have areas that I still have to make multiple codes, because it'd be radius 4 nearby, and radius 2 off in the distance. Or a radius 1 box around the target (hearing rather than sight) plus a radius 2 in front of him.

You can make all kinds of reasons, but the fact of the matter is, it's important to me to figure out this system, and finish what I started.

Also, I haven't gotten to experiment with any C++ codes lately, and just accepting your code would bore the hell outta me.

author=bulmabriefs144
Oh, hell, nvm. I'll look at your source code, and figure out how to fix the variables in mine. Only, you don't have any source that I can see, so I still dunno how to compare to the x/y of the Hero.

If you didn't understand the tutorial, the source won't be of any help to you at all. There's not a single comparison being made towards any x/y of the hero or any of the events.

Watching through impassable terrain is still possible in the way I described above.
Also, there's a larger risk of making errors with these zones of yours. Rather than wiping, you should just copy a map to test it out whether it works out, and if not, just delete the map, and keep working on the old one. Also, since the only thing happening upon being in the line of sight is a switch being turned on, you're still able to check if you're in some kind of safe zone.

Anyway, the probable reason why your code isn't working is cuz you check for
EventY >= EventLosX1
rather than
EventY >= EventLosY1
(3rd condition in your if statements)
didnt look too through the rest though, so dunno if you have more bugs in there

edit: You edit your posts quite frequently. And yes, I find it good that you're trying to complete it, since you've first started it anyway. It's the right attitude towards learning something, which is always a good thing to have.

Once you're done with it though, you'll still have to face that it is a rather tedious method to use, despite the effort having been put into making it. Also, rather than accepting my code, you could try to take another look at the tutorial, or google similar stuff online to get it explained by people who are better at explaining than me.
I cannot do anything but to really recommend learning a few mathematical stuff, especially trigonometry, for anyone venturing down the more technical road of game making.
Nightowl
Remember when I actually used to make games? Me neither.
1577
The plugin is pretty cool, thanks Kazesui.

I just realized that you could also use it to create a targeting system for enemies, either by making them prioritize targets or just going all "eeny-miney-mo."
I've experimented with auto targetting for ABS systems in the past (pre dynrpg), and it's perfectly possible as well, probably even a bit easier with the line of sight plugin working its magic.

If you're capable of using pointers, you could keep track of how many enemies are within your range, and then switch between them using the shift button or so (which is what I did back then).
You could also just target the closest one (just a matter of doing computing distance between all enemies with line of sight), but that could probably get annoying as well if you have to enemies very close which it keeps alternating between. Eeny meeny mo could get quickly annoying unless you add a button to switch enemies (given that it locks on the enemy once chosen though)
Nightowl
Remember when I actually used to make games? Me neither.
1577
I was rather meaning that the enemies would pick targets, but I guess it would work also for heroes.

But instead, I'm going to use the mouse plugin for attacking. Whenever the player clicks an enemy and shoots, the ABS is going to use the LoS plugin to check whether the shot enemy is within the character's line of sight. If so, it hits. If not, it obviously misses.
As for melee, I'll probably make some sort of targeting system. If the enemy is few tiles away, the character will leap forward and attack, similar to Dark Cloud.

The controls would be kinda like Dead Rising, mouse for attacking, WASD for moving and probably E for interacting with stuff. Mouse scroll would probably change items, if the mouse & keyboard plugin has support for scroll, that is.
author=Kazesui
author=bulmabriefs144
Oh, hell, nvm. I'll look at your source code, and figure out how to fix the variables in mine. Only, you don't have any source that I can see, so I still dunno how to compare to the x/y of the Hero.
If you didn't understand the tutorial, the source won't be of any help to you at all. There's not a single comparison being made towards any x/y of the hero or any of the events.

Watching through impassable terrain is still possible in the way I described above.
Also, there's a larger risk of making errors with these zones of yours. Rather than wiping, you should just copy a map to test it out whether it works out, and if not, just delete the map, and keep working on the old one. Also, since the only thing happening upon being in the line of sight is a switch being turned on, you're still able to check if you're in some kind of safe zone.

Anyway, the probable reason why your code isn't working is cuz you check for
EventY >= EventLosX1
rather than
EventY >= EventLosY1
(3rd condition in your if statements)
didnt look too through the rest though, so dunno if you have more bugs in there

edit: You edit your posts quite frequently. And yes, I find it good that you're trying to complete it, since you've first started it anyway. It's the right attitude towards learning something, which is always a good thing to have.

Once you're done with it though, you'll still have to face that it is a rather tedious method to use, despite the effort having been put into making it. Also, rather than accepting my code, you could try to take another look at the tutorial, or google similar stuff online to get it explained by people who are better at explaining than me.
I cannot do anything but to really recommend learning a few mathematical stuff, especially trigonometry, for anyone venturing down the more technical road of game making.


Well, that might be part of what's making it not work. But the other part is that Cherry has documented RPG::Characters(which inherits to Hero and something else)::x and RPG::Characters(Hero)::y. There's a few problems with, well I wanna assign/define that as HeroY (since putting namespaces in if statements often has a tendency to fail. I also wanna make it so it chooses the events but number (Event 1 = chicken for instance) I don't really know the correct namespace, so it kinda fails.

And yea, I edit alot.
not really a namespace problem. RPG is the namespace, and that's it. What you don't know is the correct syntax.

int x = RPG::hero->x;
int y = RPG::map->events[id]->y;


This is should be about what you have to do to get the tile coordinates of either the hero or an event, with "id" being a variable with the eventID of interest stored in it.
Thanks, that should help. I'll fiddle around with things at my end until I get stuff working. (Yeah, my syntax is horrible)

That didn't really work. At all. I mean, it loaded, but it didn't really do anything. So I tried rearranging it so it was X Y range. Nothing.

...Ohhhhh. I had an event that redefined the x and y (the old one). It was somehow interfering with the new one and producing alot of crap. I removed that, and the event immediately worked. Well, not immediately. The guard had to turn around.

Meh... something's still wrong (I'm standing outside the range and it's turning on). Holdon.

int HeroX = RPG::hero->x;
int HeroY = RPG::hero->y;
//Next, define the parsed data
int HeroLosX1 = parsedData->parameters[0].number; //not an rpg variable,
int HeroLosX2 = parsedData->parameters[1].number;
int HeroLosY1 = parsedData->parameters[2].number; //so it doesn't use up anything
int HeroLosY2 = parsedData->parameters[3].number;
int HeroSwitch = parsedData->parameters[4].number;


if ((HeroLosX1 <= HeroX && HeroX <= HeroLosX2) && (HeroLosY1 <= HeroY && HeroY <= HeroLosY2)) //if ALL conditions are true
{
RPG::switches[HeroSwitch] = true; //makes a box
}
else
{
RPG::switches[HeroSwitch] = false; //makes a box
}

return false;
}

Okay... no. Whatever I tried seemed to reset the thing so rather than looking for the hero INSIDE the zone (which would have been simple, though cumbersome with rpgmaker) instead resulted in a brain fart on the part of C++. It apparently wanted me to do HeroLosX1 <= HeroX OR HeroX <= HeroLosX2 (which resulted in literally any number) when I'm pretty sure I said AND.

I'm going with my own RPG code, or Kazesui's plugin. This C++ code is stupid.
Bump. I'm gonna retry this. If I can get it to work, that would pretty much solve my problems.

I'll try it later.
Pages: first prev 12 last