You are not logged in.    Login    New User    Forum Home    Search

Location:
JBPLAY  \  Meteor 2  \  Help and Guidance  \  Senesing lack of enemies

Back to Threads

Viewing Thread: Senesing lack of enemies

 

VR_Rat

Joined: 20 January 2006
Posts: 396
12 June 2006 00:25 (UK time)

Does anyone know if it is possible for meteor2 to tell if all of a certain side is gone? It would be for missions that you would have to eliminate all the enemy.

You need to login to create posts in this thread.

James Bunting
Joined: 17 September 2003
Posts: 1308
16 June 2006 09:21 (UK time)

This is a very good question. The answer is "sort of" even though I would like to build this in properly.

I suppose you could could check if object IDs 0 to 1000 (or something) exist and if so check their side IDs.

So it would be something like this (you will need to look up the actual functions)...

int enemies, i;

enemies = 0;

for( i=0; i<1000; i++)
{
if object i does exist
{
if object i's side ID is "enemy"
{
enemies++;
}
}
}

You need to login to create posts in this thread.

VR_Rat

Joined: 20 January 2006
Posts: 396
16 June 2006 14:22 (UK time)

Thanks, i'll work on that. I'm also working on a simple body armor code, but it will more likely turn out as a sheild.

You need to login to create posts in this thread.

VR_Rat

Joined: 20 January 2006
Posts: 396
17 June 2006 19:06 (UK time)

Is there an OnPlayerHurt command or something? I need some way to dectect when the player is shot for the armor code. I also could use a little lesson on integers.

You need to login to create posts in this thread.

me_mantis

Joined: 26 September 2003
Posts: 1152
18 June 2006 03:55 (UK time)

Quick answer.. nope!

Long asnwer... Noooooooooooooooooooooooooo.


Fun workaround...


if(SC_GetObjectHits(SC_GetPlayerObjectId)***less than sign***100)
{
SC_GameMessage("Looks like you got less than 100hp! Its always best not to fall down stairs.";);
}

Edited: 18 June 2006 03:56


You need to login to create posts in this thread.

me_mantis

Joined: 26 September 2003
Posts: 1152
18 June 2006 18:55 (UK time)

Altight... about integers.
void integer test()
{
//First we have to tell the computer that we need a small piece of memory to use to have an integer.
//we say that by writing "int", and then making a label for our integer. always remember the ; at the end.

int x;

// Now lets see what was in the memory where x was stored.

SC_GameMessage("X used to be %d before we allocated it.",x);

// The %d makes the varible at the end(",x);) display as a decimal in your game message.

//Now lets make x exual something.

x = 1;

//X is now 1.
//Now lets see if x == 2.

if(x==2)//Fixed it now! thx alek! <
{
SC_GameMessage("X is 2.";);
}

//there we go. My render is done and its lunch time, so I hope this helped.
}

Edited: 19 June 2006 20:30


You need to login to create posts in this thread.

arezey

Joined: 16 June 2005
Posts: 1599
19 June 2006 13:58 (UK time)

Hi, I was on a vacation at Denmark last week.

There is 1 mistake in yer code... you need to use "==" instead of "=" in if(){} statements, as well as in for(){;;}, while(){} and in do{}while(); statements. You use "=" to apply a string or value into a variable.

So...

if(x=2)
{
SC_GameMessage(X is 2.);
}

should be

if(x==2)
{
SC_GameMessage("X is 2.";);
}

and this is wrong:

int x == 2;

and this is right:

int x = 2;

EDIT: Also I think that a function name should not have spaces.

Edited: 20 June 2006 12:30


You need to login to create posts in this thread.

me_mantis

Joined: 26 September 2003
Posts: 1152
19 June 2006 20:32 (UK time)

Correct.

x = y;

copies the value of y into the value of x

if(x == y)
{}

checks if x = y.

You need to login to create posts in this thread.

VR_Rat

Joined: 20 January 2006
Posts: 396
03 August 2006 13:48 (UK time)

I'll need some way to detect when the player is hurt in order to proceed with the code.

You need to login to create posts in this thread.

me_mantis

Joined: 26 September 2003
Posts: 1152
03 August 2006 18:41 (UK time)

That's tricky.

You can always look at your heathbar, but of course that doesn't work

if(SC_GetObjectHits(SC_GetPlayerObjectId())<100)
{

}

You need to login to create posts in this thread.

arezey

Joined: 16 June 2005
Posts: 1599
03 August 2006 19:23 (UK time)

yet another issue why JB should make the less*than*sign-more*than*sign and quotes go to entites instead of blanks.

I tried a code once but it didn't work...

int PlayerId = SC_GetPlayerObjectId();
void OnObjectHurt_PlayerId() {
// handle function
}

You need to login to create posts in this thread.

VR_Rat

Joined: 20 January 2006
Posts: 396
26 August 2006 00:56 (UK time)

I just found out the answer to my problem. The code is something like this.

export OnMapStart;
export OnObjectHurt_10;\\Ten as an example.

void OnMapStart()
{
int hp:
int hp2:
SC_PlayerObjectId( 10);
hp = SC_GetObjectHits( 10);
}

void OnObjectHurt_10()
{
hp2 = SC_GetObjectHits( 10);

And so on like that using the difference between hp and hp2 to take away from the body armor amount. Assuming the the max body armor is 100 you make 10 different objects for the player. One at each 10 for the armor setting. When the body armor decreases so does the player's armor. Get it?

You need to login to create posts in this thread.



Forums system (C) 1999-2023 by James Bunting.

Terms of Use