Chaos Project

RPG Maker => Event Systems => Event System Requests => Topic started by: Vexus on August 02, 2013, 05:46:27 am

Title: Enemies chasing you even when you exit maps
Post by: Vexus on August 02, 2013, 05:46:27 am
Hi. as some should know I'm doing a game named Alive and now that I'm doing chapter 2 of the game the infected will start showing.

Now, I haven't started exactly placing the infected on the maps (I test them on test maps at the moment) but this thing has been bugging me for a lot of time so here I am making a thread about it. I'd like that when you are being chased by the infected or even 1 only and you go inside a house or new map that they would keep on following you IF they were close to you when you teleported.

I'm pretty sure this involves switches and such but I'd like to know how to do this in conclusion if they were near you when you teleported or not.

I'm using blizz abs if that is needed to be known.

Thanks
Title: Re: Enemies chasing you even when you exit maps
Post by: KK20 on August 03, 2013, 12:03:19 am
Clearly, you will need to generate new events for every zombie "nearby" before going into the house, something Blizz-ABS already provides. You would also need to define what counts as a "nearby" enemy and be able to store those events somewhere in memory to be called back for the previous reason. Modifying the 'transfer_player' method may be best for this case.

In other words, hug your lead programmer.
Title: Re: Enemies chasing you even when you exit maps
Post by: Vexus on August 03, 2013, 06:20:52 am
I'm solo on the project sadly so no programmers that can help me that's why I thought on trying to do it event wise.
Title: Re: Enemies chasing you even when you exit maps
Post by: Zexion on August 03, 2013, 08:20:21 am
I think I know a way to do it by events, but it's so complicated and if there are more than 5 enemies is extremely inefficient.
Title: Re: Enemies chasing you even when you exit maps
Post by: Vexus on August 03, 2013, 10:38:45 am
I could try using this: http://forum.chaos-project.com/index.php/topic,9516.0.html

