...I know this question has been on the board before but I'm having some problems.I need to know how to make range detection in my game, I've downloaded the Angle calculater extention but I can't get it to work when I have more then one object of that same type...I've downloaded Tigerworks's RTS open source but it was confusing to me (I don't really know fastlooping)...anyways, if anyone could make a small tutorial for me or help me thanks.
"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G
correct me if i'm wrong but i think he meant that the range detection works fine, but not when there's more than one of the same object
and for that you'll have to learn how to use the fastloop
"If Darl McBride was in charge, he'd probably make marriage unconstitutional too, since clearly it de-emphasizes the commercial nature of normal human interaction, and probably is a major impediment to the commercial growth of prostitution."
-- Linus Torvalds, December 5th 2003.
(Darl McBride is CEO of The SCO Group)
this place sucks but don't tell anyone, it's our little secret, ok?
when I use the Angle calculator extention object and do -The distance between "object 1" and "object 2" is lower then 150"- object 1 is supposed to shoot "object 2" but instead it shoots only the last "object 2" that I made...you probably won't understand that if you dont have Angle calculator
and about the formulas...how would I code "object 1 shoots object 2 when it is ____close to object 2"?
in other words, how would I make objects shoot each other when their close to each other? but tell me how it would look in code...thanks
The formulas by Shab and Kris A didnt work for me for some strange reason, so i used
(X("Player 2")-X("Player 1"))/Cos(ACos((X("Player 2")-X("Player 1"))/(Y("Player 2")-Y("Player 1")))
Pick one (Player 2) at random
When (formula)is greater that 0
And (formula) is less than 150
- Player 1 shoot at player 2
And because player 2's x position can be less than player 1's, do another event fo when formula is less than 0 and above -150.
Even though its not a great method, by using Pick at random you can make the player shoot at all other players the easiest way, without is shooting at the most recent created.
Thank you, thankyou, man im good,
hope this works for you, if it doesnt i can email you my example
yeah, if you tried to square the number with the little '2', it's going to fail because most expression doodads don't process it
(just multiply the number by itself instead)
Edited by the Author.
"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G