• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Stealth Help

Status
Not open for further replies.
Level 8
Joined
Dec 7, 2008
Messages
363
I need help making a stealth based map that is set in the world laid out by George Orwell in Nineteen Eighty-Four.

There will be a great stealth element in the game. The player will have to avoid the thought police constantly, and if they spot you they will enter your mind and disable your circulatory system, killing you instantly. I have two questions:

Can I make it so that units can only detect enemies from the front (ie in their line of sight)? How?

Can I make it so that a hit from the back is an instant kill? How?

Thanks in advance.
 
Level 8
Joined
Jun 26, 2010
Messages
530
Yes, there's a way of doing it. I had i idea like that some time ago ;P

I'm not home right now, when i get there i may make you an example map.
 
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

Ok I tested some stuff but it never gets what I want. then I see the last post here of riki and have to say:

This ability is one of the biggest bull.... If you attack with riki and press stop, the ability still use the effect. So if you press attack and stop very fast in a line, you deal mass damage without an attack!

Greetings
~ The Bomb King > Dr. Boom
 
Level 14
Joined
Aug 30, 2004
Messages
909
Can I make it so that units can only detect enemies from the front (ie in their line of sight)? How?

Can I make it so that a hit from the back is an instant kill? How?

Thanks in advance.

I can't completely answer your questions, but here are some ideas.

1. You could make the enemies neutral passive and have a trigger that fires every .1 seconds or something that checks to see if the player is in their forward vision, then change them to hostile.

To detect if the player is in their forward vision might actually be tough. The problem is that unit facing is giving in 0 to 360 terms. 0 is the right side of your screen, 180 is the left, for example. But if you compute the angle "between two points" it gives you the angle in -180 to 180 terms, with 0 being the right of your screen and 180 and -180 being the left. this means you can't just check the absolute value difference between facing and the angle of the two units to determine whether the enemy is looking in the direction of the player.

I'm hoping there's a better work around, but here's what I did:

In thinking terms: imagine a clock with 0 at 3o'clock, -90 at 6, 180/-180 at 9, and 90 at 12o'clock. we want to know the difference between the hour and minute dials. But since the numbers are screwy we can't just look at the difference between the numbesr. For example, if one was at 9:01 (179 in game speak) and the other at 8:59 (-179 in game speak) the difference would be 358, not 2 which is the right answer. So what we do is hold the hands of the clock constant and move the hour hand to "0". Then the difference between the two hands is the actual difference.

set GoodGuyPoint = position of GoodGuy
set EnemyPoint = position of Enemy
set math = to facing of Enemy
if math is >180, then set math to math -360
// this makes math the facing of the enemy in -180 to 180 terms
set math = 0 - math
// this makes "math" the difference between where the enemy is looking and 0, which will be useful later.
set math2 = angle between EnemyPoint and GoodGuyPoint
//math2 is where the hero is relative to the enemy
set math2 = math2 + math
//this moves the "second hand" so that it preserves its relative position to the other hand.
if math2 > 180 set math2 = math2 - 360
if math2 < -180 set math2 = math2 + 360
//those two statements correct math2 if it went above or below the normal limits when you added math1.
Custom Script: ***Kill GoodGuy and Enemy Point. If forgot the exact text, but this keeps it from leaking... you can look it up in the leak tutorial, you may already know it, and if someone reads this after me and knows, please post it**** The trigger will work without this, but it'll lag eventually.

Now you can use math2 to determine whether the unit is in front of him. Something like:

if abs(math2) < 90 then YES else NO

The "90" there means the player will have to be in a cone of 90 degrees. make it 180 if you want to give the guards good peripheral vision.

Using something similiar can determine if the player is behind the guard. change the last to if "abs(math) > 180" and it will detect if the player is behind him. It won't detect whether the target is in front of the player though (if they're back to back it will still fire) but assuming your attacks require you to face the target that won't be a problem.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Untitled Trigger 001
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Real_3 = (Facing of Blood Mage 0001 <gen>)
      • Set Temp_Loc_3 = (Position of Blood Mage 0001 <gen>)
      • Set Temp_Loc_4 = (Position of Paladin 0000 <gen>)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Cos(((Temp_Real_3 - 45.00) - (Angle from Temp_Loc_3 to Temp_Loc_4)))) Greater than (Cos(45.00))
        • Then - Actions
          • Game - Display to (All players) the text: Front Right
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Cos(((Temp_Real_3 + 45.00) - (Angle from Temp_Loc_3 to Temp_Loc_4)))) Greater than (Cos(45.00))
            • Then - Actions
              • Game - Display to (All players) the text: Front Left
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Cos(((Temp_Real_3 - 135.00) - (Angle from Temp_Loc_3 to Temp_Loc_4)))) Greater than (Cos(45.00))
                • Then - Actions
                  • Game - Display to (All players) the text: Back Right
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Cos(((Temp_Real_3 + 135.00) - (Angle from Temp_Loc_3 to Temp_Loc_4)))) Greater than (Cos(45.00))
                    • Then - Actions
                      • Game - Display to (All players) the text: Back Left
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Cos(((Temp_Real_3 + 90.00) - (Angle from Temp_Loc_3 to Temp_Loc_4)))) Greater than (Cos(45.00))
                        • Then - Actions
                          • Game - Display to (All players) the text: Front
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Cos(((Temp_Real_3 - 90.00) - (Angle from Temp_Loc_3 to Temp_Loc_4)))) Greater than (Cos(45.00))
                            • Then - Actions
                              • Game - Display to (All players) the text: Back
                            • Else - Actions
Questions?
 
Status
Not open for further replies.
Top