Randomly moving character

  • #1, by JorkzMonday, 27. April 2020, 07:38 4 years ago
    It's all in the title !... ^^

    According to you, what is the easiest solution to set up a secondary and non-player character who moves randomly, like the rabbit in Sam and Max: hit the road? (and above all: not necessarily in the same ways as the player's)

    Thank you in advance


    90 Posts

  • #2, by afrlmeMonday, 27. April 2020, 14:10 4 years ago
    Are they supposed to just randomly walk around now & then or are they supposed to stop & do things?

    Here's some basic concept thing I quickly mocked up for someone else. It's just a couple of sheep dynamically walking around part of a scene.


    I used code, but technically you can do it with action parts like so...

    - - - -

    1. create an at begin of scene action - if you don't already have one.

    2. create a value somewhere & call it "rnd_char_dest".

    3. create another value & call it "rnd_char_wait".

    4. create a called by other action & rename it something like "rnd_char_dest".

    5. now add these action parts to the called by other action that you just created...

    set random value "rnd_char_dest" between 1 and 3
    set random value "rnd_char_wait" between 500 and 5000
    pause for value "rnd_char_wait"
    if value "rnd_char_dest" is 1
      send character "Tom" to position 100, 300 and wait
    elseif value "rnd_char_dest" is 2
      send character "Tom" to position 440, 200 and wait
    else if value "rnd_char_dest" is 3
      send character "Tom" to position 200, 220 and wait
    end if
    jump to action part #1

    6. now add a call action action part into the at begin of scene action block & link it to the called by other action you created.

    7. now create an at end of scene action - if you don't already have one - & add a quit action part (same action part as step 6) & link the called by other action to it to so that the loop gets killed on scene end.

    Rinse & repeat for any other scenes you want to do this for. You can use the existing values that you created earlier - no need to keep creating those - so just make sure you create them somewhere easy to access, such as on the character you want to move around.


    7278 Posts

  • #3, by MachtnixMonday, 27. April 2020, 17:04 4 years ago
    Great, thanks by me too. It looks better if sometimes there is a little action on the screen... smile

    Thread Captain

    1097 Posts

  • #4, by afrlmeMonday, 27. April 2020, 17:49 4 years ago
    oops, I forgot to add the link to the sheep ved & resource files. my bad. updated my last post & added the link.


    7278 Posts