Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,490 guests, and 12 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
how to make friends follow you in a good way? #324512
05/21/10 12:54
05/21/10 12:54
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline OP
Member
Muhsin  Offline OP
Member

Joined: Nov 2008
Posts: 196
the wrong place
Hi!

I'm programing friend npc, who I can make following me.
the problem is, when I got more then one friend, and they try to follow me, they walk into each other.

how can I make them not touch each other and still follow me?

here is the friend code so far:
------------------------------------------------------
action skinnyfriend()
{
my.HEALTH = 100;

var follow_mode = false;
VECTOR temp;
VECTOR skinnyfriend_distance;

while(my.HEALTH > 0)
{
if(player)
{

if(follow_mode == true)
{

vec_set(temp, player.x);
vec_sub(temp, my.x);
vec_to_angle(my.pan, temp);
my.tilt = 0;



if(vec_dist(my.x, player.x) < 340 && vec_dist(my.x, player.x) > 50 && player.HEALTH > 0)
{

skinnyfriend_distance.x = 10 * time_step;
skinnyfriend_distance.y = 0;
skinnyfriend_distance.z = 0;

c_move(my, skinnyfriend_distance, nullvector, NULL);
ent_animate(my, "run", my.skill1, ANM_CYCLE);
my.skill1 += 9 * time_step;
if(my.skill1 > 100) {my.skill1 = 0;}
}

if(vec_dist(my.x, player.x) < 50 || player.HEALTH < 1)
{
ent_animate(my, "control", 1, ANM_CYCLE);
vec_set(temp, player.x);
vec_sub(temp, my.x);
vec_to_angle(my.pan, temp);
my.tilt = 0;
}

if(key_2)
{
follow_mode = false;
}
}

else if(vec_dist(my.x, player.x) < 70 && player.HEALTH > 0)
{
ent_animate(my, "control", 1, ANM_CYCLE);
vec_set(temp, player.x);
vec_sub(temp, my.x);
vec_to_angle(my.pan, temp);
my.tilt = 0;

if(key_1)
{
follow_mode = true;
}
if(key_3)
{
//shut up
}
if(key_4)
{
//run n' hide
}
}



else if(vec_dist(my.x, player.x) < 30 && player.HEALTH > 0)
{
c_move(my,vector(-1 * time_step, 0, 0), nullvector, GLIDE);
}

else if(vec_dist(my.x, player.x) < 150 && player.HEALTH > 0)
{
vec_set(temp, player.x);
vec_sub(temp, my.x);
vec_to_angle(my.pan, temp);
my.tilt = 0;

ent_animate(my, "shout", my.skill4, ANM_CYCLE);
my.skill4 += 9 * time_step;
if(my.skill4 > 100) {my.skill4 = 0;}
}

else
{
ent_animate(my, "idle", my.skill3, ANM_CYCLE);
my.skill3 += 1 * time_step;
if(my.skill3 > 100) {my.skill3 = 0;}
}

}

wait(1);
}
}
------------------------------------------------------

Thanks for the help!


- Muhsin Kaymak


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: how to make friends follow you in a good way? [Re: Muhsin] #324513
05/21/10 13:04
05/21/10 13:04
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
If its only the player who has friends wink , you can use a global variable which saves the amount of following friends, otherwise you have to use a skill and let the player scan from time to time whether friends are following.
Then you can spread places around the player which the friends are targetting instead of the player directly. Or, you can give the friends numbers, and, depending the numbers make them follow in a different distance.
Probably, they have to make a check whether there is already a friend between them and the player to stop them from trying to get closer ti the player.

Re: how to make friends follow you in a good way? [Re: Pappenheimer] #324521
05/21/10 13:41
05/21/10 13:41
Joined: Apr 2005
Posts: 4,506
Germany
F
fogman Offline
Expert
fogman  Offline
Expert
F

Joined: Apr 2005
Posts: 4,506
Germany
Another way: Let the player spread "breadcrumbs".
Create one breadcrumb for every friend.

Set the breadcrumbs to slightly different positions and give
every one a unique ID, so that the friends can determine their personal crumb.


Last edited by fogman; 05/21/10 13:42.

no science involved
Re: how to make friends follow you in a good way? [Re: fogman] #324581
05/21/10 20:22
05/21/10 20:22
Joined: Jul 2008
Posts: 223
Pittsburgh
The_Clyde Offline
Member
The_Clyde  Offline
Member

