Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (VoroneTZ, monk12, Quad), 829 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: punch hole in terrain [Re: DAVIDMORETON] #472173
04/14/18 09:17
04/14/18 09:17
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
take a look at your "{" "}"
Edit: nevermind, didn't see that your wrote two different versions of your while loop (I assumed you used the exact code you posted)

Last edited by Kartoffel; 04/14/18 09:20.

POTATO-MAN saves the day! - Random
Re: punch hole in terrain [Re: DAVIDMORETON] #472175
04/14/18 17:02
04/14/18 17:02
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
I don't think it's your code, I think it might be something inherent to terrains. For instance, according to the manual "Terrain can't be animated, rotated, moved, or scaled." I am thinking that making it passable or not might fall into one of these categories.

Have you tried making a level with just a terrain set to passable, just to see whether the engine can actually handle this?

Re: punch hole in terrain [Re: Dooley] #472176
04/14/18 17:04
04/14/18 17:04
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
Another option would be to move your entity directly, like this:

Quote:

var going_down = 0;

While(ent.z > -100)
{
going_down = 1;
ent.z -= 5*time_step;
wait(1);
}

going_down = 0;


This would cause the entity to move down without checking any collision.

If your player entity has a c_move function, it will be checking collision. You could effectively turn this off while it is going down through the terrain by surrounding your c_move with an "if" statement...

Quote:
if(going_down == 0)
{
c_move(ent,move_vec,abs_vec,GLIDE|ETC...) ;
}


Last edited by Dooley; 04/14/18 17:11.
Re: punch hole in terrain [Re: Dooley] #472188
04/15/18 09:38
04/15/18 09:38
Joined: Jan 2005
Posts: 282
devon UK
D
DAVIDMORETON Offline OP
Member
DAVIDMORETON  Offline OP
Member
D

Joined: Jan 2005
Posts: 282
devon UK
Hi Dooley,
Thanks for reply.
Terrain will accept 'passable'. If the 'trigger' line
{if(sphere<-10);... is replaced by 'wait-5' - the terrain goes passable and the player drops through.
There must be something wrong or missing in the 'trigger' line
if(sphere etc. That is what I don't understand - logically it should work !!
More Terrains will be used in this game, so I must solve this problem.
Perhaps someone would like to make up a scene (as in my code above) and see if they can make it work? !!
Still hopeful of fixing this !!
David.

Re: punch hole in terrain [Re: DAVIDMORETON] #472230
04/17/18 13:56
04/17/18 13:56
Joined: Jan 2005
Posts: 282
devon UK
D
DAVIDMORETON Offline OP
Member
DAVIDMORETON  Offline OP
Member
D

Joined: Jan 2005
Posts: 282
devon UK
PROBLEM SOLVED !!
Terrain can be made PASSABLE - also INVISIBLE.
The falling sphere is used just for 'something' to change and trigger the terrain action.
This is the new code - it may help someone (I hope!);-

#include <acknex.h>
#include <default.c>
#include "t_player.h"
//////////////////////////////

ENTITY* player="t_player";

ENTITY* terrain = "tester.hmp";

ENTITY* sphere = "ball.mdl";

function main()
{
level_load("xc1.WMB");

}


action down() //attached to sphere (drops to z-16 to make terrain passable and invisible)
{

while(sphere.z>-16)
{
sphere=me;
sphere.z -= 3*time_step;
wait(1);
}
{
wait(-2); //needed to stop 'judder'
terrain=me;
set(my,INVISIBLE); //needed to stop flash of light as //player drops through terrain
set(terrain,PASSABLE);
}}

Probably not very elegant, but it works. Got it by 'fiddling about' a lot - I felt it should work somehow.
David

NEW - FOUND A BETTER WAY!

remove:-

wait(-2); and set(my,INVISIBLE); and set(terrain,PASSABLE);

then replace with:-

ptr_remove(me);

Much cleaner and it works - hope it helps
David

PS. This is used for player who crosses terrain to tower in middle - enters tower - sets code and drops through to cave system below.



Last edited by DAVIDMORETON; 04/20/18 10:15.
Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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