Tough I think it might lag with it. (Will check it out on a test map if it gives an error I'll use variables for the coordination of the enemy with the player or transfer map event)
Title: Re: Enemies chasing you even when you exit maps
Post by: Zexion on August 03, 2013, 10:56:20 am
Yeah, was gonna recommend that. It's what backs my battle system lol
Title: Re: Enemies chasing you even when you exit maps
Post by: Vexus on August 09, 2013, 07:26:03 am
Ok took long to try it out but it works with that script!!!

Now this is a small issue probably easily solved but wouldn't mind some quick help.

------------

I made it so when you touch the transfer event (Player touch) it sets a conditional branch of if event x is equal to range y turn switch on and transfer player else transfer player.

So far so good the small issue is on the 2nd map.

How can I make the event wait x frames before showing so I have enough time to move before it hits you?
Title: Re: Enemies chasing you even when you exit maps
Post by: Zexion on August 09, 2013, 07:36:49 am
Right after transferring the event turn on self switch A and set it to parallel process. Put a wait for x frames and turn off self switch.
Title: Re: Enemies chasing you even when you exit maps
Post by: Vexus on August 09, 2013, 07:42:08 am
At the moment I was trying with a parallel process event with the switch ticked and the event placed with the switch ticked.

Tried set move route opacity 0, wait 100 and then opacity 255 then erase event.

But the event starts moving while being invisible I don't think the wait is stopping him at all.

[Edit]

I mean I could easily make it work using 2 switches instead of one but was trying to not make it cramped as there won't be 1 zombie on the map :/

Having to use 2 per zombie would be a lot of work.
Title: Re: Enemies chasing you even when you exit maps
Post by: Zexion on August 09, 2013, 08:06:52 am
Damn, my post didn't go through my bad.
1. Right after transfering the event, turn on self switch A.
2. Make a new page, parallel process, no graphic, condition: Self Switch A
3. Put a wait for X frames.
4. Turn of self switch A
Title: Re: Enemies chasing you even when you exit maps
Post by: Vexus on August 09, 2013, 08:33:23 am
Thanks but I don't really like self switches considering I'll have to make multiple events per zombie there wouldn't be enough for all.

I'll be using 2 switches per zombie there's no other solution I can think of.

(Tough now I having some weird error from proximity script will need to check that out to see if more then 1 zombie following to the next map works or not)

Thanks again.
Title: Re: Enemies chasing you even when you exit maps
Post by: Zexion on August 09, 2013, 08:36:47 am
Self switches are per event, that means each event has four switches, A B C D. :B

Source(s):
Event pro lolol
Title: Re: Enemies chasing you even when you exit maps
Post by: Vexus on August 09, 2013, 08:57:37 am
Oh really? but do they persist if I exit a map and re enter? Will the zombie remain in the map?
Title: Re: Enemies chasing you even when you exit maps
Post by: Zexion on August 09, 2013, 09:06:44 am
No self switches reset on every map load. That's the part you're going to have to figure out :b
Can you maybe provide a small demo of how your doing it?
Title: Re: Enemies chasing you even when you exit maps
Post by: Vexus on August 09, 2013, 09:25:40 am
No need of a demo it's pretty simple.

In transfer event it's like this:

(http://img189.imageshack.us/img189/8738/or7.png)

And in the next map I have a parallel process event per zombie with for example zombie test ticked ON and 40 wait frames then turn another switch and make a new page in the event with the new switch ticked ON and leaving it empty.

This new switch is then used as a mark for the zombie event to show on the map and continue the action.
Title: Re: Enemies chasing you even when you exit maps
Post by: Zexion on August 09, 2013, 09:39:17 am
I don't get how that would even work o.o if it's set to event touch then the conditional branches wouldn't even activate until the event touches the player.
Title: Re: Enemies chasing you even when you exit maps
Post by: Vexus on August 09, 2013, 09:42:18 am
Player touch not event touch.

The check happens when you step on the event to transfer you in the new map.
Title: Re: Enemies chasing you even when you exit maps
Post by: Zexion on August 09, 2013, 09:52:33 am
Ohh, alright that makes more sense. Then here's a better way to do it.
Spoiler: ShowHide
(http://img138.imageshack.us/img138/2365/6ea.png)

On the next map you can set up however many zombie events like so: (picture is a gif so wait a bit for it to change)
Spoiler: ShowHide
(http://img203.imageshack.us/img203/3379/rt3.gif)


Basically set up however many events on the next map with those conditions and raise the variable by one for each one.

Edit: Also make sure to check "Handle when conditions don't apply" otherwise you will get errors or it won't work. Conditional branches need to be inside eachother for this.
Title: Re: Enemies chasing you even when you exit maps
Post by: Vexus on August 09, 2013, 09:58:30 am
None of the pics update.

Also one has ZombieCheck the other has Random Variable as variable names if that is a mistake.
Title: Re: Enemies chasing you even when you exit maps
Post by: Zexion on August 09, 2013, 10:08:39 am
Fixed, I had put the first one twice on accident. Then I realised I used random variable on accident so I updated the top one l0l, but I didn't know i used the wrong picture for the bottom. Anywho, it's fixed
Title: Re: Enemies chasing you even when you exit maps
Post by: Vexus on August 09, 2013, 10:14:37 am
Ok that seems like it saves me a switch per zombie but there also a problem with this.

Unless I reset the variable counter for each map the value will keep on rising and will have to keep on record on what value it is.

If I reset the value it will screw up earlier events/zombies.

Or maybe a different variable per map we'll see.

I'll test it out later. (Unless I keep on getting the proximity icon error.)

Thanks for the help.
Title: Re: Enemies chasing you even when you exit maps
Post by: Zexion on August 09, 2013, 10:30:32 am
You could "fix" it by fading the screen out and fading it back in on the next map :P
That's what I would do anyway :b

Edit: Or technically you could just remove the variable requirement on the second page and just require the self switch. That would work :b
Title: Re: Enemies chasing you even when you exit maps
Post by: Vexus on August 09, 2013, 10:39:27 am
Yea but the more I think about the variable method the more I think it would be really hard to implement.

I mean we are only guessing if zombie is near transfer event or not so in the new map we say variable is 1 or 2 or whatever but in the future if the number rises to I don't know 50 we can't know if every zombie in every map has managed to follow you in the next map or not so it would stop working pretty soon.
Title: Re: Enemies chasing you even when you exit maps
Post by: Zexion on August 09, 2013, 10:47:05 am
Hmm, I have an idea. Actually, I know exactly how to do this with events/scripts and make it completely dynamic. Let me try it out and I will post :b

Edit:
MM.... nevermind this entire thing seems hard to pull off because you would need them all to spawn and then what happens when they do? o.o They will fill up a space on the map, and what if the player is on that space. D: if you use more than say 10 zombies you will have many things to worry about
Title: Re: Enemies chasing you even when you exit maps
Post by: Vexus on August 09, 2013, 11:05:40 am
Yea I will need to figure out how to solve the space needed too hehe.
Title: Re: Enemies chasing you even when you exit maps
Post by: KK20 on August 09, 2013, 08:25:13 pm
Wait, from what I'm reading, the zombies are supposed to spawn at random areas on the map when transferring over to a new map? Shouldn't they all appear from the entrance point at different time intervals?
Title: Re: Enemies chasing you even when you exit maps
Post by: Vexus on August 10, 2013, 07:04:30 pm
No, no, zombies spawn on the same spot the transfer events are on the new map.

That's the problem tough. If there are many zombies following you how will i be able to show them all?

Imagine going inside a house and there were 3 after you.

How can i show the 3 of them from the same spot? It's not like i could create multiple events on the same spot, i would need some sort of event transfer while also checking if said spot is available or not.
Title: Re: Enemies chasing you even when you exit maps
Post by: KK20 on August 10, 2013, 07:08:20 pm
Quote from: KK20 on August 09, 2013, 08:25:13 pm
Shouldn't they all appear from the entrance point at different time intervals?

What's wrong with that? Just make it so that each zombie event has a different Wait interval (thus, appearing one by one until all are visible).
And like I said before, Blizz-ABS has a way to generate events on the map with a script call.
Title: Re: Enemies chasing you even when you exit maps
Post by: Vexus on August 11, 2013, 05:31:36 am
Had no idea i could didn't really check to be honest.

I got a slight issue tough as the zombies lose aggro in the new map. If i keep on walking down before they show up they will remain close to the entrance and not follow me.(Which is still not that bad considering they are blocking you the way now)
Title: Re: Enemies chasing you even when you exit maps
Post by: Vexus on August 14, 2013, 06:49:04 am
I was wondering something regarding variables.

I was thinking to place the events somewhere inaccessible then transfer event to where he should spawn if switch x is on THEN if I exit the map and he didn't follow me till the end I was thinking on saving it's x/y location with 2 variables and when you go back the enemy will be transferred to that location instead of starting again in the same location it was transferred.

Would I need 2 x/y variables per event or the variables can work for more then 1 event? (Storing the location)

Thanks

(I think I'll need 2 per event)
Title: Re: Enemies chasing you even when you exit maps
Post by: KK20 on August 14, 2013, 10:31:11 pm
All events that "followed" you inside will be transferred to the same location. That's only 2 variables (x- and y-coordinate) that can be used for all the "following" events. When you leave the building, and the events are no longer following, each event will need to have its x- and y- values stored...so that's 2 variables needed per event. Now you just need to make the following conditional check: which coordinates do you use?
Title: Re: Enemies chasing you even when you exit maps
Post by: Zexion on August 14, 2013, 11:05:46 pm
Also, I think you might be over-thinking this. When people play these rmxp games, we don't exactly expect perfection :b You should just do it in the most convenient way that doesn't eat up a whole bunch of switches.
Title: Re: Enemies chasing you even when you exit maps
Post by: Vexus on August 15, 2013, 04:51:01 am
Quote from: KK20 on August 14, 2013, 10:31:11 pm
All events that "followed" you inside will be transferred to the same location. That's only 2 variables (x- and y-coordinate) that can be used for all the "following" events. When you leave the building, and the events are no longer following, each event will need to have its x- and y- values stored...so that's 2 variables needed per event. Now you just need to make the following conditional check: which coordinates do you use?


At the moment I tried doing it so I place every zombie event in a corner where it's not accessible then if switch is on, "zombie1" for example gets transferred at the start of the map so it can continue following you.

I also made it so the zombie gets it's coordinates stored after being moved to save me from having to use another switch for the updating.

To update them I made it so when you step on a transfer event to exit the map, "zombie1" gets it's x and y coordinates updated then when you enter the map again there's a parallel process with set event location "zombie1" with coordinates variable x and y that were stored earlier.

So every time you exit the map the values will be updated and when you enter the map again the event will be transferred on the last saved coordinates.

@Zexion I know I'm over thinking but that's who I am I try to make everything seem "realistic" sometimes too much that I end up stopping from continuing the project. (Somnium tough that had fault with xp engine not powerful enough to handle dynamic events well)

Since in alive you don't fight in my opinion this helps in adding a sense of danger in the maps not having every zombie go back to it's starting position when you exit the map.

Imagine you were running from a bunch of zombies in a town and managed to enter a house without them reaching you then on your way out the map loads and those zombies are still near the house waiting for their snack hehe :D

----

Slightly off topic but I'm still contemplating regarding their movement speed 2 is slow that even walking is faster, on the other hand, speed 3 seems too fast for my tastes. (Tough it makes you run for your life hehe)

Wish there was something in between.
Title: Re: Enemies chasing you even when you exit maps
Post by: Zexion on August 15, 2013, 05:18:15 am
I just remembered something that you might want to try:
Self Data Suite (http://save-point.org/thread-4090.html?highlight=self+data)
It adds self variables switches etc. to ALL events. This prevents it from using up default variables. The only thing is, I don't know whether these reset on every map (which would make it useless l0l)
But it adds self variables/switches/metadata to armour/weapons/items/events/and common events. So maybe if you learn how it works, you could set it up in a common event o.o? I've wanted to use this for several things, but I never got around to it lol
Title: Re: Enemies chasing you even when you exit maps
Post by: Vexus on August 15, 2013, 06:11:44 am
From what I'm reading it doesn't carry on it seems.

Oh well I'll just try and see how it will work using multiple switches/variables it's not like there will be 100s of zombies in a single map heh.