Joined: Jul 2008
Posts: 223
Pittsburgh
Heres a link from my bookmarks that should help you:
http://www.red3d.com/cwr/steer/

It's got a bunch of pathfinding techniques that it explains and demonstrates how they work with Java applets.

Re: how to make friends follow you in a good way? [Re: The_Clyde] #324593
05/21/10 21:31
05/21/10 21:31
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline OP
Member
Muhsin  Offline OP
Member

Joined: Nov 2008
Posts: 196
the wrong place
Now all the friends have ID. I'm still trying to figure out how to make them follow me the right way.

I will post, when i found out how to do it, until then any help might help grin

thanks for the helps!

- Muhsin Kaymak


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: how to make friends follow you in a good way? [Re: Muhsin] #324598
05/21/10 23:09
05/21/10 23:09
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline OP
Member
Muhsin  Offline OP
Member

Joined: Nov 2008
Posts: 196
the wrong place
I found out how to do.

here is how I did:

1. giving ID's for the friends
2. create positions around the player(by using models as positions)(I used ent_create to create them in-game)
3. make the positions follow the player.
4. have the friends follow the positions.


thanks very much for the helps!


- Muhsin Kaymak


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: how to make friends follow you in a good way? [Re: Muhsin] #324604
05/22/10 03:02
05/22/10 03:02
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Can u please upload example of what you've done? laugh


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: how to make friends follow you in a good way? [Re: 3run] #324610
05/22/10 09:24
05/22/10 09:24
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline OP
Member
Muhsin  Offline OP
Member

Joined: Nov 2008
Posts: 196
the wrong place
yea, of course.

here is how I did:

first write "ENTITY* position1;" and "var friendcount" on the top of you script.

then in you player code write "ent_create("position1.mdl", nullvector, func_position1);" //it creats position1 model at the vector(0,0,0) and gives it the function "func_position1"

after that, create the function for the position, I did like this:

----------------------------------------
function func_position1()
{

position1 = me; //tells that it is the position1
set(my, PASSABLE); //makes it passable
set(my, INVISIBLE); //makes it invisible

while(1)
{
my.pan = player.pan; //pan as the player pan
my.x = player.x; //be on the same x as the player (if you want the position to be before or after the player, you write +something or -something after the x, like I did with the y.
my.y = player.y+50; //be on the same y+50 as the player
my.z = player.z; //be on the same z as the player

wait(1);
}
}
--------------------------------------------------------

then you go down to you friend code and give it a ID and make it go to its position, like this:

-------------------------------------------------------------------
action friend()
{
var tailnumber = 0;

friendcount = friendcount + 1; //this counts up the friendcount var in the top, when the friend has been created.

tailnumber = friendcount; //gives the friend an ID, by seen what the friendcount was on, when he was created.

while(1)
{

if(tailnumber == 1) //if the friend got the ID 1.
{
vec_set(temp, position1.x) //this will make it look at position1
vec_sub(temp, my.x); //this will make it look at position1
vec_to_angle(my.pan, temp); //this will make it look at position1
my.tilt = 0; //don't tilt, when looking

then you use c_move to make it walk toward its own x-axis. and because its x-axis is turned toward the position1, it will walk that way.
}

}
}

---------------------------------------------------------------------

it isn't the best way to do it, but it worked for me, so I use it.

I hope it was clearly enough. if you don't understand, then ask me and I will try to explain another way.


thanks


- Muhsin Kaymak

EDIT: I might be able to upload an example script later...if you got time to wait?

Last edited by Muhsin; 05/22/10 09:35.

Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: how to make friends follow you in a good way? [Re: Muhsin] #324725
05/22/10 21:01
05/22/10 21:01
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Thank you boss laugh everything is clear. About an example, just upload it when you'll be able to laugh there is no need to hurry laugh Thank you again bro


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: how to make friends follow you in a good way? [Re: 3run] #324729
05/22/10 21:17
05/22/10 21:17
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline OP
Member
Muhsin  Offline OP
Member

Joined: Nov 2008
Posts: 196
the wrong place
Ok, you example will be ready tomorrow..... or the day after tomorrow....hopefully grin


- Muhsin Kaymak


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Page 1 of 2 1 2

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1