Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (henrybane), 1,246 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
need help.......player health cant reduce #101717
12/10/06 12:12
12/10/06 12:12
Joined: Aug 2006
Posts: 68
A
alex5801 Offline OP
Junior Member
alex5801  Offline OP
Junior Member
A

Joined: Aug 2006
Posts: 68
Code:



function player_action
{
player = me;
my.gravity = 3;
my.shadow = on;
player.health = 100;
my.enable_impact = on; // and make it sensitive to enemy bullets
my.enable_entity = on; // and to other entities
my.push = -1; // shouldn't be able to pass through walls (push = 0)
my.event =decrease_health();

changeto_level = 0;
player_weapon=ent_create("hkusp.MDL",my.x,attach_weapon_char2);
p1_handgun=1;
my.skill46 = 0;
state=1;
wait(1);
if(my.health<=0)
{
my.blendframe = death;
IF(p1_meelee==1){ handle_char1_animation();}
IF(p1_handgun != 0){ handle_char2_animation();}
IF(p1_rifle!=0){ handle_char3_animation();}
IF(p1_rifle==0&&p1_handgun==0&&p1_meelee==0){ handle_char4_animation();}


ent_remove(player);
// exit();
}

WHILE (player.health > 0)
{
.........//player movement

------------------------------------------------------------------------------
//enemy shoot bullet

function move_bullet()
{
my.skill47 = 5; // that's an enemy bullet
my.pan = you.pan; // the bullet and the enemy have the same pan angle
my.push = -1; // passes through enemies, hurts the player
my.enable_entity = on; // the bullet is sensitive to other entities
my.enable_impact = on;
my.enable_block = on; // and to level blocks
my.event = remove_bullet;
while (my != null)
{
bullet_speed.x = 150*time;
bullet_speed.y = 0;
bullet_speed.z = 0;
move_mode = ignore_you + ignore_passable + ignore_push; // ignores the enemy (its creator = you)
c_move (my, bullet_speed, nullvector, ignore_you);
// ent_move(my.skill1, nullvector);
wait (1);
}
}

-------------------------------------------------------------------------------

function decrease_health()
{

if(my.skill47==5)
{
player.health -= 50; // loose 50 health point every tick
}

if (my.health <= 0)
{
my.event = null;
snd_play (death_wav, 40, 0);
my.z -= 30; // set a lower height for the player
camera.roll = 30; // and a weird roll angle
ent_remove(player);
}
}








how come my player life wont reduce, he cant die?
can anyone can help me with that?
thx in advance

Re: need help.......player health cant reduce [Re: alex5801] #101718
12/10/06 12:54
12/10/06 12:54
Joined: Dec 2005
Posts: 252
MyOwnKingdom
nipx Offline
Member
nipx  Offline
Member

Joined: Dec 2005
Posts: 252
MyOwnKingdom
Its because you check with

Code:
if(my.skill47==5)



if the player's skill47 == 5. It is in the event function for the player so my is the pointer to the player.

But you need to check if the bullet's skill47 == 5.

-->>
Code:
if(you.skill47==5)  //check if it's an enemy's bullet  



hope it helps.


nipx

Re: need help.......player health cant reduce [Re: nipx] #101719
12/10/06 14:41
12/10/06 14:41
Joined: Aug 2006
Posts: 68
A
alex5801 Offline OP
Junior Member
alex5801  Offline OP
Junior Member
A

Joined: Aug 2006
Posts: 68
but i will get an malfunction W1501
empty pointer in decrease_health: (you.skill47==5)

Re: need help.......player health cant reduce [Re: alex5801] #101720
12/10/06 20:32
12/10/06 20:32
Joined: Dec 2005
Posts: 252
MyOwnKingdom
nipx Offline
Member
nipx  Offline
Member

Joined: Dec 2005
Posts: 252
MyOwnKingdom
Im not sure but I think my.enable_block is automaticaly set to on....

when the player touches the ground (block) the event function starts.
->you points to a block. That's not possible.

So check before if the player touches an entity



Code:


function decrease_health()
{
if(event_type==event_entity) //check if the player was hit by an entity
{

if(you.skill47==5)
{
player.health -= 50; // loose 50 health point every tick
}

if (my.health <= 0)
{
my.event = null;
snd_play (death_wav, 40, 0);
my.z -= 30; // set a lower height for the player
camera.roll = 30; // and a weird roll angle
ent_remove(player);
}
}
}






Now it SHOULD work imao


nipx

Re: need help.......player health cant reduce [Re: nipx] #101721
12/11/06 07:02
12/11/06 07:02
Joined: Aug 2006
Posts: 68
A
alex5801 Offline OP
Junior Member
alex5801  Offline OP
Junior Member
A

Joined: Aug 2006
Posts: 68
errr......still cant work
there is no more empty pointer error but my player health still cant reduce

Re: need help.......player health cant reduce [Re: alex5801] #101722
12/11/06 20:29
12/11/06 20:29
Joined: Dec 2005
Posts: 252
MyOwnKingdom
nipx Offline
Member
nipx  Offline
Member

Joined: Dec 2005
Posts: 252
MyOwnKingdom
I looked at your code again and found an other bug:

Code:

my.event=decrease_health();



Dont use () for my.event!


And about the
Code:
my.push=-1;    



I'm not sure if this works. Try it with my.push=5; or an other normal push. Dont know what happens exactly when you set a negativ push but it could be wrong...

If it still doesnt work send me the whole script and the level.


nipx

Re: need help.......player health cant reduce [Re: nipx] #101723
12/12/06 15:11
12/12/06 15:11
Joined: Aug 2006
Posts: 68
A
alex5801 Offline OP
Junior Member
alex5801  Offline OP
Junior Member
A

Joined: Aug 2006
Posts: 68
thx men prob solve


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