Page 1 of 1

ReDraw Actor

PostPosted: Tue Dec 25, 2007 11:10 pm
by scottieb
I think one of the largest problems with all video games AI and I am new at this so it is really difficult. I think if GE had an option to redraw an actor in the events list it would make AI alot easier. I think the usual way of doing this would be through script, but a lot of people don't know script like me. Maybe this can be done through conditonal actions or something, but I would like there to be a way to change the behavior easier. If any one could give me some code for this I apprieciate it.

Re: ReDraw Actor

PostPosted: Wed Dec 26, 2007 11:55 am
by Fuzzy
What do you mean redraw? The actor will be redrawn in the next frame.. What different effect do you need?

Re: ReDraw Actor

PostPosted: Thu Dec 27, 2007 7:17 pm
by kirby
Redraw actor?? Wait wait... what do you mean? :P (Sorry could you explain?)

Re: ReDraw Actor

PostPosted: Fri Dec 28, 2007 8:48 pm
by scottieb
If you go the actor control screne and to add events you have the list of things to add. One of them is draw actor. I think they should add Redraw actor. If the actor has a collision then it is redrawn and it's behavior is changed. They would save writing out code for those who are challenged with that. It doesn't have to be called Redraw actor either. Ok there is an event and that causes the actor to stop useing a script and switches to another script and changes the actors behavior.

Re: ReDraw Actor

PostPosted: Fri Dec 28, 2007 10:09 pm
by Troodon
You can do this by adding in the draw actor:

if (redrawVariable == 1)
{
//draw actor things;
}

if(redrawVariable == 2)
{
//redraw actor things;
}

etc etc

Re: ReDraw Actor

PostPosted: Sat Dec 29, 2007 2:44 am
by Bee-Ant
:lol: that code would make him confused :lol:

Re: ReDraw Actor

PostPosted: Sat Dec 29, 2007 4:26 am
by kirby
:lol: Oh oh...? Whats that?

Re: ReDraw Actor

PostPosted: Sat Dec 29, 2007 4:35 am
by Lightboy
Do you meant
AnyActor>DrawActor>DrawActor>

Re: ReDraw Actor

PostPosted: Sat Dec 29, 2007 8:06 am
by Fuzzy
Here is the order of operations.

1. GE calls draw actor for the view.
2. view draw actor runs any code that you type in.
3. view draw actor commands each actor in view to draw itself.
4. the actor execute the code that you put in your draw actor event for that actor.
5. the actor now draws itself.
6. the next actor starts step 4.
7. when all the actors are drawn, control is passed back to draw actor->view.
8. It does stuff like figure out who is still in view and builds a list for the next frame draw.
9. GE processes the other events.
10. start at step 1 again.

Its not perfect, but pretty close to that. only makslane knows for sure. But by this you can see that a redraw or refresh dont make much sense.

Re: ReDraw Actor

PostPosted: Sat Dec 29, 2007 1:15 pm
by Troodon
Fuzzy wrote:Here is the order of operations.

1. GE calls draw actor for the view.
2. view draw actor runs any code that you type in.
3. view draw actor commands each actor in view to draw itself.
4. the actor execute the code that you put in your draw actor event for that actor.
5. the actor now draws itself.
6. the next actor starts step 4.
7. when all the actors are drawn, control is passed back to draw actor->view.
8. It does stuff like figure out who is still in view and builds a list for the next frame draw.
9. GE processes the other events.
10. start at step 1 again.

Its not perfect, but pretty close to that. only makslane knows for sure. But by this you can see that a redraw or refresh dont make much sense.


Perfectly explained. But Scottieb just wanted to define actor behaviour with a variable. And since he didn't know how to call it he used term "redraw".

Re: ReDraw Actor

PostPosted: Sat Dec 29, 2007 2:03 pm
by MrScience101
I think it would be great if you could force an actor to update and redraw itself. For instance in the global code if you could type:

actor1.textNumber = 50;

and then type:

actor1.update(); //Forces the actor to update.

That way you could use a lot more global code.

Re: ReDraw Actor

PostPosted: Sat Dec 29, 2007 2:13 pm
by Troodon
What do you mean? Can't you just do this by retyping the command?

Re: ReDraw Actor

PostPosted: Sat Dec 29, 2007 11:58 pm
by MrScience101
hmm if I make a GLOBAL function called Update() in the script editor like so:

void Update()
{
actor1.textNumber = 5;
}

and then I call the Update function from within a local actor like:

//script editor mouse down -> left on actor2

actor2. x = 50;
Update();

Then actor1's text number is not updated. It will still display as 0 even though actor1.textNumber actually equals 5;

Hope that helps.

Re: ReDraw Actor

PostPosted: Sun Dec 30, 2007 2:45 am
by Fuzzy
Correct. You cannot explicitly refer to an actor in global code. Actor1 in your example would point to null as actor1's create actor function has not been called yet.

When we define an actor, we are really defining a prototype. It happens that an instance is created too, unless you select "create at start up <no>".

To solve your problem you can rewrite that function using pointers.