Page 1 of 3
talking to actors?
Posted:
Sat Nov 12, 2011 3:22 am
by hunter84
okay in my game i want to make a character that you have to talk to is that possible?
Re: talking to actors?
Posted:
Sat Nov 12, 2011 4:10 am
by SuperSonic
Yeah it is
Here is one way you could do it. First you would have two actors:
1. Player: The main character that you control
2. AI: The actor you talk to
Now what you want to do is set up a key down event for the AI actor like this:
- Code: Select all
AI -> Key down -> whatever button you want -> script editor ->
if(distance(Player.x, Player.y, AI.x, AI.y) <= some distance)
{
//put your talking code here
}
Hope that helped
Re: talking to actors?
Posted:
Sat Nov 12, 2011 5:43 am
by hunter84
i did that and it said
error line 1: Undeclared identifier some
Re: talking to actors?
Posted:
Sat Nov 12, 2011 5:46 am
by master0500
post your script
Re: talking to actors?
Posted:
Sat Nov 12, 2011 1:23 pm
by SuperSonic
hunter84 wrote:i did that and it said
error line 1: Undeclared identifier some
Haha, you are supposed to replace "some distance" with a number. That number is how close the player has to be in order to talk to AI
Re: talking to actors?
Posted:
Sat Nov 12, 2011 3:35 pm
by hunter84
o well how far away should he be i want it to be where in the game you go in front of him and press the up key to talk
Re: talking to actors?
Posted:
Sat Nov 12, 2011 6:48 pm
by SuperSonic
hunter84 wrote:o well how far away should he be
That is for you to decide. Play around with different numbers to find one that fits
Re: talking to actors?
Posted:
Sat Nov 12, 2011 8:04 pm
by hunter84
okay so if i replace some with 10 it says
error line 1: expected )
Re: talking to actors?
Posted:
Sat Nov 12, 2011 8:39 pm
by SuperSonic
You have to replace "some distance" not just "some". Like this:
- Code: Select all
AI -> Key down -> whatever button you want -> script editor ->
if(distance(Player.x, Player.y, AI.x, AI.y) <= 10)
{
//put your talking code here
}
That should work
Re: talking to actors?
Posted:
Sat Nov 12, 2011 8:41 pm
by hunter84
okay thanks and i saw that you are making animations?
Re: talking to actors?
Posted:
Sat Nov 12, 2011 8:46 pm
by hunter84
okay and should repeat be on?
Re: talking to actors?
Posted:
Sat Nov 12, 2011 8:50 pm
by SuperSonic
hunter84 wrote:okay thanks and i saw that you are making animations?
You're welcome and yes, I do make animations. Are you in need of any?
hunter84 wrote:okay and should repeat be on?
No
Re: talking to actors?
Posted:
Sat Nov 12, 2011 8:54 pm
by hunter84
and why does the player go behind Al instead of in front of Al?
Re: talking to actors?
Posted:
Sat Nov 12, 2011 8:56 pm
by SuperSonic
It is probobly a problem with your zdepth. Try lowering the zdepth for AI
Re: talking to actors?
Posted:
Sat Nov 12, 2011 9:04 pm
by hunter84
yes i would like to have some game art because i tried making a character and it wasn't any good.
how do i change the z depth?