Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Raycasting and avoiding wall collision

Author
Message
charlie mcdowell
12
Years of Service
User Offline
Joined: 22nd Aug 2012
Location:
Posted: 8th Sep 2012 08:41 Edited at: 8th Sep 2012 08:44
Here i am again at a lost.

so i'm building a script(duh) but
i cant figure out how to have the entity not run into the wall trying to follow the player. I'm trying to have the entity raycast and if it comes back true, it should follow waypoints to go around the corner
here is what i have so far...



sooo anyone care to tell me what i'm doing wrong? thanks!

charlie
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 8th Sep 2012 10:40
After looking at the DBPro code I'm not 100% sure that raycast is working properly. I easily get confused this late at night but I certainly have some questions about the code right now.

I'm sure Scene Commander will have something to say about it in which I hope will then untangle my mind.


@Scene Commander
This is the code I'm having problems with:

if static raycast(tmpx1#,tmpy#+tmpheight#,tmpz1#,tmpx2#,tmpy#+tmpheight#,tmpz2#)=0 then airesult=0

Should tmpheight# be used in this parameter position? The one that is in bold.

"A programmer is just a tool which converts caffeine into code . . . reminds me….. if I had one more brain cell, I could have a synapse! woo hoo, Sparky!

~I'm the Terry of the Flatlands.
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 9th Sep 2012 23:35
I should never post or jump to conclusions when I am groggy and almost asleep. I am taking a closer look at this. For one reason, if there really is something wrong with the DB code then Scene Command should know about it and he has enough on his plate at the moment.

"A programmer is just a tool which converts caffeine into code . . . reminds me….. if I had one more brain cell, I could have a synapse! woo hoo, Sparky!

~I'm the Terry of the Flatlands.
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 9th Sep 2012 23:47 Edited at: 9th Sep 2012 23:59
@Charlie

I am changing some of the code and compiling r681 of fpsc-game.dba. I will be sending it to you and would like you to use the same script as you have used so that you can test it for us. Also, I would suggest using an x parameter of larger than 0. If you want it as close as possible I would use 1 (one). I will let you know when I send you and email here.

ADDENDUM:

I have just sent you an email to a link for the updated fpsc-game.exe.

"A programmer is just a tool which converts caffeine into code . . . reminds me….. if I had one more brain cell, I could have a synapse! woo hoo, Sparky!

~I'm the Terry of the Flatlands.
charlie mcdowell
12
Years of Service
User Offline
Joined: 22nd Aug 2012
Location:
Posted: 10th Sep 2012 01:01
Thanks. I'll work it out when I get home

You're awesome.

charlie
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 10th Sep 2012 03:58 Edited at: 10th Sep 2012 03:59
Your welcome and I am ; but, I appreciate your kind word.

I was able to test this myself but using my own script and simple map. The map is linked to the download button. This tests the code I changed. Actually, I didn't do anything on my own, I simply used the same code that was used for "raycastback" except I made sure that it was not looking in back of the object or character.

I decided to also test the original code. It does not work as I suspected.

The script is as follows.



When using this script as is, the character will not follow the waypoint because it is checking a raycast that is only 30 units to the front of him. However, change state #15 to

:state=15,raycast 1 300:state=20

The character is only about 200 units (a little more perhaps) from the wall and therefore it will return true and then the character will follow the waypoint and therefore passed the wall.

This is a very cool way of making sure a character doesn't just try to go through a wall but follow the way point instead. Good thinking Charles.

"A programmer is just a tool which converts caffeine into code . . . reminds me….. if I had one more brain cell, I could have a synapse! woo hoo, Sparky!

~I'm the Terry of the Flatlands.

Attachments

Login to view attachments
charlie mcdowell
12
Years of Service
User Offline
Joined: 22nd Aug 2012
Location:
Posted: 10th Sep 2012 07:13
I still haven't made it home, but I really owe you one flat lander. you went above and beyond

charlie
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 10th Sep 2012 16:13
Thanks again.

I tried using raycast=0 300 -- notice I used 0 instead of 1 -- and it works fine as well. I just wasn't sure as sometimes the zero value can mess up calculations.

Scene Commander doesn't think there is anything wrong with the original code; but of course I beg to differ. It does not work for me and I have changed it for my mod (RPG Mod) where it now works great. So, it will probably not be fixed for an official version release. Also, this will probably not be fixed for Ched's RPGmod that he has working with. Basically one in the same. I gave him the code sometime back. He is now responsible for the public release of it.

Give me an email and we can work something out regarding with a non-modded version which will not be official and would not be supported -- at least the raycasting part.

"A programmer is just a tool which converts caffeine into code . . . reminds me….. if I had one more brain cell, I could have a synapse! woo hoo, Sparky!

~I'm the Terry of the Flatlands.
charlie mcdowell
12
Years of Service
User Offline
Joined: 22nd Aug 2012
Location:
Posted: 10th Sep 2012 20:12 Edited at: 11th Sep 2012 07:49
ahh see i have rpg mod as well. i wonder if that had something to do with it (i just installed rpg mod, dont have a clue on using it yet )
now i just have to figure out how to despawn and respawn somewhere else

EDIT: @FlatLander
I have downloaded your map and used your code on my other trial map. neither works. I have Ched's rpg release so maybe thats why. Ive received your email as well, and the link doesnt show the .zip. I'm in no rush to fix this seeing its more of a software issue now.

charlie
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 14th Sep 2012 22:24
I emailed you with the correct link. Have you downloaded it yet? This contains the correct code for raycast=x y.

"A programmer is just a tool which converts caffeine into code . . . reminds me….. if I had one more brain cell, I could have a synapse! woo hoo, Sparky!

~I'm the Terry of the Flatlands.

Login to post a reply

Server time is: 2024-11-23 20:03:25
Your offset time is: 2024-11-23 20:03:25