Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
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
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible), 637 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
Page 1 of 2 1 2
Bumping into a map entity #79818
06/28/06 08:27
06/28/06 08:27
Joined: Mar 2006
Posts: 724
the Netherlands
Frits Offline OP
User
Frits  Offline OP
User

Joined: Mar 2006
Posts: 724
the Netherlands
Hello,

When the player walks into an elevator (which is an map entity) and touches the wall of the elevator the player is slowly moving up. (Elevator is not moving)
When I bump into a wall (not a map entity) this does not happen.
I removed the GLIDE in the move_mode; did not help.
I removed the ACTIVATE_SONAR in the trace_mode; did not help.
I removed the ACTIVATE_TRIGGER in the trace_mode; did not help.

Can someone explain to me why this is happening and give me a solution how to prevent the moving.

Regards,
Frits


I like to keep scripting simple, life is hard enough as it is.
Regards,
Frits
Re: Bumping into a map entity [Re: Frits] #79819
07/01/06 11:40
07/01/06 11:40
Joined: Mar 2006
Posts: 724
the Netherlands
Frits Offline OP
User
Frits  Offline OP
User

Joined: Mar 2006
Posts: 724
the Netherlands
Anyone?


I like to keep scripting simple, life is hard enough as it is.
Regards,
Frits
Re: Bumping into a map entity [Re: Frits] #79820
07/05/06 22:57
07/05/06 22:57
Joined: May 2005
Posts: 155
C:\Program files\GStudio6
alphaindigo Offline
Member
alphaindigo  Offline
Member

Joined: May 2005
Posts: 155
C:\Program files\GStudio6
have you got any physics code in either of the entities?


beware the sock! - tLempoary...
Re: Bumping into a map entity [Re: alphaindigo] #79821
07/06/06 01:45
07/06/06 01:45
Joined: Sep 2002
Posts: 8,177
Netherlands
PHeMoX Offline
Senior Expert
PHeMoX  Offline
Senior Expert

Joined: Sep 2002
Posts: 8,177
Netherlands
What are you using to move around? Try setting 'disable_z_glide' in the 'move_mode' (it should have glide on too) (disable_z_glide is a 'c_move' only move_mode option).

If you can't figure it out either post your code or look in the manual for 'c_move' (latest manual).

Cheers


PHeMoX, Innervision Software (c) 1995-2008

For more info visit: Innervision Software
Re: Bumping into a map entity [Re: PHeMoX] #79822
07/06/06 09:11
07/06/06 09:11
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
May be the collision hull of your character not setup
correctly, try c_setminmax, though it just my guess.

Re: Bumping into a map entity [Re: vlau] #79823
07/06/06 09:34
07/06/06 09:34
Joined: Mar 2006
Posts: 724
the Netherlands
Frits Offline OP
User
Frits  Offline OP
User

Joined: Mar 2006
Posts: 724
the Netherlands
Re: alphaindigo; I don't use physics code for elevator or player.
Re: PHeMox; I use ent_move to move around.
Re: vlau; I have not set the collision hull, it is standard.

I have discovered that the

Code:

function fall_handling()
{
if(my.fall_distance>64 && sign(my.fall_distance)!=-1 && my.jumping==0)
{
my.falling=1; //I'm falling
if(my.move_vec_z>-15*time) //if not falling at maximum fall rate
{
my.move_vec_z-=.5*time; //then increase my fall rate
}
}
else
{
if(my.fall_distance<64 && my.falling==0 && my.jumping==0) //keep us on the floor normaly
{
my.move_vec_z = -my.fall_distance*time;
}
}
}



is causing the problem (the last part after else).
I can't delete that part. If I do the player can't climb stairs etc. anymore or the player will not move with the elevator.

What to do? Please help.

Regards,
Frits


I like to keep scripting simple, life is hard enough as it is.
Regards,
Frits
Re: Bumping into a map entity [Re: Frits] #79824
07/06/06 10:07
07/06/06 10:07
Joined: Nov 2004
Posts: 862
Australia
DavidLancaster Offline
User
DavidLancaster  Offline
User

Joined: Nov 2004
Posts: 862
Australia
Hey Frits

It is a bug with ent_move, the bug is that you can walk through map entities sometimes, I've got the exactly same bug in Axys and I can't fix it. What I did do is stop the player rising when you pass through a wall by making the trace ignore certain map entities:

solutions:
A: Use c_move and an ellipoid hull, I'm guessing but haven't tested fully that it may work with that..
B: Make your map entity passable and place invisible models with fat or narrow hull where you want collision to occur, as you can move the models and the collision works properly with them...

