Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Sign in to follow this  
Leon

To assasinate a guard.

Recommended Posts

Arkbennett and Leon's 'Moving Guard'

 

This event system allows a guard to catch you, and allows you to assassinate him.

This is an event engine that uses a script command in conjunction with it.

Credits go to Ark for helping me set up the x and y variables, and to me (Leon) for adding in the 'limit' and attack only from RIGHT behind the guard.

PLEASE give us credit. For learning our knowledge, that isn't too big a price, is it?

 

This may seem long, but it is ALL worth it.

 

Anyway, this requires 1 loop, 2 labels, a wait command,and a ton of conditional branches:

1.  In a parallel process event other than this one, put variables 1 and 2 equal to the 'player's x tile and y tile', so that 
variable 1 = player's x
variable 2 = player's y

2.  Start off with a guard picture, set the event to parallel process and his movement to 'random'.

3.  Add in a loop, and right above 'repeat', put a 'wait' command of 1 frame, else the game will freeze.

4.  Now, set 2 more variables, i used 6 and 7
variable 6 = this event's x
variable 7 = this event's y
Make CERTAIN it says this events, and not the event's id.  This allows you to copy this event and use it in a different map, rather than rewriting the whole event.

5.  Next, we need the labels.  
One entitled:  Caught
and the other:  Kill Guard
I cap each word because it is case sensitive.

6.  The conditional branches.  These get a little confusing.  You need 4 for each direction, Right, Left, Up and Down.  I'll show you how to do this part, because it mixes events and scripting in one of the best ways:  conditional branch.

7.  Guard facing Right/Left, caught:
Make sure all conditional branches have the 'else' indicator turned off.


a.  Put in a conditional branch on if THIS event is facing right.

b.  Use a conditional branch testing to make sure the player's x position (which is how far to the right the player is on the map) is greater than this event's variable x, in this case, 6.

c.  Use a third conditional branch, and go to 'script'.  When using it with script, you dont have to ask 'if', because it is implied.  So you want to set up a limit on how far the guard can see (because you dont want him out of view of the player, from 30 squares away and catch your player off guard.).
To do this, go to script and call up:  $game_variables[x] <= $game_variables[y] + z
x = player's x variable
y = this event's x variable
z = how far away they can see you + 1.

2 things I must point out are:  we use less than because we want the x position to be less than the guard's x plus the amount z.  Now why add 1 to the amount of how far they can see?  to count for the guard's position x.  So if we used '6' in place of 'z', you would get that the guard can see 5 places away.

d.   Your last conditional branch needs to make sure teh 'y' variable of both the player and 'this event' are equal to eachother, so that the guard can only see straight ahead of him.
Inside that last conditional branch, add in the 'jump to label' command to 'Caught'.

e.  Left is just doing the same as right, but change teh "This event is facing Right" to say left instead, then REVERSE the '>' and '<' signs, leaving the '=' parts alone (including with the script conditional branch)  Further, change teh '+' to a '-'.

8.  Guard facing Up/Down, caught:
For the guard facing up and down, we need to do the same thing as with left/right, but change the x to y.  I'll walk you through up, then just change the signs for down.

a.  Your first coniditional branch should make sure the guard is facing up.

b.  Next Conditional Branch, mae sure the player's y variable is less than the guard's y variable.

c.  This branch checks how far the guard can see using:
$game_variables[x] >= $game_variables[y] - z
x = player's y variable
y = this event's y variable
z = how far.  If we use the example 6 again, he can see 6 spaces away.
We use '-' here as we did with left, because thte numbers are now in decending order, when going from bottom to top, or right to left.

d.  the last one is to make sure the player's x variable and this event's x variable are equal

add in the jump to label 'Caught' inside all four of those.

e.  To do 'Down', change the first branch to say 'down; instead of 'up', in the second and third branches, reverse the signs, including changing '-' to '+', and the fouth one should remain the same.

9.  To kill a guard, facing left/right.
These next two parts require 5 conditional branches each.  Here, I will do right again, then explain how to do left:

a.  Conditional branches 1 and 2 should make sure both the event AND the player are both facing right.

b.  The third branch should make sure that the player's x is 1 less than this event's.  To do that, go into the script part, and do:
$game_variables[x] == $game_variables[y] - 1
x = player's x variable
y = this event's x variable

c.  The fouth one makes sure that the player and this event's y variables are the same.

d.  The final one should check if the 'C' button is pressed.

Inside all of those, put the label 'Kill Guard'

e.  to do facing left, switch the first two conditional branches to say 'left' instead of 'right', then the '-1' to '+1'

10.  To kill a guard, up/down.
I'll show up, then explain down:

a.  Make sure, with 2 conditional branches, that both this event and the player are facing up.

b.  With the third CB, make sure that the player's y is one greater than this event's.  to do that, use:
$game_variables[x] == $game_variables[y] + 1
x = player's y variable
y = this event's y variable

c.  Make sure the 'x' variables of both player and this event are teh same.

d.  add in the if 'C' is pressed.

Add in 'jump to label' and have it say 'Kill Guard'

e.  to do this with down, change the 'up's to 'down's, then change '+1' to '-1'

11.
Ok, now we just need to set the labels:

Label 1:  Caught
After 'Repeat', put:
Label: Caught
Then, put what happens when caught.
Next, 'end event processing'.


Label 2:  Kill Guard
Next, play 'se' 089-Attack01
Then, move the event to face whatever direction the dead body will be at on the next page,
Proceed with the movement, then local switch a = on.

12.  Dead body, and make it disappear!
Make the prerequisite local switch a is on.

Make the graphic the dead body and lock the facing.

Set it to 'auto start', and the event like this:
Opacity = 0
wait 2 frames
Opacity = 255
wait 2 frames

Repeat the process 3-4 times, add in proceed with movement, then local switch b = on.

On page 3, give it no graphic, no commands, no nothing.  Just the prerequisite of local switch b being on.
You can now have a walking guard who can catch you, and you can assassinate him.

Now, the best part is, with only 2 new variables, you can set up ANOTHER new guard on the same map. Further, you can copy this event, and use it on a different map without needing to change the variables at all, because it is all specific to THIS event.

Enjoy!

 

Demo:

 

Sorry, no screenshots. The demo should more than suffice though.

Share this post


Link to post
Share on other sites

Hey Nice Leon

I know you did those stuff because of my Rules, hehe, don't worry, it's cool

but if you could edit your post and put those steps in a quote so they would make it look more organized

and one more thing, you didn't put screenies, you can't put screenies, they will be no good.So yeah, this is really cool

Share this post


Link to post
Share on other sites

Very nice, good for anyone making a Zelda gmae where you have to sneak past guards (like an OoT remake or something)

Share this post


Link to post
Share on other sites
Wow, thats amazing. Great work, is Arkbennet the same member as Ark on this forum?

 

Oh, no. He is a friend of mine from Rmxp world. (I site I mentiond on ultimate.)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...