2 registered members (AndrewAMD, TipmyPip),
12,400
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
How do i pick up and carry a "box" and then set it down agian?
#267480
05/24/09 09:44
05/24/09 09:44
|
Joined: Mar 2006
Posts: 321 Norway
Eagelina
OP
Senior Member
|
OP
Senior Member
Joined: Mar 2006
Posts: 321
Norway
|
I am now trying to make this: player go and pick up a box/key , and then carry it visble to another point and then set it down.
But how /what type of code do I need for carry a object visible from one place to another? I have this code for picking up a key from aum 78, it works fine.
//attach to they keys you whant to use
action my_key()
{
set(my, PASSABLE);
while (!player) {wait (1);} // wait until the player is loaded
while (vec_dist (player.x, my.x) > 50) // this loop runs until the player picks up the key
{
my.pan += 5 * time_step; // 5 gives the rotation speed of the key
wait (1);
//
}
// the player has got the key here
got_key += 1; //add 1 key more
wait(1);
set(my, INVISIBLE);
}
A6 and A7 Commercial ------------------- Programmer always searching for more to learn and understand.
|
|
|
Re: How do i pick up and carry a "box" and then set it down agian?
[Re: Eagelina]
#267483
05/24/09 11:02
05/24/09 11:02
|
Joined: Apr 2009
Posts: 298 Southern Oceans
KiwiBoy
Member
|
Member
Joined: Apr 2009
Posts: 298
Southern Oceans
|
You need to set against vertices or a set height and distance from player or whatever is picking it up. So sort out how you are going to do that first. Next, you need to set to the position same as you would when glueing camera to player with vec_set. Then you need to tell it that it moves with you, via offset (checkout thanks (tanks) in one of the earlier Aums for attaching rotating gun barrel to tank) and my.frame. Verice attach is solid and if you tit, the box has to as well, so you need to make it do that too. 
Use the 'manual' Luke, the manual is your friend. 'Self reminder' My WebPage
|
|
|
Re: How do i pick up and carry a "box" and then set it down agian?
[Re: Eagelina]
#267502
05/24/09 15:02
05/24/09 15:02
|
Joined: Mar 2006
Posts: 321 Norway
Eagelina
OP
Senior Member
|
OP
Senior Member
Joined: Mar 2006
Posts: 321
Norway
|
How about using physics? Is that an alternative? And how is that used to make that happend: pick up a box carry it and set it down.
A6 and A7 Commercial ------------------- Programmer always searching for more to learn and understand.
|
|
|
Re: How do i pick up and carry a "box" and then set it down agian?
[Re: Eagelina]
#267695
05/25/09 23:02
05/25/09 23:02
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
User
|
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi! I use : vec_for_vertex I find in MED the position of the vertex that I want and then in the code vec_for_vertex (ent_that_picksup,entity,165); Hope this helps  Ottawa
|
|
|
Re: How do i pick up and carry a "box" and then set it down agian?
[Re: KiwiBoy]
#267774
05/26/09 07:52
05/26/09 07:52
|
Joined: Mar 2006
Posts: 321 Norway
Eagelina
OP
Senior Member
|
OP
Senior Member
Joined: Mar 2006
Posts: 321
Norway
|
@Ottawa I whant to make a more flexible code so that I can use it everywhere. But thanks for the suggestion. It is so interesting to see what you al suggest. It helps a lot  @KiwiBoy I like your suggestion and made this action. It works fine when it comes to pick up the box. But when I turn around with it it kind of turn inside the player. And stays there until I turn again. How do I fix that? And how do I make the player leave the box afther he has carried it to the place I whant?Here are my action so far: action my_box()
{
while (!player) {wait (1);} // wait until the player is loaded
while (vec_dist (player.x, my.x) >20) // this loop runs until the player picks up the box
{
my.x = player.x +50;
my.y =player.y;
my.z =player.z +50;
if(key_l)//leave the box here
{
//here I whant to be able to set the box down and leave it
//maybee use vec_dist(player.x,my.x)>-200);//so the player cant "feel" the box ????
//then some code for leaving the box here......
set(my, INVISIBLE);//test if the program reacts
}
wait (1);
}
}
Last edited by Eagelina; 05/26/09 07:55.
A6 and A7 Commercial ------------------- Programmer always searching for more to learn and understand.
|
|
|
Re: How do i pick up and carry a "box" and then set it down agian?
[Re: Pappenheimer]
#267783
05/26/09 08:29
05/26/09 08:29
|
Joined: Mar 2006
Posts: 321 Norway
Eagelina
OP
Senior Member
|
OP
Senior Member
Joined: Mar 2006
Posts: 321
Norway
|
Thanks! I did download it now, and are going to "dig" into it during the day. Just love this...lol.... so interesting.... in danger of sounding like a litle child in a candy store. I just love to find out how things work..... 
A6 and A7 Commercial ------------------- Programmer always searching for more to learn and understand.
|
|
|
|