Gamestudio Links
Zorro Links
Newest Posts
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
3 registered members (AndrewAMD, Akow, degenerate_762), 1,430 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 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,439
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,439
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 | 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