Positioning problem with my waypoint creator?

Blitz3D Forums/Blitz3D Programming/Positioning problem with my waypoint creator?

Guy Fawkes(Posted 2011) [#1]
EDITED

Last edited 2011


Yasha(Posted 2011) [#2]
There are a couple of problems here...

On line 50, you create your waypoint marker spheres. But you aren't storing the spheres anywhere. Each iteration of the loop, the single variable "waypoint" is set to the value of the most recently created sphere, and overwritten with the next one next time.

On line 56, you call "PositionWaypoints", passing the last sphere only as the argument, each time. The loop inside PositionWaypoints does nothing, because there's no array for it to iterate over, so it's positioning the same sphere each time (and you should consider why there's a loop there anyway, since that function is called on each iteration of the outer loop, once per sphere).

Essentially, you need an array or list or something to store your sphere objects, so that the right one is positoned each time. At the moment, 24 of your spheres are simply lost to the ether, because CreateWaypoint is putting them each into the same variable, rather than an index on an array (compare "waypoint_array(amount) = CreateSphere(spheresmoothness)" on line 78, where waypoint_array is another array for spheres).


H&K(Posted 2011) [#3]
Thank you Yasha for line numbers.

@Rez, you may have missed this, but towards the end of the castle trees thread, I asked if you could post all you code with line numbers from now on, and for replies to refer to the line numbers.


Guy Fawkes(Posted 2011) [#4]
EDIT:

PROBLEM SOLVED =D

THANKS GUYS! =D



Last edited 2011


GfK(Posted 2011) [#5]
For future reference its etiquette to not delete your posts once you've solved a problem so it might help somebody else later.


Guy Fawkes(Posted 2011) [#6]
I know, but I am creating this as a commercial program :)


Ross C(Posted 2011) [#7]
I don't think a small piece of code in a forum is going to disadvantage you when it comes to selling your creation. It's about giving something back really. If someone spends their free time on here, helping, then it's nice to leave something behind for others who may struggle. That's my take on it anyway.


Guy Fawkes(Posted 2011) [#8]
I am, for you guys its a steal. I'm only making it $5 bucks, or $3 bucks. It will also have unlimited updates for life for free :)

Last edited 2011


H&K(Posted 2011) [#9]
Good, And it will also have all the posts you asked when writing it. UNLESS you remove them


Ross C(Posted 2011) [#10]
I suppose you kind of bugger up the search on the forums too. When someone searches for instance for "Problems with waypoints" and comes across the thread, it's just noise now.


GfK(Posted 2011) [#11]
I know, but I am creating this as a commercial program :)
So? You've asked for help (relentlessly, I may add), then see fit to delete posts when people help you?

I'm sorry but that's just bloody selfish.


Guy Fawkes(Posted 2011) [#12]
No, I delete posts that contain the entire code.


Guy Fawkes(Posted 2011) [#13]
Ok, how do I get it so if the player comes within 5 feet of a given waypoint, it allows the enemy to chase you up until the distance of the enemy and the player is = 2, and if either the player gets too far away from the enemy, OR the enemy gets too far away from its waypoint, it goes back to its waypoint?

This is NOT the whole code, as we have had some misunderstandings before.

SO.

Here is ONLY the way the waypoints are created, the mainloop, and the 2 NEW functions (AttractToPlayer() & GoBackToWaypoint()).

These functions are supposed to do what their names say.

This one and any other ones, I will be leaving up, as to not have another misunderstanding.



Thanks Guys! :)

EDIT: And YES, the player is the camera

Last edited 2011


stayne(Posted 2011) [#14]
If the enemy knows the x,y,z of the location it wants to be at, it can get to it whether it is a player to chase or a waypoint to walk to.

You need to use states: angry and not angry. If angry, run to the player. If not angry (player died, or distance between the player gets long enough, or been in angry/running mode for too long, etc.), return to a waypoint.

Once you figure that logic out you are going to realize there are many more AI obstacles FAR more advanced and nerve-wracking than simple Everquest mob logic to deal with. Entity avoidance is a hard one. Ensuring a group of monsters don't come together as one and become impossible to select when chasing the player. Ensuring they don't walk thorough buildings, trees, rocks, etc. Ensuring they don't run in a straight line when chasing the player (if they get stuck between two rocks, hello cheatville).

Rez you are taking on something that is very advanced.


Guy Fawkes(Posted 2011) [#15]
LMAO! I use AWC for bezier waypoints ;) Its just regular waypoints that bother me :3