boss hp

Talk about making games.

boss hp

Postby deamonslayer4292 » Sat May 17, 2008 1:47 am

i need to get a boss to take more then one hit i want him to take 100 so i made a counter for his hp and tryed to make a script to kill hime once the counter reached 0 but it dident work :twisted: :evil: :twisted: :evil: :twisted: :evil: if someone can help thanks
"you take my life and ill take yours to you fire musckets and well run you through and well you wait for the next attack you better stand theres no turning back the smell of acrid smoke and horses breath is the smell of certian death"
User avatar
deamonslayer4292
 
Posts: 24
Joined: Wed May 07, 2008 7:36 pm
Location: MI
Score: 1 Give a positive score

Re: boss hp

Postby Bee-Ant » Sat May 17, 2008 6:52 am

make "health" variable set it to actor, integer
Boss>DrawActor>
Code: Select all
if(health<=0)
{
///die
}

Boss>CreateActor>
Code: Select all
health=100;

Boss>Collision>Player>
Code: Select all
//when player declare an attack
health-=5; //depending on your desire
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: boss hp

Postby deamonslayer4292 » Sat May 17, 2008 2:52 pm

thanks
"you take my life and ill take yours to you fire musckets and well run you through and well you wait for the next attack you better stand theres no turning back the smell of acrid smoke and horses breath is the smell of certian death"
User avatar
deamonslayer4292
 
Posts: 24
Joined: Wed May 07, 2008 7:36 pm
Location: MI
Score: 1 Give a positive score

Re: boss hp

Postby DST » Sat May 17, 2008 5:27 pm

A couple things on that:

The if (health == 0) thing could also go in the collision with player 1's weapon.
Remember that boss health will only be 0 once....but in draw actor it will check every single frame....for an action that will only occur once in the whole game? All enemies should have that health == 0 script in their collision rather than draw actor.
You could also put it in player 1's bullet/sword/fist collision....if (collide.health==0) etc. etc.

Also, how about health-=mypower; now any time player1 powers up, the damage is automatically adjusted.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: boss hp

Postby deamonslayer4292 » Sun May 18, 2008 12:59 am

what would the script be for the health integer? boss.health=100;?
"you take my life and ill take yours to you fire musckets and well run you through and well you wait for the next attack you better stand theres no turning back the smell of acrid smoke and horses breath is the smell of certian death"
User avatar
deamonslayer4292
 
Posts: 24
Joined: Wed May 07, 2008 7:36 pm
Location: MI
Score: 1 Give a positive score

Re: boss hp

Postby DST » Sun May 18, 2008 1:14 am

I make health an actor variable, so i can use it for all actors, and it saves for each of them.

just put health=100; in boss's createactor event.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: boss hp

Postby deamonslayer4292 » Sun May 18, 2008 2:28 am

no i mean to create the variable what is healths script
"you take my life and ill take yours to you fire musckets and well run you through and well you wait for the next attack you better stand theres no turning back the smell of acrid smoke and horses breath is the smell of certian death"
User avatar
deamonslayer4292
 
Posts: 24
Joined: Wed May 07, 2008 7:36 pm
Location: MI
Score: 1 Give a positive score

Re: boss hp

Postby DST » Sun May 18, 2008 3:08 am

use the 'variables' button at the bottom of the script editor.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: boss hp

Postby catacomber » Sun May 18, 2008 4:44 am

If you're not familiar with c code but you may very well be--when you declare a variable--you have to set it to a type that indicates whether it's going to be an integer (numbers that aren't decimals), character, string (of characters) or float which is for numbers that involve decimals.

Could be:

int x

char c

string munch

float x

but look down below:

So in GE when you want to add a new variable, you can hit script up top, and click on any script that's shown and choose variables down at the bottom--then you get a chance to add a new one.

asks you to give it a name.

Easy. Here it's health.

Then in a dropdown menu,it asks you whether that variable is going to be an

integer
real
or
string

now I don't have a clue what a real is but am going to search it here : )

a string is usually characters and an integer numbers

I hope I'm not being too basic -- forgive me if I am

before you can use a variable in script you have to create it like that

then, once you create it

use the scripts just as above where and how Bee-Ant has told you to put the script that uses your newly declared variable and DST has commented on it.

if you're still not sure, come back :D Again, I'm sorry if I'm being too simple but am not sure exactly where you're stuck.

AHA! A "real" variable is a subset of what I know to be a "float". That is when you want your variable to be expressed as a decimal.

So if you want your variable to be expressed as a decimal use ---choose "real" in the dropdown menu.

Use "integer" in dropdown menu for variable when you don't want your number to be expressed as a decimal.

Thanks to your question, have added new knowledge to my little array. : )
User avatar
catacomber
 
