JavaScript questions that don't deserve their own thread

● ARCHIVED · READ-ONLY
Started by Shaz 3413 posts Page 23 of 171 View original ↗
  1. Is there a way to change the formula or something about the target behavior of the enemies? I would like to have the enemy target both the players and the other enemies. Possibly by tagging the enemy with <target: all>. Any enemies tagged with that should be able to target both, while non tagged will just attack the players.
  2. How do I use yanfly's main menu manager to call another plugin such as Szyu's Crafting System?
  3. Milena said:
    Is there a way to change the formula or something about the target behavior of the enemies? I would like to have the enemy target both the players and the other enemies. Possibly by tagging the enemy with <target: all>. Any enemies tagged with that should be able to target both, while non tagged will just attack the players.

    Yanfly's target manager will let you mess with both player and enemy targeting.  That should help your needs.  Here is a link

    http://yanfly.moe/2016/02/26/yep-74-target-core/
     

    ShadowMiscreant said:
    How do I use yanfly's main menu manager to call another plugin such as Szyu's Crafting System?


    Name: 


    Symbol: 


    Show: 


    Enabled: 


    Ext:


    Main Bind: 


    Actor Bind:

    You need that information and put it into the MainMenuManager plugin.  I'd get in contact with the person who wrote Szyu's Crafting System and ask them to help you figure out the inputs.  That's the best I can say : /  sorry.
     
  4. Is there a way to modify the game interpreter in anyway to allow events run inside a scene? For example, I have a common event that runs a show text message. It actually doesn't work inside the scene, rather you have to quit the scene before the event runs. Is there a way to fix this?
  5. Milena said:
    Is there a way to modify the game interpreter in anyway to allow events run inside a scene? For example, I have a common event that runs a show text message. It actually doesn't work inside the scene, rather you have to quit the scene before the event runs. Is there a way to fix this?

    Having the interpreter run in any scene is tricky issue. I believe Tsukihime was working on that but there was a problem with a memory leak. I would suggest adding the window_message window to the scene and displaying the message with a script rather than just events.
  6. Is there a single line of code that unequips all equipment from a single actor?
  7. How would I check which actor in which position of the party order?
  8. How can I move two events at the same time within a script?
  9. BloodletterQ said:
    How would I check which actor in which position of the party order?

    $gameParty.members().indexOf($gameActors.actor(x))


    Replacing x with the actor's id

    asksuyo said:
    How can I move two events at the same time within a script?
    Code:
    // 4 = left
    // 2 = down
    // 8 = up
    // 6 = right
    // (look at the numpad)
    
    event1.moveStraight(4);
    event2.moveStraight(4);
  10. DreamX said:
    // 4 = left
    // 2 = down
    // 8 = up
    // 6 = right
    // (look at the numpad)

    event1.moveStraight(4);
    event2.moveStraight(4);



    I tried this and it only moves one event?


    This is my code:

    Code:
    var alias_Game_Player_moveByInput = Game_Player.prototype.moveByInput;
    Game_Player.prototype.moveByInput = function() {
    	alias_Game_Player_moveByInput.call(this);
    
        if (Tobie.GridPuzzle.selected()) {
    
          var move_event = events_to_be_moved;
    
          if(Input.isTriggered('left')) {
            for(var i = 0; i < move_event.length; i++) {
               $gameMap.event(move_event[i]).moveStraight(4);
    		}
          } else if (...the rest of the directions) {
                                                 ...
        }
     }
  11. asksuyo said:
    I tried this and it only moves one event?


    This is my code:



    var alias_Game_Player_moveByInput = Game_Player.prototype.moveByInput;
    Game_Player.prototype.moveByInput = function() {
    alias_Game_Player_moveByInput.call(this);

    if (Tobie.GridPuzzle.selected()) {

    var move_event = events_to_be_moved;

    if(Input.isTriggered('left')) {
    for(var i = 0; i < move_event.length; i++) {
    $gameMap.event(move_event).moveStraight(4);
    }
    } else if (...the rest of the directions) {
    ...
    }
    }


    Did you check the length of events_to_be_moved? If it has a length of one it'll only do one event.
  12. DreamX said:
    Did you check the length of events_to_be_moved? If it has a length of one it'll only do one event.



    I've checked the length and it is longer than 1.
  13. asksuyo said:
    I've checked the length and it is longer than 1.

    What is the array composed of? Event ids?
  14. DreamX said:
    What is the array composed of? Event ids?



    Yes the array is composed of event ids.


    This is the for loop I have in my function.
    The strange thing is it only works on one event even when I try to call other events.

    Code:
    var event_ids_array = calling_array_with_ids;
    for (var event_id = 0; event_id < event_ids_array.length; event_id++) {
        $gameMap.event(event_ids_array[event_id]).moveStraight(4);
    }
  15. asksuyo said:
    Yes the array is composed of event ids.


    This is the for loop I have in my function.
    The strange thing is it only works on one event even when I try to call other events.



    var event_ids_array = calling_array_with_ids;
    for (var event_id = 0; i < event_ids_array.length; i++) {
    $gameMap.event(event_ids_array[event_id]).moveStraight(4);
    }

    Try something like this. I've tested it and can confirm it works.

    Code:
    var eventIds = [1, 2, 3, 4];
    var direction = 4;
    for (var i = 0; i < eventIds.length; i++) {
    var id = eventIds[i];
    $gameMap.events()[id].moveStraight(direction);
    }
  16. DreamX said:
    Try something like this. I've tested it and can confirm it works.



    var eventIds = [1, 2, 3, 4];
    var direction = 4;
    for (var i = 0; i < eventIds.length; i++) {
    var id = eventIds;
    $gameMap.events()[id].moveStraight(direction);
    }





    This is very strange.


    Now none of the events are moving.

    Code:
    var alias_Game_Player_moveByInput = Game_Player.prototype.moveByInput;
    Game_Player.prototype.moveByInput = function() {
    	alias_Game_Player_moveByInput.call(this);
    
    	if (Tobie.GridPuzzle.selected()) { //if you want to move events 
    
    		var eventIds = [1, 2];
    
    		if(Input.isTriggered('left')) {
    
    			var direction = 4;
    			for (var i = 0; i < eventIds.length; i++) {
    				var id = eventIds[i];
    				$gameMap.events()[id].moveStraight(direction);
    			}
    
    		} else if(Input.isTriggered('right')) {
    			...
    		}
    	}
    }
  17. asksuyo said:
    This is very strange.


    Now none of the events are moving.



    var alias_Game_Player_moveByInput = Game_Player.prototype.moveByInput;
    Game_Player.prototype.moveByInput = function() {
    alias_Game_Player_moveByInput.call(this);

    if (Tobie.GridPuzzle.selected()) { //if you want to move events

    var eventIds = [1, 2];

    if(Input.isTriggered('left')) {

    var direction = 4;
    for (var i = 0; i < eventIds.length; i++) {
    var id = eventIds;
    $gameMap.events()[id].moveStraight(direction);
    }

    } else if(Input.isTriggered('right')) {
    ...
    }
    }
    }






    I GOT IT!


    The event's priority in RPG Maker was set to below character.


    After changing it to same as character the events moved at the same time!


    Thank you DreamX for your help!
  18. asksuyo said:
    I GOT IT!


    It seems the image I was using for the event made it so that the events were not able to move.


    Once I had changed them to other images both events were able to move at the same time.


    Thank you DreamX for your help!


    On another note is there a way I can tell if an image used for an event is unmoveable?

    No problem.


    if you want to check if an event can move you use event.canMove()


    Edit: Correction
  19. TheGamedawg said:
    Is there a single line of code that unequips all equipment from a single actor?



    You can unequip an actor with the clearEquipments() function like this:


    $gameActors.actor(ID).clearEquipments();
  20. I am trying add an event to the map using the 'F8' console


    var e = {"id":2,"name":"EV002","note":"","pages":[{"conditions":{"actorId":1,"actorValid":false,"itemId":1,"itemValid":false,"selfSwitchCh":"A","selfSwitchValid":false,"switch1Id":1,"switch1Valid":false,"switch2Id":1,"switch2Valid":false,"variableId":1,"variableValid":false,"variableValue":0},"directionFix":false,"image":{"tileId":0,"characterName":"Actor1","direction":2,"pattern":0,"characterIndex":0},"list":[{"code":101,"indent":0,"parameters":["Actor1",0,0,2]},{"code":401,"indent":0,"parameters":["I am the 3rd Event"]},{"code":0,"indent":0,"parameters":[]}],"moveFrequency":3,"moveRoute":{"list":[{"code":0,"parameters":[]}],"repeat":true,"skippable":false,"wait":false},"moveSpeed":3,"moveType":0,"priorityType":1,"stepAnime":true,"through":false,"trigger":0,"walkAnime":false}],"x":5,"y":5};
    var l = $dataMap.events.length;
    $dataMap.events[l] = e;
    $gameMap._events[l] = new Game_Event($gameMap._mapId, l);


    it should add an event at pos(5,5). However, the event can be triggered but the character is not shown. Could you point me out where the issue is? Thanks.