Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (RealSerious3D, rvl), 1,187 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
squik, AemStones, LucasJoshua, Baklazhan, Hanky27
19060 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Turning my turtle #77173
06/09/06 04:48
06/09/06 04:48
Joined: May 2005
Posts: 222
T
tek Offline OP
Member
tek  Offline OP
Member
T

Joined: May 2005
Posts: 222
I would like to ask if anyone would like to help me with a problem in the game i'm making I placed an enemy guard which is a turtle he guards the territory and I have to get passed him he moves back and forward in a guard like state.

I managed to fix a script for the turtle to move forward and when it hits this invisiblewall.mdl that is not passable nor visible he goes the other direction.

What I want is for when the turtle in my game hits the invisiblewall.mdl that the animation of the turtle turns into turtle facing other direction.
I already made an animation for the turtle which i call turtleturnleft.
The problem is I don't know how to script on my game if turtle collisions with invisiblewall, ent_animate(turtle_left.mdl) it's something like this I aint sure.

also this may seem simple but if an entity is moving and I want him to stop what would be the code for this, just to completely stop and stand still.

This is my script on the turtle guard and the invisible wall.

I would appreciate any help.

action invisible_wall
{
wait(1);
my.invisible=on;
my.passable=on;
}

function get_shot
{
if(event_type==event_impact) // entity was hit by a bullet
{
sleep(0); //wait 4 seconds
my.invisible=on; //turn invisible
my.passable=on; //turn passable
}
}

action turtle
{
// 1 is up, -1 is down
my.health=40;
my.gegner=on;
var direction = 1;
var speed = 5;

while (1)
{

// move ball in the right direction
my.y += direction * speed;

// change direction if obstacle is in the way
if (my.health==0)
{
my.enable_entity=on; //make the enemy sensible to getting hit with c_move
my.event=get_shot; // run this function when hit
ent_morph(me,"turtle hit.mdl");
}
wait(1);

vec_set(temp,my.x);
temp.z+=direction * speed;
trace_mode = IGNORE_ME;

while (1)
{

my.enable_impact=on;
my.event=lev_2_event;
break;
}

if (trace(my.x, temp) != 0)
{
direction *= -1;
}
wait(1);
}
}

Last edited by tek; 06/09/06 04:50.
Re: Turning my turtle [Re: tek] #77174
06/09/06 08:31
06/09/06 08:31
Joined: Jun 2006
Posts: 96
Straight_Heart Offline
Junior Member
Straight_Heart  Offline
Junior Member

Joined: Jun 2006
Posts: 96
In the wall script, you should define a skill for the wall so that it can be catagorized as an invisible wall.

define Object_type,skill1; // 0 is for player, 1 is for inv wall, etc.

action invisible_wall
{
my.passable=on;
my.object_type=1; // set 1 for an invisible wall

}

Now make a map entity that is just a block and build as map entity. Then go back to your main level and load this map entity. Assign the invisible_wall script to it.

Now in your turtle script do this:

while(1)
{


if(c_content(my.x)==content_passable) // check the content of the turtle
{

if(you.object_type==1)// if the content is a passable invisible block

{ turtle_stop();}

}


wait(1);
}

///////////////////////////////////////

What this does is it makes the turtle check the content of its current position. If the current posisition is a passable block, it will check to see if the passable block is an invisible wall that is meant to turn the turtle. Since c_content can return a valid "you" pointer immediatly after a successful content check, you can find out skills of the map entity if it were just like a model entity or any other entity. If the map entity that the turtle is in, has its object_type set to 1, it recognizes that it is inside a turning invisible block. Then it will excecute whatever code you want (stopping or turning).

With this method, you have to work with a few rules. You cant have a turning block touching another passable block, such as a water box. C_content might be random as to what map entity it will detect, so dont make a turning block touch a water block.

You also have to make sure that the turtle switches to a totally different state, once it detects a turning block. If you do just a simple my.pan+=10; in turning the turtle, the turtle will be seen endlessly spinning inside the map entity. So make a different state that attempts to move the turtle away, then switch back to the patrolling state.

There are MANY more ways to turn the turtle, scanning for turn trigger entities, using trace to find out the texture of a model that is used to signify turning.


You're not as unique as you think you are, try again.

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