Posts: 195
Joined: Fri Sep 28, 2007 5:36 pm
Score: 10 Give a positive score

Re: boss hp

Postby deamonslayer4292 » Sun May 18, 2008 1:55 pm

o i thought that healt had to have a script so i put the first script, i get it now ill be back if it dosent work thanks alot for the detailed explanations everyone. :D :D :mrgreen:
"you take my life and ill take yours to you fire musckets and well run you through and well you wait for the next attack you better stand theres no turning back the smell of acrid smoke and horses breath is the smell of certian death"
User avatar
deamonslayer4292
 
Posts: 24
Joined: Wed May 07, 2008 7:36 pm
Location: MI
Score: 1 Give a positive score

Re: boss hp

Postby deamonslayer4292 » Sun May 18, 2008 11:23 pm

ok i put all the scripts in place but he still wont die so i did a test run making him have 2 hp in stead of 100 which would make him die in 2 hits but he just wont die :evil: :evil: :evil: :evil:
"you take my life and ill take yours to you fire musckets and well run you through and well you wait for the next attack you better stand theres no turning back the smell of acrid smoke and horses breath is the smell of certian death"
User avatar
deamonslayer4292
 
Posts: 24
Joined: Wed May 07, 2008 7:36 pm
Location: MI
Score: 1 Give a positive score

Re: boss hp

Postby catacomber » Mon May 19, 2008 2:15 am

Could you post your code? I don't know if I can help but maybe someone else can.
User avatar
catacomber
 
Posts: 195
Joined: Fri Sep 28, 2007 5:36 pm
Score: 10 Give a positive score

Re: boss hp

Postby deamonslayer4292 » Tue May 20, 2008 1:28 am

it alright dst inspired me to try and find out on my own it took like 2 hours but i got it thanks anyway
"you take my life and ill take yours to you fire musckets and well run you through and well you wait for the next attack you better stand theres no turning back the smell of acrid smoke and horses breath is the smell of certian death"
User avatar
deamonslayer4292
 
Posts: 24
Joined: Wed May 07, 2008 7:36 pm
Location: MI
Score: 1 Give a positive score

Re: boss hp

Postby xr2alex99 » Mon Jun 16, 2008 5:09 am

I actually know about this hp stuff its my recent work that requires it alot
basically its a variable made thing mine looks like this.
Variable/Name:My_hp_points=monsters hp/it is a actor variable ok.
to make them die if they have 0 My_hp_points this works
if (My_HP_Points < 1) Draw actor/script editor
{
My_HP_Points = 0;
DestroyActor("Event Actor");
}
to set the hp points Create actor/script editor
My_HP_Points =30;
to make damages work add collisions like collide with this or that actor = script editor
My_HP_Points = My_HP_Points - 2; it means hp-2/so chars hp is maxed at 30 and so he loses 2 =28hp left
(\___/) My bunny :twisted:
(=' . '=) is a king of :twisted:
(")___(") awesome :twisted:
User avatar
xr2alex99
 
Posts: 22
Joined: Sat Sep 01, 2007 7:48 am
Score: 0 Give a positive score

Re: boss hp

Postby DST » Mon Jun 16, 2008 11:27 am

You're doing a lot of extra work there. It doesn't need to be so difficult.

First off, call it health, or hp, and use it for all actors.
Hp is much easier to type than My_Long_Hp_Name.

Secondly, dump the hp=0. Its just a wasted line of code.

If (hp<1){DestroyActor("Event Actor");}

Why bother to set hp to 0 if, on the very next line, you're gonna destroy the actor anyway?

And you don't need to restate the hp, just use
hp-=2;

rather than
hp=hp-2;
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Next

Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron