Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → hmmm, I wonder if that's possible...
hmmm, I wonder if that's possible...
2002-03-20, 6:43 AM #1
Would it be possible to make a cog that looks at the space between you and a (walking) enemy and ends the game (game over, not won...) after saying a text (something like, you got to close and blew your cover), if you come to close to the enemy?

I'm making a level where you need to follow a badguy at a certain part, but it would be bad if you could gain on him since that would look a bit supid!...
So íf this cog is possible I'll make text appaer saying that you should keep your distance and all.
APT 1, 2, 3/4, 5/6
TDT
DMDMD

http://veddertheshredder.com
2002-03-20, 7:52 AM #2
i think it should be possible. Have a pulse message that gets your position and the position of the target, make a VectorSub and checks the length of the resulting vector. If smaller than mindistance, do the fx.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-03-20, 8:04 AM #3
Vectordist() works fine for me. [http://forums.massassi.net/html/confused.gif]

Code:
# 03/2002 GBK
Symbols
Message Startup
Message Entered
Message Pulse
Thing Player		Local
Thing Badguy
Flex Dist=1.0		#Minimum distance player can get, in JKUs.
Sector Enable		#Enter this sector to start the chase.
Sector Disable		#And this one to stop it.
Int UNI_start		#UNI string numbers.
Int UNI_stop
Int UNI_failed
Int Con=0			Local
End
Code
Startup: Player = JKgetlocalplayer(); Stop;
Entered: If(Getsenderref() == Enable && Con == 0) { Con=1;
Setpulse(0.1); JKprintunistring(Player, UNI_start); }
Else If(Getsenderref() == Disable && Con == 1) { Con=2;
Setpulse(0); JKprintunistring(Player, UNI_stop); } Stop;
Pulse:
If(Vectordist(Getthingpos(Badguy), Getthingpos(Player)) <= Dist && Haslos(Badguy, Player)) {
Con=2; Setpulse(0); JKprintunistring(Player, UNI_failed); }
Stop;
End


It works, I tested it. I added Haslos, so if you cant see the badguy, you can get closer.

 

Credit me. [http://forums.massassi.net/html/wink.gif]

------------------
Success is the inverse relationship between effort, gain, and loss.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-03-20, 9:15 AM #4
Yeesh you helping me so much with cogs, I'd allmost go worshipping you [http://forums.massassi.net/html/wink.gif]

I don't have time to try it now, but I'll test it tomorrow.
Thanks!


[This message has been edited by ZOOIkes (edited March 20, 2002).]
APT 1, 2, 3/4, 5/6
TDT
DMDMD

http://veddertheshredder.com
2002-03-22, 8:56 AM #5
so you can turn and walk backwards up to him?
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-03-22, 10:09 AM #6
Umm, no. Doesnt matter if you cant actully see him, haslos is 360^. Only archi can block line of sight.

------------------
Success is the inverse relationship between effort, gain, and loss.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-03-22, 11:29 PM #7
oh, well, then it's cool
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-03-23, 2:34 AM #8
oh and it works great!

I put jkendlevel(0.0); after the last line so you'll actually have to reload.
APT 1, 2, 3/4, 5/6
TDT
DMDMD

http://veddertheshredder.com

↑ Up to the top!