Random npc event toggling

● ARCHIVED · READ-ONLY
Started by fuzzalicious 8 posts View original ↗
  1. I would like to have random npcs walk through my town, so I have a two questions:

    • How can you display a graphic on the map through scripting? (So I can make random npc appear)

    • Can you an event toggle by touching an npc, or script the npc to change if touch an event or tile id? 

    That way I could make npcs disappear out of the map, and have them turn when the road turns instead

    of having to type the whole route for all npcs.

    Any help would be geatly appreciated =)

     
  2. you questions show that you are very new to the program, and haven't learned the terminology or how things are done - for example, you should use eventing and NOT scripting for handling random events (there are no NPCs in the game, just events pretending to be NPCs - that's a very important difference).


    you can change and trigger events by a lot of different ways, you can set them move routes or restrict them to portions of the map or a lot of other things.


    I suggest you follow the link in my signature, that will show you to the most important tutorials and get you started fast.
  3. Excellent tutorials, especially about using forum search rather then googling =)

    When I learned about control variables I was able to figure how to go about

    making routes by eventing. However theres a little stutter when my npc walks,

    probably because when I click "set move route", it automaticly inserts

    Set Move Route: This event (wait) before $>Move left.

    I also read that I should use autonomous movement, but I guess it's not possible

    in this case?
     
  4. fuzzalicious said:
    However theres a little stutter when my npc walks,


    probably because when I click "set move route", it automaticly inserts


    Set Move Route: This event (wait) before $>Move left.
    No, that is just the command header - but by default the events are set to a slower speed than the player, you'll need to increase speed and frequency where needed to get them moving more fluently.
    autonomous movement is for independent movement outside cutscenes or special sequences - it usually helps a lot and makes things easier, but you can't coordinate several events as easy as with the set move route command.
  5. I have set frequency to max in autonomous movement and it's never changed.

    If I remove wait for completion in movement the stuttering stops, though it leads

    to many new problems.
  6. I was able to fix the stuttering by using script calls rather then events, but now i have

    move_route = RPG::MoveRoute.new
    m = RPG::MoveCommand.new
    in the code, and since I use it in a parallel process does it make a new instance every step?
  7. fuzzalicious said:
    I have set frequency to max in autonomous movement and it's never changed.
    Are you using autonomous movement?
    Changing the frequency in autonomous movement will not work if you're using a set move route command, it will only work if you have activated autonomous movement. If you're using a set move route command, then you need to change the speed inside that command sequence.


    Show us a screenshot of what you're doing, and then we can tell you if there is a better way - it reads as if you're mixing things that can't work together. And if at all possible, you should not use parallel process for movement - there are a few specific cases where you will need a parallel process for movement, but so far nothing I read here indicates that it is needed here, and too many parallel processes will cause lag in the game.


    fuzzalicious, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.
  8. Ahh no I was wrong, when I use autonomous movement and have frequency set to normal and then set a set route command event, the frequency

    speeds up so I assumed it was maxed.

    Now my code looks like;

    if $game_map.events[17].x == 1

    $game_variables[2] = 3

    elsif $game_map.events[17].x == 30

    $game_variables[2] = 2

    end

     

    move_route = RPG::MoveRoute.new

    m = RPG::MoveCommand.new

    m.code = $game_variables[2]

    move_route.list.insert(0,m.clone)

    $game_map.events[17].force_move_route(move_route)

     

     

    Which means if the event 17 (an npc) reaches furthest left or right her direction changes to other direction, to get the npc to walk back and forth the map.

     

    It works great but it's a parallel process and I don't know if it's leaking by creating new objects that arn't cleaned away.