Shooting on map

One of the most important thing I want to do on my game, it's to be able to make the player shoot a ball if he have some in inventory that freeze enemy on the map.


Curently, im able to do that but require a lot of code. My code don't look so good, so I want your suggestion. 


It's better to create an event that really move on the map or an false anymation?


What is the best way for make a reaction when 2 event was on the same place and how detect it efficiantly?


Thansk for you great help.


By the way, did you know why: "this.character(0).x = $gamePlayer.x" did't work?
Actions on the map usually require an ABS (Action Battle System) script/plugin, or be limited to very few options that will need very complex eventing - as you probably already realised.


ABS is very difficult to program - which is why such a plugin doesn't exist for MV yet. There are one or two in development but most probably they still require months of work (haven't checked their status).


If you want our help to improve your events, then I suggest you show us screenshots of what you have so far - because your questions don't have general answers. Depending on what exactly you want to do sometimes you need to have the event oving on the map and sometimes it's better without. And the detection efficiency depends on how many of which event might be possible on the map.


As said, doing this with events is not exactly easy...
http://www.mundorpgmaker.com.br/topic/113690-mv-shooting-system-10/
It's not like a ful ABD system, they have no hp etc... it's just a common event. Player colect ball of ice and then shoot it to ennemy and that freeze them.


Curently I try to do it by event, but some infor missing for I can achieve this without using variable(for some reason).


First I need the equivalent script to move event. move event dont permis me to give script parameter so I want to know what is the equivalent in scripting.


Second, how to detect that my event is over another event?


How to make react this event without using a parallele process? For speed reason.


FOr exemple if I want to activate the selfswitchA from another vent that was under my event.
Okay, please see here for the script calls: https://docs.google.com/spreadsheets/d/1-Oa0cRGpjC8L5JO8vdMwOaYMKO75dtfKDOetnvh7OHs/edit?pref=2&pli=1#gid=0


It contains the calls for moving an event, and setting other events self switches.


You can use a parallel process to check your collisions, but only one, that will make all the collision checks for all events and using script calls, you can check if your event is in proximity of another event or over another.


The way I'd do it: have a range of event ids that are your bullets.


In a single parallel process (in this case your common event maybe) have it check if the coordinates of any of your bullets matches those of any of your events that can be hit.


(this is going to be long if you can have several bullets, and have a lot of possible targets)


If it does, set the self switch of your choice on or off in the target event using the script calls provided in the google doc.


If you find the syntax of the above document jarring but still want to do it yourself, search for my plugin (script box functions) it should be on the first page, I provide a lot of equivalent script calls with much easier syntax. (For example: setting a self switch becomes SSelf(mapId,eventId,name,value)).


Or, use the plugin mentionned earlier, or this one : http://miyuki-maker.blogspot.fr/2016/01/rmmv-plugin-on-map-bullets.html


They should do the work for you nice and easy.
1) don't try to make the event move directly. No one does - not even the set move route command.


It is called "set" move route, because that is exactly what it does - it programs an independent command sequence that is automatically processed in a way similiar to parallel processes in the game. Programming that by script is a lot more difficult and error-prone. There are good reasons why few people even try that, it's a lot better to use the event commands here.


2) you need to use a parallel process to detect event collision, there is no way around that.


Even if you're using a script, that script would have to enter its commands into the game loop that is very similiar to a parallel process.


So it's usually better to do it in a parallel process directly, but optimize that parallel process in a way to reduce the lag to a minimum.


3) there is a script command to activate the self-switches of other events, but that is usually not neccessary in a lot of cases - it depends on how you structure your events.


As I asked above - please give screenshots of what you have so far, then we can tell you exactly how to improve from there.
Look in this thread there they got a Sample Mapfile which contains Zelda Sword slash (without grafic) and a Fireball


that the Player can shoot. Its with Eventcode, but maybe it helps somehow.
Look at my code, for some reason It's not work, the ball don't move at the player position.

Sans titfffre.png
Iam unable to read France? corretcly.


But why would you try to to make something like:   this event x set to player map x ?


= means set the variable to


== is "conditional branch" or called "if"
I can't access my computer right now so I can't give you a more elaborate answer than this:


You can't set an event x and y coordinates like this, you need to move it to the coordinates of the player, use transfer event command or script call. You can find the script call in the google doc link I provided earlier (or use my plugin for an easy to access script call).
Iam unable to read France? corretcly.


But why would you try to to make something like:   this event x set to player map x ?


= means set the variable to


== is "conditional branch" or called "if"


the evetn I transfert is the ball imself but I found how now.
As far as i know you cant teleport Events thatway.
Use this to move an event:


$gameMap.event(eventId).setPosition(x, y)


Obviously changing eventId to the id of the event you want to move, and x y to the coordinates, so here $gamePlayer.x and $gamePlayer.y.


There isn't even a need to use a script call, you have an event command that does just that, "Set event location". Second page, the third in the list.


Please understand that the way you are trying to event it currently won't work as each time the ok button is pressed the bullet will teleport back to the player.

Original thread: https://forums.rpgmakerweb.com/threads/shooting-on-map.63021/