Running rep_exec before updating the screen (SOLVED)

Started by 2ma2, Thu 12/05/2005 16:34:45

Previous topic - Next topic

2ma2

Don't know if this has been discussed, but is it possible to execute commands BEFORE the screen is updated? What I do know is setting the x and y coordinates to match the players character, in order to make a free overlay (like for instance an overcoat).

The problem lies where the character updates it's position one cycle before the rep_exec positions the overlay accordingly. This is ofcourse not a problem when the characters stands still.

I have tried to exchange the coordinating placement to making two MoveCharacter-commands instead, and also set so characters can be walked through. Albeit, they still don't move exactly in similar ways (and they have the same speed and animation speed). Could be something about the character turning setting, I have to check this out..

Kweepa

Quote from: 2ma2 on Thu 12/05/2005 16:34:45
Albeit, they still don't move exactly in similar ways (and they have the same speed and animation speed). Could be something about the character turning setting, I have to check this out..

It could also be because you have anti-glide mode on?
Still waiting for Purity of the Surf II

Ishmael

#2
:P



FollowCharacter
(Formerly known as global function FollowCharacter, which is now obsolete)
(Formerly known as global function FollowCharacterEx, which is now obsolete)

Character.FollowCharacter(Character* chartofollow, optional int dist,
                          optional int eagerness)

Tells the character to follow CHARTOFOLLOW around, wherever he goes. You could use this command to have a group of main characters who go around together, or for example when the hero has rescued someone from the bad guy, they can follow the hero home.
Pass CHARTOFOLLOW as null to stop the character following.

There are a couple of extra optional parameters:

DIST sets how far away from CHARTOFOLLOW that CHARID will stand. If DIST is 1, they will try to stand very close; if DIST is for example 20, they will stand about 20 pixels away.

EAGERNESS sets on average how long the character will stand around before checking if he needs to move again. Setting this to 0 means that he will always be on the move until he reaches CHARTOFOLLOW; setting this to 99 means that he will pause and think for a while on route. Values in between specify different lengths of idle time.

The default values are DIST=10 and EAGERNESS=97.

As a special case, setting DIST=0 and EAGERNESS=0 makes CHARID behave as if it is chasing CHARTOFOLLOW - it will try and get there as quickly as possible. Setting EAGERNESS=0 also tells the character not to stop when they reach CHARTOFOLLOW, but instead to randomly wander around the character - useful perhaps for a very energetic dog or something.

There is also another special use for this command. You can pass the special value FOLLOW_EXACTLY as the DIST parameter rather than passing a number. If you do this, then CHARID will always remain at exactly the same X and Y co-ordinates as CHARTOFOLLOW. This might be useful for effects such as a temporary halo over the character and so forth.

If you use FOLLOW_EXACTLY, then EAGERNESS has another meaning. If you pass 0, CHARID will be drawn in front of CHARTOFOLLOW; if you pass 1, it will be drawn behind.

Example:

cMan.FollowCharacter(cEgo, 5, 80);

will make character MAN follow character EGO standing about 5 pixels near him and waiting for a while before he makes his move.

I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Pumaman

You can use on_event ENTER_ROOM to call repeatedly_execute if you want, but be careful that you don't call any blocking functions from within it if you do so.

The easiest way to have an overlay on the character like that is to use FollowCharcacter's FOLLOW_EXACTLY option, as Ishmael points out.

2ma2


SMF spam blocked by CleanTalk