RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Stealth Missions

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 87
...I'M HUNGRY! Food plawks
I thought I'd seen a tutorial on this before but I was unable to find it again. I'm working on a series of quests that involve breaking, entering, assassinations and avoiding guards :D. At the moment, however, I'm at a loss as to how to create a "field of vision" for my guards. I figure I can use x and y coordinates to determine whether you are seen or not, but this wouldn't allow you to hide behind obstacles, or to sneak up on the guards (and knife em  :P)

I realize this is going to be quite complicated; in fact, I'm going for the most complex system I can (if I can emulate even the tiniest fraction of the glory of the Hitman series, I'll be happy)

So, if anyone has any general ideas (or knows where that darned tut is) please post ;D

***
Rep:
Level 87
...I'M HUNGRY! Food plawks
Wow, this got buried fast...still no one wants to help lil ol' yawggeh?  :-[

**
Rep:
Level 87
He's got my gravity gun...
I think one of the ABS scripts give your enemies fields of visions, don't know if it is exactly what you are looking for.
You just got Frohwned!

pokeball :)OfflineMale
********
Cheese
Rep:
Level 95
?
when you hide behind the object shut off the event for the hero's x and Y
Watch out for: HaloOfTheSun

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Nah, he couldn't do that, since then guards who should be able to see him wouldn't either:

example: O is player, X's are guards

|X |||||
|   |||||
| O|||||  >X
|   |||||

One of the X's should be able to see him, but he is hiding behind a wall, and if you turn off his position, then you wouldn't be able to.

Let me think about this for a bit, and I'll get back to you with a solution.

***
Rep:
Level 87
...I'M HUNGRY! Food plawks
A field of vision for NPC's would be perfect...it would be waaay to much work to event it all. Anyone got a script? I looked around hbgames.org but couldn't find any...

***
Rep:
Level 87
...I'M HUNGRY! Food plawks
Still looking...help plocks (sarcasm)  8)

***
Rep:
Level 87
...I'M HUNGRY! Food plawks
Still trying to find a way to do this...getting quite frustrated...I really can't continue working on my game until I solve this. Hasn't ANYONE else ever done this before? :-X

***
Rep:
Level 87
...I'M HUNGRY! Food plawks
For christ's sake, I've been stuck on this for a week...is it fucking impossible???  >:( >:( >:(

***
Rep:
Level 87
????
Found this tutorial in gamingw( to lazy to make my own right now)

Let's begin by adding a fork statement for when the guard FACES UP.

<>FORN Optn:thisEvent-Up Face Direct

Since the guard can only see in a straight line, the hero's X coordinate must be equal to the Guard's X coordinate for the guard to see him:



Notice the same X Coordinates? OK, so add another fork statement that executes when "HeroX" is equal to "WatchX." Make sure that this fork statement is inside the FaceUp FORK statement!

If the guard is facing up, then he can't see what's below him, right? That means that the Hero's Y coordinate must be smakker than the guard's Y coordinate (remember that Y becomes smaller as you go up). Therefore, let's add another fork statement that detects if the "HeroY" variable is less than "GuardY".

Now, inside all those supa-dupa FORK statements, add the "stuff"(tm) that you want to execute when the guard sees you. For example:

Anyway, do the same for when the guard is facing Left, Right, and Down. Just remember:

FACE DOWN: HeroX must equal WatchX, HeroY must be greater than WatchY
FACE LEFT: HeroX must be less than WatchX, HeroY must equal WatchY
FACE LEFT: HeroX must be greater than WatchX, HeroY must equal WatchY

Now, try this program. It should work...except for one little thing: You can't hide from that blasted Sen...uh...guard! So how do you fix this? Simple! We'll need to add more code inside the fork statements!

Let us look at the mountain in the middle - the stuff that you are supposed to hide behind. It starts at (9,5) and ends at (12,10). Hmm...maybe we could add more fork statements inside the existing fork statements that detect if the watcher's vision is blocked by the mountains...it just might work, right?

Let's go back to the "Facing Up" code, inside the three nested FORK statements. If the watcher's vision is blocked by the mountains, then his Y coordinate should be greater than 10 (meaning that he's below the mountains), and the hero's Y coordinate should be below 5 (meaning that the heor is above the mountains). Let's add two fork statements to express this:

<>FORN Optn:Varbl[0002:HeroY]-5less
<>FORN Optn:Varbl[0004:WatchY]-10abov

The watcher's X coordinate (and the Hero's) should also be between 9 and 12, the X coordinates for the beginning and end of the mountain. Let's add another two FORK statements for this condition (remember that inside this look, the hero's X coordinats is equal to the Guard's X coordinate. Thus, you only need to compare one of them.)

I'll wait...Done? Good! Now, remember our good old switch, "Blocked"? Turn the switch ON inside the nested fork statements, which will tell us that Sen...uh...the guard cannot see the hero - his vision is blocked by the mountains.

After these four inner FORK statements, add another FORK statement that activates when the "Blocked" switch is OFF. Put the [guard battle code/stuff that you want to do when the guard sees the hero] in here.

Repeat this procedure for the other three directions. Just make sure to adjust the FORK statements appropriately.