There may be an easier solution that I haven't thought of...

Hope it helps

Re: Bumping into a map entity [Re: DavidLancaster] #79825
07/06/06 12:01
07/06/06 12:01
Joined: Mar 2006
Posts: 724
the Netherlands
Frits Offline OP
User
Frits  Offline OP
User

Joined: Mar 2006
Posts: 724
the Netherlands
The only time it occures is when the player hits the elevatorwall (is a map entity) and I use the script after else (see above). It never occures when the player hits a wall in the normal geometry.
When I delete that part (else { ........}) I can bump into the wall of the elevator or any wall and the player stays on the ground (does not rise slowly), so the 'bug' is only there when I use; my.move_vec_z = -my.fall_distance*time;.
So I am wondering is this a real bug or is it a script error?

Regards,
Frits


I like to keep scripting simple, life is hard enough as it is.
Regards,
Frits
Re: Bumping into a map entity [Re: Frits] #79826
07/06/06 23:41
07/06/06 23:41
Joined: Nov 2004
Posts: 862
Australia
DavidLancaster Offline
User
DavidLancaster  Offline
User

Joined: Nov 2004
Posts: 862
Australia
Perhaps it has to do with the trace instruction that is returning my.fall_distance, though I know nothing about the template scripts...

Re: Bumping into a map entity [Re: DavidLancaster] #79827
07/07/06 07:52
07/07/06 07:52
Joined: Mar 2006
Posts: 724
the Netherlands
Frits Offline OP
User
Frits  Offline OP
User

Joined: Mar 2006
Posts: 724
the Netherlands
It is not a template script, it is a script partly from Grimber and partly from myself.

EDIT; RE: PHeMox; I have changed the ent_move into c_move and included DISABLE_Z_GLIDE in the move_mode; does not help.

The code for the player;
Code:

//----------
// functions

function jump_handling()
{
if((my.jump_hight>int(my.Jump_Walk_Run) && my.jumping==1)||(my.jumping==2 && my.jump_hight>(frc(my.Jump_Walk_Run)*100)))
{
my.jumping=0;
my.move_vec_z=0;
my.jump_hight=0;
my.jump_percent=0;
}
else
{
if(my.move_vec_z>1*time) //long as our +Z velocity is over 1*time
{
my.move_vec_z-=.5*time; //reduce the +Z velocity
my.jump_hight+=my.move_vec_z; //add the distance the Z velocity covered to update how high we jumped
}
else
{
my.move_vec_z=1*time; //still jumping but at its peak movement up
my.jump_hight+=my.move_vec_z; //same as above
}
}
}

function fall_handling()
{
if(my.fall_distance>64 && sign(my.fall_distance)!=-1 && my.jumping==0)
{
my.falling=1; //I'm falling
if(my.move_vec_z>-15*time) //if not falling at maximum fall rate
{
my.move_vec_z-=.5*time; //then increase my fall rate
}
}
else
{
if(my.fall_distance<32 && my.falling==0 && my.jumping==0) //keep us on the floor normaly
{
my.move_vec_z = -my.fall_distance*time;
}
}
}

function jump_animate()
{
if(my.jump_percent<50)
{
ent_animate(me,"jump",my.jump_percent,anm_add);
my.jump_percent=(my.jump_percent+8*time)%60; //give some added room here so jump_percent can get over 50 for our if check
}
}

function fall_animate()
{
if(my.fall_distance>32)
{
ent_animate(me,"jump",60,anm_add);
}
else
{
if(int(my.land_percent)!=0) //not done with animation yet
{
my.land_percent=(my.land_percent+8*time)%100;
ent_animate(me,"jump",my.land_percent,anm_add); //animate landing
if(my.fall_distance<0) //have we fallen under a surface?
{
my.move_vec_z=-my.fall_distance*time; //if so, move me back up
}
}
else
{
my.falling=0; //we are no longer falling
my.land_percent=60; //reset land_percent fot the next time we might fall
}
}
}

function stand_animate()
{
my.idle_percent = (my.idle_percent +5*time)%100;
ent_animate(me,"stand",my.idle_percent,ANM_CYCLE);
}

function walk_animate()
{
my.walk_percent = (my.walk_percent + sign(my.move_vec_x)*(frc(my.walk_anm_speed)*10)*time)%100;
ent_animate(me,"walk",my.walk_percent,ANM_CYCLE);
}

