Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,574 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
trying to make an enemy entity fall to the ground move z sectio #252211
02/17/09 06:06
02/17/09 06:06
Joined: Sep 2002
Posts: 199
Chicago, Illinois
Thehawk Offline OP
Member
Thehawk  Offline OP
Member

Joined: Sep 2002
Posts: 199
Chicago, Illinois
Hey all,

I'm having an issue with an enemy entitiy, I'm trying to give them gravity. Basically I'm trying to make it so that his z makes sure it traces to the floor. but it doesn't seem to work. Here's my code: is there a better way to do this?


I appreciate any help you can provide.


action dummy
{
var distance_traced;
var movement_speed;

temp.z -= 4000; // set temp.z 5000 quants below player's origin
distance_to_ground = c_trace (my.x, temp.x, ignore_me | use_box);
movement_speed.z = - (distance_to_ground - 10); // 17 = experimental value
movement_speed.z = max (-35 * time, movement_speed.z); // 35 = falling speed

}

Re: trying to make an enemy entity fall to the ground move z sectio [Re: Thehawk] #252217
02/17/09 07:18
02/17/09 07:18
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Look OK to me, youve sucessfully worked out the distance to ground,
but you havent actually moved him yet?
Whats the c_move command look like?


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: trying to make an enemy entity fall to the ground move z sectio [Re: Thehawk] #252234
02/17/09 09:37
02/17/09 09:37
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
Shouldn't your enemy use a while(1) loop?

Re: trying to make an enemy entity fall to the ground move z se [Re: George] #252245
02/17/09 11:13
02/17/09 11:13
Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
GorNaKosh Offline
Junior Member
GorNaKosh  Offline
Junior Member

Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
yeah, a while loop should be helpfull xD

you want to check the floor under the entity, so you have to set the temp vector to the position of the entity first before you can subtract a value from the z-coordinate.
Code:
action dummy
{
var distance_traced;
var movement_speed;
var targetPos[3];

   while(1) {
   vec_set(targetPos,my.x); // set the target positio for the trace to the my-position
   targetPos.z -= 4000; // going 4k quads downwards
   distance_to_ground = c_trace (my.x, targetPos, ignore_me | use_box);
   movement_speed.z = - (distance_to_ground - 10); // 17 = experimental value
   movement_speed.z = max (-35 * time, movement_speed.z); // 35 = falling speed
   // here you have to move the entity: for example with c_move
   wait(1);
   }
}


consider that if the var distance_to_ground is 0 the trace didn't found anything and the entity have to fall although wink
take a look: c_move()

Why do you use WDL-scripts???

Last edited by GorNaKosh; 02/17/09 11:13.
Re: trying to make an enemy entity fall to the ground move z se [Re: GorNaKosh] #252291
02/17/09 15:03
02/17/09 15:03
Joined: Aug 2003
Posts: 7,440
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,440
Red Dwarf
Originally Posted By: GorNaKosh
Why do you use WDL-scripts???


because not everyone can afford to upgrade to A7


"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku

Gamestudio download | 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