Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
0 registered members (), 635 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How do i deactivate/disable physical objects? #82051
07/18/06 14:20
07/18/06 14:20
Joined: Jul 2006
Posts: 28
Amman, Jordan
Dareen Offline OP
Newbie
Dareen  Offline OP
Newbie

Joined: Jul 2006
Posts: 28
Amman, Jordan
Hello,

i'm having a problem in this: i need to disable some physical entities but without enabling other already disabled entities of the same action.

i.e.:
i have the action rocket, i want it to launch a rocket and then disable its physics after 5 seconds, what happens is that the rocket gets disabled, but when another rocket is launced; the disabled rocket is enabled again

how do i fix that!!


Upon my end shall I begin? Forsaking all I've fallen for.. I rise to meet the END!!
Re: How do i deactivate/disable physical objects? [Re: Dareen] #82052
07/19/06 08:28
07/19/06 08:28
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
zwecklos Offline
Member
zwecklos  Offline
Member

Joined: Sep 2005
Posts: 274
Switzerland - Zurich
Hi there,
You can try to write 2 diffrent actions for your rockets. alternate those two actions when you create your rockets...so you can disable the first rocket after the 5 seconds. Fire up the second rocket without getting the first rocket back to physic behaviour (diffrent action). Make sure that you use diffrent entity names like rocket_1/rocket_2.

Code:

var rocket_alternater;
var rocket_counter;

function fire_rocket
{
rocket_alternater = rocket_counter % 2;

if(rocket_alternater == 0)
{
ent_create("rocket_mdl.mdl", create_position, rocket_01);
}

if(rocket_alternater == 1)
{
ent_create("rocket_mdl.mdl", create_position, rocket_02);
}

rocket_counter += 1;

}


action rocket_01
{
rocket_1 = my;
...
..
.
}

action rocket_02
{
rocket_2 = my
...
..
.
}




hope this helps

Zwecklos

Last edited by zwecklos; 07/19/06 08:53.
Re: How do i deactivate/disable physical objects? [Re: zwecklos] #82053
07/19/06 09:10
07/19/06 09:10
Joined: Jul 2006
Posts: 28
Amman, Jordan
Dareen Offline OP
Newbie
Dareen  Offline OP
Newbie

Joined: Jul 2006
Posts: 28
Amman, Jordan
Thanx alot zwecklos ,

but unfortunately thats not what i'm looking for, i need to disable the same rocket after a period of time.
I tried this code but it re-enables the rocket when another rocket is launched.

Code:
--------------------------------------------------------------------
action actRocket
{
phent_settype(my, PH_RIGID, PH_POLY);
phent_setmass(my, .5, PH_POLY);
phent_setdamping (my, 70, 50);
ph_setautodisable(1000, 800, 1, 0.001);
phent_setelasticity(my, 100, 50);
ph_setgravity(vector(0, 0, -100));

phent_enable(me, 0);
vec_set(temp, entTargeting.x);
vec_sub(temp, my.x);
vec_to_angle(my.pan, temp);
phent_enable(me, 1);

phent_addforcelocal(me, vector(30000, 0, 0), nullvector);

wait(-10);
phent_enable(me, 0);

}

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

Finally i had to use ent_remove(me); after a wait of 5 seconds instead, though it's not exactly what i want!!


Upon my end shall I begin? Forsaking all I've fallen for.. I rise to meet the END!!
Re: How do i deactivate/disable physical objects? [Re: Dareen] #82054
07/19/06 09:40
07/19/06 09:40
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
zwecklos Offline
Member
zwecklos  Offline
Member

Joined: Sep 2005
Posts: 274
Switzerland - Zurich
Heya Dareen
Do you have your rockets placed in your level or do you create them by code?

You need to seperate those rockets by naming em diffrent. Write 2 diffrent Actions:

Code:
 action actRocket_1
{

rocket_1 = my;

phent_settype(rocket_1, PH_RIGID, PH_POLY);
phent_setmass(rocket_1, .5, PH_POLY);
phent_setdamping (rocket_1, 70, 50);
ph_setautodisable(1000, 800, 1, 0.001);
phent_setelasticity(rocket_1, 100, 50);
ph_setgravity(vector(0, 0, -100));

phent_enable(rocket_1, 0);
vec_set(temp, entTargeting.x);
vec_sub(temp, rocket_1.x);
vec_to_angle(rocket_1.pan, temp);
phent_enable(rocket_1, 1);

phent_addforcelocal(rocket_1, vector(30000, 0, 0), nullvector);

wait(-10);
phent_enable(rocket_1, 0);

}


action actRocket_2
{

rocket_2 = my;

phent_settype(rocket_2, PH_RIGID, PH_POLY);
phent_setmass(rocket_2, .5, PH_POLY);
phent_setdamping (rocket_2, 70, 50);
ph_setautodisable(1000, 800, 1, 0.001);
phent_setelasticity(rocket_2, 100, 50);
ph_setgravity(vector(0, 0, -100));

phent_enable(rocket_2, 0);
vec_set(temp, entTargeting.x);
vec_sub(temp, rocket_2.x);
vec_to_angle(rocket_2.pan, temp);
phent_enable(rocket_2, 1);

phent_addforcelocal(rocket_2, vector(30000, 0, 0), nullvector);

wait(-10);
phent_enable(rocket_2, 0);

}





In this way, rocket_2 wont have any influences to rocket_1.
Why are you using "my" and sometimes "me"? I dont get that maybe because of my own idioty is there a diffrence between my and me?
Maybe I got you wrong but im almost 100% sure this may fix your problem

cheerio

Zwecklos

Re: How do i deactivate/disable physical objects? [Re: zwecklos] #82055
07/19/06 11:03
07/19/06 11:03
Joined: Jul 2006
Posts: 28
Amman, Jordan
Dareen Offline OP
Newbie
Dareen  Offline OP
Newbie

Joined: Jul 2006
Posts: 28
Amman, Jordan
Thanx Zwecklos,

about the entities im creating them in the script if the user pressed the space bar, and they're not only 2 rockets, they're unlimited so i cant write a separate action for each 1, anyway i used ent_remove(me) instead of disabling them.

me and my are pointers of the same entity, they're not different but its just more convincing to use my.x than me.x as if the x value is mine; and ent_remove(me) is more convincing than ent_remove(my), like "me" and "my" car

Thanx


Upon my end shall I begin? Forsaking all I've fallen for.. I rise to meet the END!!
Re: How do i deactivate/disable physical objects? [Re: Dareen] #82056
07/19/06 13:50
07/19/06 13:50
Joined: Sep 2002
Posts: 8,177
Netherlands
PHeMoX Offline
Senior Expert
PHeMoX  Offline
Senior Expert

Joined: Sep 2002
Posts: 8,177
Netherlands
Well, the solution is quite simple, use handles and the entity skills for the entities, this way every time their entity's action get started it will be used for that unique entitiy only...

Take a look at this thread at the bottom;
the thread link

Hope this has helped some,

Cheers


PHeMoX, Innervision Software (c) 1995-2008

For more info visit: Innervision Software
Re: How do i deactivate/disable physical objects? [Re: Dareen] #82057
07/20/06 14:22
07/20/06 14:22
Joined: Jul 2006
Posts: 28
Amman, Jordan
Dareen Offline OP
Newbie
Dareen  Offline OP
Newbie

Joined: Jul 2006
Posts: 28
Amman, Jordan
i used phent_settype(my, 0, PH_POLY); and it worked for unregestering the entity
after its job is done


Upon my end shall I begin? Forsaking all I've fallen for.. I rise to meet the END!!

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