Events Teleporting?

Discussion in 'JS Plugin Requests' started by Mooshry, Mar 5, 2019.

  1. Mooshry

    Mooshry Ariana Grande has consumed my very existence help. Veteran

    Messages:
    362
    Likes Received:
    142
    Location:
    Your Air Conditioner
    First Language:
    Cow
    Primarily Uses:
    RMMV
    So, in my game, enemies appear on the map. And i want some enemies to teleport around like the Cumulus Rex from DQIX. Basically, they'd have a script call in their move route that's something like "this.teleport", and when the event comes on screen, it teleports to a single global region specified in the plugin manager. And when they teleport, they'd fade out, wait 60 frames, and fade in to the new location (By the way, the default fade duration is 30 frames. You can adjust it), and have to wait two seconds before they can teleport again. It would then try to find another on-screen tile with the specified region. But, if there's something blocking that tile, like another event, or a player (Not a follower), it won't teleport there. It also wouldn't teleport anywhere within 3 tiles of a player, because then it could teleport right in front of you and that'd be mean. There'd also be no sound effect or event, because that doesn't happen with the teleporting guys in DQIX
    And if you're using YEP_EventChasePlayer, the enemy would find a tile with the region close to you while it's chasing you (Or far from you if it's running from you). (By the way, if you're using that plugin, they can still teleport around even if they aren't chasing)
    Hope this gets made! Unlike all my other requests!
     
    Last edited: Mar 5, 2019
    #1
  2. Andar

    Andar Veteran Veteran

    Messages:
    28,448
    Likes Received:
    6,492
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    why use a plugin? That is already part of the base engine functionality...

    Use the event command "set event location"
     
    #2
  3. Mooshry

    Mooshry Ariana Grande has consumed my very existence help. Veteran

    Messages:
    362
    Likes Received:
    142
    Location:
    Your Air Conditioner
    First Language:
    Cow
    Primarily Uses:
    RMMV
    No, but i want it to teleport randomly. Not to set destinations.
     
    #3
  4. Andar

    Andar Veteran Veteran

    Messages:
    28,448
    Likes Received:
    6,492
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    you can teleport to variable destinations, and that includes setting the variables to whatever random numbers you see fit. Just make sure not to select a wall coordinate.
    and if you really need a scriptline, then use the script equivalent of the event commands, they're listed in another topic here on the forum.

    And please, learn to give all relevant information in the first post - this isn't the first time that you forgot part of the description, and we can neither read your mind nor have we magic crystal balls to see what you really want.
    We can only help based on what you write down in your request. Which is the reason why all your other requests failed - you never included all the infos required.
     
    #4
  5. Mooshry

    Mooshry Ariana Grande has consumed my very existence help. Veteran

    Messages:
    362
    Likes Received:
    142
    Location:
    Your Air Conditioner
    First Language:
    Cow
    Primarily Uses:
    RMMV
    I don't really know how to use variable destinations, so i think the plugin's better. Mainly because the plugin would have the fading effect i want.
     
    #5
  6. Andar

    Andar Veteran Veteran

    Messages:
    28,448
    Likes Received:
    6,492
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    if you don't know how to use variable coordinates, then the plugin won't be of much use to you either, because even a plugin would need to be told where to teleport to.
    Plugins aren't magic either, they can only do what they've been told to do. And you as the games developer are responsible for telling them what to do by 1) giving a good description and 2) configuring the plugin correctly.

    There are several reasons why as you say
    your requests haven't been made before, and one of them is that your instructions of what you want them to do almost always have been incomplete.
    You are the one who needs to specify what the plugin should do and when.

    Just as one example - random teleport can mean teleport away from the player which would be exactly wrong for a chasing event.
    To make what you want means that you can't have a completely random teleport, it needs to be a teleport that targets only a limited random area with the randomness being around some specific postion.
    So you need to give something on how to calculate that target area, which is why I said that you need to know how to use variable coordinates in order to tell the plugin programmer what exactly this plugin should do.

    Without those details, this request cannot be done, so either you give that info (and that means you learn how to calculate coordinates) or this will end up as another failed request from you.
     
    #6
    caethyril likes this.
  7. Mooshry

    Mooshry Ariana Grande has consumed my very existence help. Veteran

    Messages:
    362
    Likes Received:
    142
    Location:
    Your Air Conditioner
    First Language:
    Cow
    Primarily Uses:
    RMMV
    So, i changed it. Now the enemy would only be able to teleport to a certain region tile specified in the plugin manager.
     
    #7
  8. Andar

    Andar Veteran Veteran

    Messages:
    28,448
    Likes Received:
    6,492
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    no, you didn't - you gave absolutely no details on how that region is supposed to be specified. I can think of three different ways on how to do this, each having different advantages and disadvantages. And if the plugin programmer thinks of a different way than you first, the result will be wasted time for everyone (again, as that is what has troubled your requests in the past as well).

    YOU are the one who has to tell the plugin programmer the details of what should be programmed. And if you don't give those details it is very unlikely that someone puts in the time to play twenty-questions with you until they know what to program.
    And yes, that means you really have to think and plan and write more than a few sentences as a description.
     
    #8
  9. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,183
    Likes Received:
    731
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    Like Andar suggests, every plugin request I've seen from you has been some combination of inadequately-specified and/or too difficult for me to implement in a few hours. There's lots of stuff that goes into making a plugin even of this calibre, and fairly niche stuff like this is generally less appealing to coders, especially when there's uncertainty as to exactly what's being requested. :kaoswt2:

    Here's a basic "teleport to random region" event snippet involving a script call to find and randomly select a tile with a given region ID:
    Code:
    ◆Script:var arr = [], regionId = 5;
    :      :for (var x = 0; x < $dataMap.width; x++) {
    :      :  for (var y = 0; y < $dataMap.height; y++) {
    :      :    if ($gameMap.regionId(x, y) === regionId) {
    :      :      arr.push({x: x, y: y});
    :      :    }
    :      :  }
    :      :}
    :      :var ix = Math.randomInt(arr.length), select = arr[ix];
    :      :$gameVariables.setValue(1, select.x);
    :      :$gameVariables.setValue(2, select.y);
    ◆Set Event Location:TeleportingEvent, ({variable1},{variable2})
    ◆Text:None, Window, Bottom
    :    :Event teleported!
    :    :\>          X-coordinate: \v[1]
    :    :\>          Y-coordinate: \v[2]
    Easy-copy version of the script call~
    Code:
    var arr = [], regionId = 5;
    for (var x = 0; x < $dataMap.width; x++) {
      for (var y = 0; y < $dataMap.height; y++) {
        if ($gameMap.regionId(x, y) === regionId) {
          arr.push({x: x, y: y});
        }
      }
    }
    var ix = Math.randomInt(arr.length), select = arr[ix];
    $gameVariables.setValue(1, select.x);
    $gameVariables.setValue(2, select.y);
    If you want to try it out, you'll probably need to edit a few numbers in the script call: the region ID in the first line and the variable IDs in the last two lines. By default it stores a random region-5 tile's x & y coordinates in variables 1 & 2. These variables can then easily be used in Set Event Location > Designation with variables. The script equivalent, if you need it, is the locate() function, e.g.
    • Script event command:
      • This Event:
        Code:
        this.character(0).locate(3, 4);
      • Specific event (e.g. event 12):
        Code:
        this.character(12).locate(3, 4);
    • Script in a move route:
      • This Event:
        Code:
        this.locate(3, 4);
      • Specific event (e.g. event 12):
        Code:
        $gameMap.event(12).locate(3, 4);

    You can use a move route before/after setting the event location to change the opacity of an event in multiple steps with short waits between them, creating a "fade" effect. If you want a simpler way to do it then this plugin may be of interest: https://forums.rpgmakerweb.com/index.php?threads/simple-event-fade.49435/

    Exactly how you'd use this to create the effect you're seeking depends a bit on the missing details. Possibly a parallel event on the relevant maps to check coordinates of the teleporting events (Control Variables > Game Data > Character > Screen X|Y); whenever one appears on-screen, teleport it to a random region (e.g. using the approach outlined above). Would likely be more fluid & CPU/RAM-efficient using a plugin specifically designed for it, but that's the trade-off with eventing stuff.

    Re the ambiguity, here's a few points for clarification that may help your request get noticed:
    1. You mention a "Teleport" command in the event's move route...so, something like how Yanfly's Event Chase Player plugin handles it? E.g. a script call something like "this._teleport = true;"?
    2. When the event appears on screen: based on their sprite or the single map tile they are currently occupying? Should the transfer occur immediately or wait a few frames or wait for the event's movement to complete?
    3. Do you want to be able to provide a global list of viable "teleport regions" via the Plugin Manager or would it be better for each teleporting event to specify one region it goes to?
    4. Can you provide the logic for selecting the teleport target? I imagine the first step would be "make list of all tiles with region X", but would it then be "pick a random one of those" or "pick one closest to the player if chasing, furthest away if fleeing" or something else?
    5. Can events teleport to any valid tile on the map or are they limited in some way, e.g. by distance?
    6. Should events be blocked from teleporting to a tile if there's another event and/or the player/followers on that tile?
    7. After teleporting, should the event be allowed to teleport again? If so, what sort of cooldown should apply? Should all teleporting events have the same cooldown period, or can some of them teleport more frequently than others?
    8. How should it work with Yanfly's Event Chase Player? E.g. events only teleport if they're currently chasing/fleeing?
    9. Fade in/out: opacity, right? Should the duration be adjustable? Should it be linked to the event's move speed/frequency or something like that?
    10. Do you want to play a sound effect or run an event or something whenever an event teleports? I know this seems like a simple thing to add on later, but it can impact how the more essential stuff is coded, so best to mention it up front just in case. :kaothx:
    It could also be helpful to note which features are essential for you and which ones are just a bonus~
     
    #9
  10. Mooshry

    Mooshry Ariana Grande has consumed my very existence help. Veteran

    Messages:
    362
    Likes Received:
    142
    Location:
    Your Air Conditioner
    First Language:
    Cow
    Primarily Uses:
    RMMV
    Oh, cool! I'm gonna try it out! Even though i don't understand a single pixel of that script... But the problem is, the enemy starts an event when it touches you. Is that a problem?

    EDIT: There! I edited the main post to be more clear.
     
    Last edited: Mar 5, 2019
    #10
    caethyril likes this.
  11. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,183
    Likes Received:
    731
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    I think if you were to event it, you'd need a separate, parallel event as a sort of "teleport controller". What with all the individual cooldowns and stuff, though, using events for it could get a bit messy. :kaoback:

    :kaojoy: No promises but I'll see if I can put something together!

    Edit @Mooshry: how does this look? View/download file
     
    Last edited: Mar 7, 2019
    #11

Share This Page