Target Lock...?

Non-platform specific questions.

Target Lock...?

Postby linux_man007 » Sun Mar 28, 2004 9:17 pm

Makslane, is possible to aquire the data members of another actor through a pointer?

I think this would create a lock-on feature.

Is there any way to target another actor?
linux_man007
 
Posts: 59
Joined: Sun Nov 23, 2003 11:35 pm
Location: Rochester, MN USA
Score: 0 Give a positive score

Postby makslane » Mon Mar 29, 2004 1:45 pm

To get a pointer to any actor, use:

Actor *p = getclone("youractorname.0"); //you must put the clone index

Is there any way to target another actor?


What do you want?
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby linux_man007 » Sat Apr 10, 2004 5:54 am

What I want is to be able to click on another actor so that I can move the actor by clicking again somewhere on the screen, (if the actor player-controlled), or set the actor's target by clicking the mouse while it is hovering over the actor you want to target, so that the player may either interact with the actor(if it is friendly) or attack it(if it is an enemy).

Since the time I brought this subject up, I've been working on a target lock script.

What I believe I have to do for targeting an actor at coordinates x,y is this:

Actor *lock;

lock = getactor(x, y);

So, to target a clone by the name of 'monster.0', I type this:

Actor *lock;

lock = getclone("monster.0");

And to target the collide actor, I type this:

Actor *lock;

lock = &


Am I correct?
linux_man007
 
Posts: 59
Joined: Sun Nov 23, 2003 11:35 pm
Location: Rochester, MN USA
Score: 0 Give a positive score

Postby makslane » Sat Apr 10, 2004 1:59 pm

A MoveTo action on the Mouse Button Down event don't solve this?
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby linux_man007 » Sat Apr 10, 2004 5:30 pm

Is the mouse button down event executed only when the mouse pointer hovers over an actor?
linux_man007
 
Posts: 59
Joined: Sun Nov 23, 2003 11:35 pm
Location: Rochester, MN USA
Score: 0 Give a positive score

Postby makslane » Sat Apr 10, 2004 8:20 pm

Yes
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby linux_man007 » Sat Apr 10, 2004 8:33 pm

If I had a mouse pointer object follow the coordinates for the mouse,
and I used the global code:

Actor *lock;

lock = getactor(xmouse,ymouse)

The pointer called lock would point to the mouse pointer actor.

Am I correct?
linux_man007
 
Posts: 59
Joined: Sun Nov 23, 2003 11:35 pm
Location: Rochester, MN USA
Score: 0 Give a positive score

Postby makslane » Sun Apr 11, 2004 2:25 pm

Yes, but you can try this:

When you mouse pointer actor receives a click, store the mouse coordinates, or xscreen and yscreen, and send an Activation Event to your other actors.

When the other actors receive the Activation Event from your pointer actor, do a MoveTo action to the stored coordinates
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest