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.

Newcomers DBPro Corner / FPS shooting problem

Author
Message
zeeenza
18
Years of Service
User Offline
Joined: 2nd Jul 2006
Location:
Posted: 26th May 2007 03:59
I'm trying to use the method of shooting where you check for intersection between a limb and the player. This is working, except I'm able to shoot through anything (walls and multiple enemies) with one shot, since multiple object could be intersecting the player and the limb. How do I make it stop checking for intersection after it hits the first object? It would also have to be backward since I need it to check object closer to the player first (for shooting). Any possible help would be appreciated...I've been stuck with this for a month. And, yes, I have searched but found nothing that answers my question. Here's my current code for detecting the intersection:

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 26th May 2007 07:03
The intersect object command returns the distance to the intersection. If you check for intersection with the map and each player, if there's an intersection with the map and the player, if the distance to the map intersection is less than the distance to the player, the map has been hit, so stop checking for intersections, else damage the player.

That, or use sparky's dll, group all of the objects into 1 group, check for intersection with the entire map, and then check if the intersected object is a player, if so damage them (sparky's returns the first hit object from the last intersection check).

Spydude 777
17
Years of Service
User Offline
Joined: 9th Feb 2007
Location: \"my eyes are glued to the screen..
Posted: 26th May 2007 08:10
wroung spot to put this.... but im too a nub on this forum, lolz well i dont know much with FPS but i know some basics but im not sure i can help you srry

-Fear Me! I am the Dark Spy!
zeeenza
18
Years of Service
User Offline
Joined: 2nd Jul 2006
Location:
Posted: 26th May 2007 13:37 Edited at: 26th May 2007 23:27
How do you make it stop checking for intersection if a certain object intersects? I've kinda got it working by doing this:



But I'd have to do that individually for each enemy...Is there a way to group all of the enemy objects together and check for them all at once somehow?
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 27th May 2007 01:08
You use a loop... and exit the loop if the object hit is a wall.

zeeenza
18
Years of Service
User Offline
Joined: 2nd Jul 2006
Location:
Posted: 27th May 2007 06:44
Well the only loop I'm using for it is a for loop:



Ending it doesn't seem to do anything. Also, I'm still able to shoot through multiple enemies, so I'll need to exit the loop after I hit the first enemy as well. Could you post an example code of how to do this please? I've tried everything I could think of.
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 27th May 2007 07:10
Just use sparky's grouping method.

Group all objects, you're enemies, and your map, into 1 group. To group objects, when you set them up, you give them all the same group number.

Then cast 1 intersection check with the group.

Now call the SC_getObjectHit() command to find out which object was hit (it returns the first object hit, so the closest object).

If the object is a map, display a decal on the map, otherwise, damage the enemy.

Done.

zeeenza
18
Years of Service
User Offline
Joined: 2nd Jul 2006
Location:
Posted: 27th May 2007 07:44
Alright I'll try that. I'll have to learn how to use sparky's dll first, but it doesn't look too hard. Thanks for all your help.
revenant chaos
Valued Member
17
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 28th May 2007 12:44
Instead of trying to break out of the loop, you could try assigning your variable to its max. ex:



now obviously this code wont actually work, but that was to show you what i meant (the part where if the enemy was hit, tmp=10)

Login to post a reply

Server time is: 2024-11-25 18:03:40
Your offset time is: 2024-11-25 18:03:40