need help converting waypoint code from c++ to b3d
Blitz3D Forums/Blitz3D Beginners Area/need help converting waypoint code from c++ to b3d
| ||
hi all. can someone help me translate this from c++ to b3d? i tried, and failed miserably as u can see. i need for the player to be a cube, and the camera to follow the player. what this code does basically is makes a player follow multiple waypoints. its a test for further ai in my actual game. |
| ||
You haven't failed until you have tried. There's so much c++ still in there that it's pretty obvious where it's going to fail. I would start by learning B3D, then C++. |
| ||
anyone other than john galt? that didnt help much. i DID too try to convert it. LOOK AT THE CODE BEFORE U COMPLAIN.. -.- |
| ||
Rez..try to draw some block diagram of waypoint system flow/execution you want(because there is many kind of waypoint systems out there) and from there simply build your Type structures, one by one and make it work...conversion will not help you, most probably because conceptually it seems you dont understand it...best way should be as i mentioned, and once you do it, you will understand why it was a necessary step... |
| ||
Is that code you listed your attempt to convert into B3D, or the C++ code you're trying to convert? If it's the former, how did you "try to convert it"? By leaving it under your pillow and hoping the C++ fairy would take it away and leave you B3D code? Even *you* know there's no 'struct' keyword in Blitz. No 'void'. No ++ unary operator. etc etc etc Throwing a random Graphics3D() in there does not an attempt to convert make. If not - if, in fact this is supposed to me more-or-less the exact C++ code you're trying to convert, what does i DID too try to convert it. LOOK AT THE CODE BEFORE U COMPLAIN.. -.- mean?No, you've made no substantive attempt to do anything, and any attempt to 'help' you would require that 'helper' to just convert it for you holus bolus... and then debug it for you when you try to change it without knowing what it does. Try harder. |
| ||
i do not know c++. and yes i did attempt to change it. there's this little thing at the bottom of the c++ code called BLITZ code. u know that thing that im having a problem converting? -.- |
| ||
Seriously? That's "try" to you? It all becomes clearer. And here I was thinking you were just being lazy. ... In the spirit of not being a total troll, I'll mention some stuff you may or may not have noticed in your 1600+ posts over the last year: - Blitz doesn't have a 'struct' data type. Think of a C++ 'struct' as a 'type' in Blitz. - Blitz doesn't require the end of each line to be delimited with a semicolon. - Blitz doesn't natively have a #define function. Use a constant. - Blitz doesn't use 'void' as a keyword. - Blitz doesn't use the blah.blah method of accessing fields in types - think blah\blah instead - Blitz doesn't use pointers - at least, nothing like in the way C++ does (insofar as it doesn't use ->) - Blitz doesn't use the ++ unary operator to increment variables - Blitz doesn't group blocks of code together with braces ( In your attempts to code in Blitz over the last 12 months, you didn't come across any of these? In your attempt to "try" to convert this code you couldn't change i++ into i=i+1 even? Apart from a randomly-placed Graphics3D() and Flip(), some ridiculously useless commenting (yes, that's how I'm choosing to interpret it) and some meaningless Type declarations situated either after or within the main loop (I honestly can't see clearly enough to tell, and I'm not going to spend any more time on looking than I have), what exactly did you do to "try" to convert this stuff? And you wonder why people would rather sit in a corner with a pencil in their eye. |
| ||
@ Rez, is this really as far as you got? Global Player_Speed# = 2.0 Type Waypoint Field x# Field y# Field z# End Type Type WaypointList Field x# Field y# Field z# End Type Dim Vector(2) Function addWaypoint(p.WaypointList, x#, y#, z#) That is an extemely poor attempt and noone would be helping you by writing it for you. I think you need to re-evalute what you would like to achieve in programming. Are you really learning anything with your countless 'what's wrong with this' posts? Learning any language takes alot of time and effort, neither of which you seem willing to put in. I'll leave you to it. |
| ||
anyone else care to help with converting this code who's not gonna give problems? these forums are for HELP, not for u to be a jerk |
| ||
Well at least you're consistent; your attitude to "trying" hasn't changed since your very first post. |
| ||
again, anyone else who's not going to be a jerk? |
| ||
No, no-one. No-one who's ever encountered you before, anyway. |
| ||
ignoring that comment, anyone else? |
| ||
Have you at least fixed up the stuff I listed? You could be going through that while you're waiting. |
| ||
You will need to at least address the obvious stuff here, and convert that. Only then will you get any further. |
| ||
Here's the obvious stuff. I don't understand ANYMORE than that. |
| ||
PointEnt(player, wl.x+i->x, wl.y+i->y, wl.z+i->z); - Blitz doesn't use pointers - at least, nothing like in the way C++ does (insofar as it doesn't use ->) Forgetting even that, though, you're not making any attempt to do anything at all. No-one wants to write your code for you. The very least you could do is write out what you're trying to do in pseudocode (forget the specifics of Blitz and C++ for now), to show people you have the faintest idea of what you're trying to do. And no, not in some airy-fairy "I want to make waypoints" sort of way. No, in a step-by-step "I actually understand what programming is, even if I can't actually do it yet" sort of way. |
| ||
I am trying to make a player that follows seven waypoints in a circle ONE time.. that is ALL. |
| ||
LineOf7s has been more than helpful with his list of conversions. You didn't even bother replacing the C++ // style comments with the B3D equivalent. A 5 year old, albeit a less lazy one than you, could manage that. HELP!=write the whole thing for you. What you last posted is just some random bit of code and nothing to do with a conversion of the C++ code. |
| ||
ignoring that comment, anyone else who is nice AND HAS A BIT OF PATIENCE?! |
| ||
First of all, throw that C++ garbage out. Even if you successfully convert it to .bb code, you probably wouldn't undertand it 100% because it's not written by you. If you don't know C++ and can't understand it, you might as well be translating Japanese into Portuguese. Don't use it. Pseudocode: First create 7 waypoints. Make them visible for test purposes. Test your code. If 7 waypoints are created and visible, then go to step 2. Step 2. Create a player or NPC. Test your code. If you have 7 waypoints and a character that just stands there, go to step 3. Step 3. Get your player to POINT at, the MOVE to waypoint 1. TEST YOUR CODE. If you have 7 waypoints, a player, and a player that goes to waypoint 1, go to step 4. Step 4. Get the player upon reaching waypoint 1 to FACE waypoint 2 and MOVE towards it. If you have 7 waypoints, a player, a player that moves to waypoint 1 and only after reaching waypoint 1 POINTS and MOVES to waypoint 2, go to step 5. Step 5. Get the player to continue moving to each waypoint. After adding the code for EACH ONE. TEST YOUR CODE. You MUST test your code often to narrow down any possible problems you will have. In a program this simple there's no reason you cannot test your code after each step. This cannot be explained any simpler. Have a go at it. |
| ||
I genuinely cannot way to see what will be here to greet me when I awake. :o) I sincerely do hope it's some attempt by Rez of having a go, as we all like to see people progress. Fingers crossed. |
| ||
ignoring that comment |
| ||
Rez that wasn't a snide remark by LineOf7's. LineOf7's said: I sincerely do hope it's some attempt by Rez of having a go, as we all like to see people progress. We want to see that you're learing. |
| ||
Here is a complete example that: - creates 7 waypoints (all in front of the player and a bit left/right) - the player moves towards the next waypoint - when the player reached this waypoint, select the next waypoint - when the player has reached the last waypoint, his target becomes the first waypoint NOTE: The player turns instantly, there's no gradually turning in this example. ; Setup graphics Graphics3D 800, 600, 0, 2 SetBuffer BackBuffer() ; Setup Waypoint type structure Type TWayPoint Field X#, Y#, Z# Field Entity End Type ; Create an array that can hold 7 waypoint instances Dim AWayPoints.TWayPoint(7) ; Fill the array with 7 waypoint instances and position them For i = 1 To 7 AWayPoints(i) = New TWayPoint AWayPoints(i)\X# = Rnd(-10.0, 10.0) AWayPoints(i)\Y# = 0.0 AWayPoints(i)\Z# = i * 20.0 AWayPoints(i)\Entity = CreateSphere() PositionEntity AWayPoints(i)\Entity, AWayPoints(i)\X#, AWayPoints(i)\Y#, AWayPoints(i)\Z# EntityColor AWayPoints(i)\Entity, 0, i * 35, 0 Next ; The number of the waypoint that the player will move to Global CurrentWayPoint = 1 ; Create the player and the camera Global player = CreateCube() Global camera = CreateCamera(player) PositionEntity camera, 0.0, 10.0, -20.0 PointEntity camera, player While Not KeyHit(1) ; Check the distance between the player and the waypoint to which the player should move If EntityDistance(player, AWayPoints(CurrentWayPoint)\Entity) > 0.3 Then ; If the player hasn't reached the waypoint yet, keep movinjg the player towards the current waypoint PointEntity player, AWayPoints(CurrentWayPoint)\Entity MoveEntity player, 0, 0, 0.1 Else ; If the player has reached the waypoint, select the next waypoint CurrentWayPoint = CurrentWayPoint + 1 EndIf ; If the player has reached the last waypoint, start again from the first waypoint If CurrentWayPoint = 8 Then CurrentWayPoint = 1 RenderWorld ; Debug-info Text 10, 10, "Now moving towards waypoint: " + Str$(CurrentWayPoint) + " with color: 0, " + Str$(CurrentWayPoint * 35) + ", 0" Flip Wend End This was created in less than half an hour (from scratch, I didn't even look at the C++ code as I don't understand C++). |
| ||
thank you, powerpc, at least u & drak are nice enough to help! UNLIKE ALL U JERKS! |
| ||
That's done on purpose to show how your player can follow waypoints. To reply your comment: in the description above the code it clearly states: "when the player has reached the last waypoint, his target becomes the first waypoint". So there was no flaw in the logic. I can simply adjust the code that follows the waypoints backwards. ; Setup graphics Graphics3D 800, 600, 0, 2 SetBuffer BackBuffer() ; Setup Waypoint type structure Type TWayPoint Field X#, Y#, Z# Field Entity End Type ; Create an array that can hold 7 waypoint instances Dim AWayPoints.TWayPoint(7) ; Fill the array with 7 waypoint instances and position them For i = 1 To 7 AWayPoints(i) = New TWayPoint AWayPoints(i)\X# = Rnd(-10.0, 10.0) AWayPoints(i)\Y# = 0.0 AWayPoints(i)\Z# = i * 20.0 AWayPoints(i)\Entity = CreateSphere() PositionEntity AWayPoints(i)\Entity, AWayPoints(i)\X#, AWayPoints(i)\Y#, AWayPoints(i)\Z# EntityColor AWayPoints(i)\Entity, 0, i * 35, 0 Next ; The number of the waypoint that the player will move to Global CurrentWayPoint = 1 ; Direction is True when moving forward, False when moving backward Global Direction ; Create the player and the camera Global player = CreateCube() Global camera = CreateCamera(player) PositionEntity camera, 0.0, 10.0, -20.0 PointEntity camera, player While Not KeyHit(1) ; Check the distance between the player and the waypoint to which the player should move If EntityDistance(player, AWayPoints(CurrentWayPoint)\Entity) > 0.3 Then ; If the player hasn't reached the waypoint yet, keep movinjg the player towards the current waypoint PointEntity player, AWayPoints(CurrentWayPoint)\Entity MoveEntity player, 0, 0, 0.1 Else If Direction = True Then ; If the player has reached the waypoint, select the next waypoint CurrentWayPoint = CurrentWayPoint + 1 Else CurrentWayPoint = CurrentWayPoint - 1 EndIf EndIf ; If the player has reached the last waypoint, start again from the first waypoint Select CurrentWayPoint Case 8 Direction = False CurrentWayPoint = 6 Case 0 Direction = True CurrentWayPoint = 2 End Select RenderWorld ; Debug-info Text 10, 10, "Now moving towards waypoint: " + Str$(CurrentWayPoint) + " with color: 0, " + Str$(CurrentWayPoint * 35) + ", 0" Flip Wend End |
| ||
Ungrateful git. Anyone else think this guy's just a troll with WAAAAY too much time on his hands? |
| ||
ur the ungreatful "git".. HA! GIT! I LAUGH at ur stupidity |
| ||
I never realized how much B3D can do; it does most of the vector math for you. |
| ||
It would appear the PowerPC603 has provided you with a solution. And I'm sure you mean 'ungrateful'. Regards |
| ||
ur the ungreatful "git".. HA! GIT! I LAUGH at ur stupidity The sheer irony of this statement made me laugh so hard I probably woke up the neighbors. But this is why I visit the B3D forums in the first place. |
| ||
i couldn't agree more! ROFL! |
| ||
-sigh- |
| ||
Rez, do you not try to understand why the people here, who have been here longer than you, are saying what they say? They have way more experience and have tried to help other people just like you who bombard the forums with questions about basic programming skills. I never even started posting until I learned a lot about Blitz3D... mostly because I only had the demo but that was all I needed. But anyways, I've seen some of the posts other people similar to you have made. Don't bother fighting in the forums, it's pointless. If you see a comment that "looks" insulting, read it again and think about what they are saying to you and think about it from their perspective. Stop being so sensitive. |
| ||
I second that. |
| ||
yea, well i dont. and do u know why? BECAUSE FORUMS ARE FOR HELPING PEOPLE! NOT TELLING THEM TO SCREW OFF! GOD! |
| ||
Give a man a fish and he can eat for a day. Teach a man to fish and he can eat forever. The folks here are trying to teach you how to fish because most of them are tired of giving you fish after fish after fish. Have you ever noticed that these sort of topics don't happen anywhere but on your posts? |
| ||
Rez, correct me if I'm wrong, but you're the only one here being insulting when people are giving you sensible advice. Because it's not simply the answer you want there is no need to resort to these style of comments. It's not a criticism, just some advice. Ideally, the best solution is some gentle help whereby you solve the problem yourself & you can take that experience and apply it to any other problems you may encounter in the future. |
| ||
AGAIN. STOP TELLING PEOPLE TO SCREW OFF! |
| ||
Right, lets start again, what in particular do you need help with? |
| ||
i simply want a player to follow 7 waypoints that are placed in a circle ONE time, and if they reach the 7th waypoint, make the player turn around, and reverse that waypoint depending on if a variable is set to 1 (which makes it move forward. or 2 which makes it move backward. |
| ||
Do you have the code you are currently working from? |
| ||
I have this one which Powerpc kindly gave to me, but it's modded a bit. i couldn't fix where after 7 waypoints, it sends the player back to the 1st waypoint, but DOESN'T follow the waypoint track again. so I made it stop at 7. instead of following it infinitely, it needs to have a variable to tell it to go forwards or backwards and stop. |
| ||
This appears to work... The Entity now runs back and forth along the way points. Regards |
| ||
thanks alot, yeshu |
| ||
Try it and see if does what you're asking. Regards, |
| ||
Yum fish. |
| ||
8o) |
| ||
here is VERY good example for waypoints system and 2 meshes are added as an example (it can be any number)..just copy/paste and compile to see..no media required..I really hope you will get it this time..;(WayPoint example with camera observing) Graphics3D 800,600,16 SetBuffer BackBuffer() Const UPS=60 Global Mesh_Player,Mesh_Flag Type PlayerIA Field Entity Field Name$ Field PosX#,PosY#,PosZ# Field AngX#,AngY#,AngZ# Field TargetX#,TargetY#,TargetZ#;Position Field Target Field Life Field Speed# Field ControlJoueur Field Chemin Field Flag_enCours Field Chemin_Trajet Field Chemin_Sens Field SensRotation End Type Type Flag Field Entity ;graphical representation of waypoint Field PosX#,PosY#,PosZ# ;Position Field Path_Id ; Id Field Flag_Order End Type Type Chemin Field Name$ Field Path_ID Field ColorR,colorG,colorB End Type camera=CreateCamera() TurnEntity camera,45,0,0 cam_d#=30 light=CreateLight() TurnEntity light,45,45,0 Mesh_Player=CreateSphere() ScaleMesh Mesh_Player,.75,1,2 PositionEntity Mesh_Player,0,1,0 EntityShininess Mesh_Player,1 EntityColor Mesh_Player,192,0,255 HideEntity Mesh_Player Mesh_Flag=CreateCone(32) ScaleEntity Mesh_flag,.5,.5,.5 HideEntity Mesh_flag grid_tex=CreateTexture( 32,32,8 ) ScaleTexture grid_tex,10,10 SetBuffer TextureBuffer( grid_tex ) Color 0,0,64:Rect 0,0,32,32 Color 0,0,255:Rect 0,0,32,32,False SetBuffer BackBuffer() grid_plane=CreatePlane() EntityTexture grid_plane,grid_tex EntityBlend grid_plane,1 EntityAlpha grid_plane,.6 EntityFX grid_plane,1 mirror=CreateMirror() InitChemin() While Not KeyDown(1) UpdateWorld RenderWorld For p.playerIA=Each playerIA suivrechemin(p) If p\name="Totor" Then PositionEntity camera,EntityX(p\entity)-5,0,EntityZ(p\entity) MoveEntity camera,0,0,-cam_d End If Next Flip Wend Function InitChemin() createchemin("CheminTest",1,0,0,255) createflag(1,50,5,50) createflag(1,50,5,100) createflag(1,100,5,100) createflag(1,100,5,50) createPlayerIA("Totor",1,5,5,5) createchemin("CheminTest2",2,0,255,0) createflag(2,50,5,130) createflag(2,100,5,140) createflag(2,40,5,80) createflag(2,80,5,50) createPlayerIA("Totor2",2,5,5,5) End Function Function CreateFlag(id,X#,Y#,Z#) f.Flag=New Flag f\entity=CopyEntity(Mesh_Flag) For c.chemin=Each chemin If c\path_Id=id Then EntityColor f\entity,c\colorR,c\colorG,c\colorB End If Next f\Path_Id=id f\Posx#=X f\Posy#=Y f\Posz#=Z PositionEntity f\Entity,f\Posx#,f\Posy#,f\Posz# f\flag_Order=CheminCountFlag(Id)+1 End Function Function CreateChemin(Name$,Path_ID,colr=0,colg=0,colb=0) c.chemin=New chemin c\Name$=name$ c\path_id=path_id If colr+colg+colb=0 Then c\colorR=Rand(50,255) c\colorG=Rand(50,255) c\colorB=Rand(50,255) Else c\colorR=colr c\colorG=colg c\colorB=colb End If End Function Function SuivreChemin(e.playerIA) versflag(e) TurnVersPosition(e,e\Targetx,e\targety,e\targetz) MoveEntity e\entity,0,0,e\speed PositionEntity e\entity,EntityX(e\entity),2,EntityZ(e\entity) If calculdistance(e\entity,e\Targetx,e\targety,e\targetz)<5 Then If e\chemin_sens=1 Then If e\flag_encours>CheminCountFlag(e\chemin) Then e\chemin_sens=-1 End If Else If e\flag_encours<=0 Then e\chemin_sens=1 End If End If e\flag_encours=e\flag_encours+e\chemin_sens End If End Function Function VersFlag(e.playerIA) For f.flag=Each flag If f\Path_Id=e\Chemin And f\flag_Order=e\Flag_enCours Then e\target=0 e\targetx#=f\Posx# e\targety#=f\Posy# e\targetz#=f\Posz# End If Next End Function Function CheminPath_ID(Name$) For f.Chemin=Each Chemin If f\name$=name$ Then Chemin_Id=f\path_Id Next Return Chemin_Id End Function Function CheminCountFlag(Id) NbFlag=0 For f.flag=Each flag If f\path_id=Id Then NbFlag=NbFlag+1 Next Return NbFlag End Function Function CheminCountChemin() NbChemin=0 For f.Chemin=Each Chemin NbChemin=NbChemin+1 Next Return NbChemin End Function Function TurnVersPosition(e.PlayerIA,x#,y#,z#) RotateEntity e\entity,0,EntityYaw(e\entity)+Abs(e\sensrotation)*where_to_turn(e\entity,x#,y#,z#),0 End Function Function where_to_turn(source_pivot,x#,y#,z#) temp = CreatePivot() PositionEntity temp,EntityX(source_pivot),EntityY(source_pivot),EntityZ(source_pivot) pointatposition(temp,x#,y#,z#) s = Floor(EntityYaw(source_pivot)) t = Floor(EntityYaw(temp)) FreeEntity (temp) If s = t Then Return 0 EndIf If s < 0 Then s = 360 + s If t < 0 Then t = 360 + t If Abs(s-t) > 180 Then If s > t Then Return 1 ;turn left Else Return -1 ;turn right EndIf Else If s > t Then Return -1 ;turn right Else Return 1 ;turn left EndIf EndIf End Function Function PointAtPosition(entity,x#,y#,z#) xdiff# = EntityX(entity,1)-x# zdiff# = EntityZ(entity,1)-z# dist#=Sqr#((xdiff#^2)+(zdiff#^2)) RotateEntity entity,ATan2((EntityY(entity,1)-y#),dist#),ATan2(xdiff#,-zdiff#),0 End Function Function CalculDistance#(entity,x,y,z) Distance#=Sqr((EntityX(entity)-x)*(EntityX(entity)-x)+(EntityY(entity)-y)*(EntityY(entity)-y)+(EntityZ(entity)-z)*(EntityZ(entity)-z)) Return Distance# End Function Function createPlayerIA(name$,cheminID,pX#,pY#,pZ#) B.PlayerIA=New PlayerIA B\Entity=CopyEntity( Mesh_Player) B\Chemin=cheminID B\flag_encours=2 B\Chemin_Sens=1 B\Chemin_trajet=CHEMIN_ALLER_RETOUR B\name=name B\Target=0 B\Posx#=pX# B\Posy#=pY# B\Posz#=pZ# B\targetx#=B\Posx# B\targety#=B\Posy# B\targetz#=B\Posz# B\SensRotation=2 B\Speed#=.2 ;EntityRadius B\Entity, 1;,.3 PositionEntity B\Entity,B\Posx#,B\Posy#,B\Posz# B\AngY#=pangy# RotateEntity B\entity,EntityPitch (B\entity),B\AngY#,EntityRoll (B\entity) End Function |
| ||
Thats a pretty good example. Regards, |
| ||
i agree, thanks yeshu & naughty alien |
| ||
..or this one, set for exactly 7 points (again, it can be ANY number)..this one is a bit more simple..I hope this HELPS..anyway, I can keep 'flooding' you with examples, but unless you spend some time and realize how it works actually, I hardly doubt it will be any use of it..so, its for sake of your complaining about 'unfriendly forum'..Graphics3D 800,600,32,1 SetBuffer BackBuffer() SeedRnd MilliSecs() Const MAX_POINTS = 7 ; set this to however many waypoints you want(7 points only for Rez) ; ************************************************************************************************** ; TYPES ; ************************************************************************************************** Type waypoint Field entity Field number End Type Type player Field entity Field x#,y#,z# Field nextpoint End Type ; Create the "player" - the one who will walk the waypoints Global p.player=New player p\entity=CreateSphere() ScaleEntity p\entity,2,2,2 EntityColor p\entity,100,255,255 EntityShininess p\entity,1 ; set the player's next waypoint at 1...or whatever number you like p\nextpoint = 1 ; since we need to see what's going on, create a camera Global camera = CreateCamera() CameraZoom camera,1.6 PositionEntity camera,0,1,-200 ; ...let there be light! light=CreateLight() PositionEntity light,0,90,0 RotateEntity light,90,0,0 ; Create the waypoints createWaypoints() ; move the mouse to the center of the screen before the main program runs ; this way we can be sure that we are not going to be facing some odd direction MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 While Not KeyHit(1) If KeyDown(200) Then MoveEntity camera,0,0,1 ; up arrow If KeyDown(208) Then MoveEntity camera,0,0,-1 ; down arrow If KeyDown(203) Then TurnEntity camera,0,1,0 ; left arrow If KeyDown(205) Then TurnEntity camera,0,-1,0 ; right arrow mxs#=-MouseXSpeed()*.25 mys#=MouseYSpeed()*.25 MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 TurnEntity camera,mys#,mxs#,0 RotateEntity camera,EntityPitch#(camera),EntityYaw#(camera),0 ; alright...now walk that path walkPath(p) UpdateWorld RenderWorld Text 0,10,"Next Point:"+p\nextpoint Text 0,30,"Use arrows to move camera/mouse for looking around" Flip Delay 10 ; helps prevent laptops from overheating...lets the OS do its thing Wend killall() ; free up the memory used End Function createWaypoints() ; this function creates the waypoints and places them randomly For w=1 To MAX_POINTS this.waypoint = New waypoint this\entity = CreateSphere() ScaleEntity this\entity,2,2,2 EntityColor this\entity,Rand(255),Rand(255),Rand(255) EntityShininess this\entity,1 this\number = w ; we want to know which waypoint this is PositionEntity this\entity,Rand(-75,75),0,Rand(-75,75) Next End Function Function walkPath(p.player) ; this function moves the player from waypoint to waypoint For this.waypoint = Each waypoint If this\number = p\nextpoint Then ; we have a match ; you can use any routine here that will point p\entity towards this\entity PointEntity p\entity,this\entity MoveEntity p\entity,0,0,.7 If EntityDistance(p\entity,this\entity)<3 Then ; this determines how close we let p\entity get to the waypoint ; p\entity is close enough (3 units) to its destination waypoint. ; time for the next waypoint p\nextpoint = p\nextpoint+1 ; if we ran out of waypoints, then go back to the first one If p\nextpoint > MAX_POINTS Then p\nextpoint = 1 End If End If Next End Function Function killall() ; kill everything...overkill probably :) FreeEntity p\entity Delete p For w.waypoint = Each waypoint FreeEntity w\entity Delete w Next FreeEntity camera FreeEntity light End Function |
| ||
Oh. I can't believe I'm actually disappointed this thread (ie Rez) continued as it began. Somewhere deep inside, I think I actually thought he'd make an attempt. Oh well, so much for that Pollyanna moment. Make sure you don't get banned now, Rez. Imagine the loss. |
| ||
UNLIKE ALL U JERKS! Um... these forum member's are putting in their time, FOR FREE. They don't get paid, and their help shouldn't EVER be EXPECTED on here. I've spent many a few hours, knocking up code for people on here, as have many other people done the same for me. If no-one helps me out, i'm not bothered, because, they are doing me a FAVOUR. AGAIN. STOP TELLING PEOPLE TO SCREW OFF! I've never seen anyone tell you to SCREW OFF. I've seen you TELL many people to go to HELL. And for some bizarre reason, they still help you. BECAUSE FORUMS ARE FOR HELPING PEOPLE! NOT TELLING THEM TO SCREW OFF! GOD! Forums are a place for polite, intellegent (mostly) discussion, where people can be expected to behave themselves, and hopefully, CONTRIBUTE back to the community, where they take out. Before, i was very willing to help you out, but now, i grow more and more alienated from yourself, and only click on your posts, for a laugh. That's your reputation round here. And that'll be the way you are remembered when you leave. Behind all the sarcasim and jokes, everyone here WANTS you to get better at coding, and try to work the simple things you get wrong. You come on here posting waypoint code, and not having the slightest idea how it works, rather asking how someone else can modify it to fit your needs. Don't you understand? That's NEVER EVER going to help you progress. Anyway, i've said my piece, on with the help... |