function run_animate()
{
my.run_percent = (my.run_percent + sign(my.move_vec_x)*(frc(my.run_anm_speed)*10)*time)%100;
ent_animate(me,"run",my.run_percent,ANM_CYCLE);
}

function update_camera()
{
// // camera in 3rd person
// vec_set(temp,my.x);
// vec_sub(temp,camera.x);
// vec_to_angle(camera.pan,temp); //now my looks at you

// camera in 1rst person
vec_set(Camera.x,my.x);
camera.z +=27;
camera.pan=my.pan;
if(mouse_mode==0)
{
my.temptilt+=mouse_force.y*4*time;
}
my.temptilt=clamp(my.temptilt,-75,75);
camera.tilt=0+my.temptilt;
}

function player_events()
{
if(event_type==event_scan && YOU !=player)
{
my.health-=50*(RESULT/200);
}
}


//--------
// actions

//uses: Walk_Anm_Speed,Run_Anm_Speed,Strafe_Anm_Speed,Jump_Walk_Run
//uses: Battery, Armor,Health,Ammo,Battery_max,Armor_max,Health_max,Ammo_max,Keys,falling
//uses: fall_distance,jumping,jump_hight,idle_percent,walk_percent,run_percent
//uses: land_percent,jump_percent,temptilt
//uses: move_vec_x,move_vec_y,move_vec_z
action player_move
{
player=me;
wait(2);

my.falling=0; //not falling
my.jumping=0; //not jumping
my.jump_hight=0; //jump hight=0

my.idle_percent=0;
my.walk_percent=0;
my.run_percent=0;
my.land_percent=60;
my.jump_percent=0;
my.temptilt=0;
camera.genius=player;
shift_sense=int(my.run_anm_speed);
my.enable_scan=ON;
my.event=player_events;

while (my.health>0)
{
vec_set(temp,my.x);
temp.z -= 4000;
trace_mode = ignore_me+ignore_sprites+IGNORE_PASSABLE+USE_BOX;//+ACTIVATE_SONAR
my.fall_distance = trace(my.x,temp);
// check if jumping
if (my.jumping !=0)
{
jump_handling();
}
// check if falling
fall_handling();
// check if player pressed jump X and isn't already juping or falling
if (key_x)
{
if(my.jumping==0 && my.falling==0 && my.fall_distance<1)
{
my.jumping=1+key_shift; //if holding shift key when hit jump means we were running
my.move_vec_z=20*time; //starting jump velocity
}
}
// if not jumping or falling we can move
if(!my.falling && my.jumping==0) //if falling=0 then !falling=-1, or true that I'm not falling
{
my.move_vec_x=(key_force.y)*int(my.walk_anm_speed)*time;
my.move_vec_y=(key_comma-key_period)*int(my.strafe_anm_speed)*time; //strafing
}
// turn players facing
if(mouse_mode==1)
{
player.pan=(player.pan-(key_force.x)*5*time);
}
else
{
player.pan=(player.pan-(key_force.x+mouse_force.x)*5*time)%360;
}
// animations
// jump
if (my.jumping !=0)
{
jump_animate();
}
else //other animations
{
if (my.falling == 1) // animate falling
{
fall_animate();
}
else // animate stand walk and run
{
If (my.move_vec_x == 0 && my.move_vec_y == 0) // stand
{
stand_animate();
}
else // our movement animations will go here
{
if (key_shift) // either shift key is being pressed run aniamtion
{
run_animate();
}
else // shift key is NOT being pressed so we are walking
{
walk_animate();
}
}
}
}
// entity moves
move_mode = IGNORE_YOU+IGNORE_PASSABLE+IGNORE_PUSH+GLIDE+DISABLE_Z_GLIDE; // + ACTIVATE_TRIGGER
// ent_move(my.move_vec_x,NULLVECTOR);
result=c_move(me,my.move_vec_x,NULLVECTOR,move_mode);
update_camera();
wait(1);
}
}



EDIT 2: I just found out that the slowly moving up only occures when you hit a combination of a map entity and a normal block. When you bump into a map entity or to a levelblock, nothing happens, but when you bump into them at the same time the player will rise slowly and ends on the top z value of the map entity, not the levelblock. So my guess is that it has something to do with the difference in world- and local coordinates, but I am not sure of this, but when it is than I can call this a major bug.

Regards,
Frits

Last edited by Frits; 07/07/06 13:53.

I like to keep scripting simple, life is hard enough as it is.
Regards,
Frits
Page 1 of 2 1 2

Moderated by  HeelX, rvL_eXile 

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