Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / trying to make me loose health per hit, how?

Author
Message
Daniel wright 2311
User Banned
Posted: 12th Mar 2010 02:13 Edited at: 12th Mar 2010 02:16
So basicly I have tryed many things here but none trully works well. this is what i am trying to do here.

so this here is the main code to make my guy attack me



but i loose health even if he is not really attacking and i loose it fast to. i tryed this here



and repeded this a coulple times to reset it back to 0 but he only attacks here and there and real slow but my health still goes to 0 real fast to. please help me with any good ideas

Masqutti
16
Years of Service
User Offline
Joined: 8th Jan 2010
Location: insanity
Posted: 12th Mar 2010 09:37
I guess that's DarkAI or something i'm not familiar with, but it might be there's no problem in that snippet. Could you check how your enemy's attack returns to zero ? Also that attack seems to be either a local or global variable that's not "sticked" into the enemy's info so should there be a structure for that(tho it's not your main problem if checking against 1 single enemy to test things out).

If the attack resets to 0 lets say all the time at the end of the loop you'r gonna fill that if statement everytime, but the DarkAI content I don't know:S

hmmmh.. that didn't compile
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 12th Mar 2010 10:58 Edited at: 12th Mar 2010 11:03
Try changing your last code to this:


EDIT: or rather this to allow for any king of attack (strafing/moving etc)...


LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 12th Mar 2010 14:19
Is the variable 'attack' a global variable and is this code located within a function? If it is in a function and you did not declare it as a global, then the computer will not recognize it's value and will consider it as equaling zero. Thus, the call would be made to decrement the health and loop the animation.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 12th Mar 2010 14:29
Quote: "but i loose health even if he is not really attacking"

So whether or not the variable "attack" is global should make no difference... but then my code would make no difference either.

I wonder if you are decreasing health elsewhere in your code?

Try taking that line out and see what happens?

Of course we are psychic debugging again here so maybe you could post more code?

LBFN
19
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 12th Mar 2010 14:50
I would suggest you constantly display what the value of
AI Get Entity Action$ (e1)

equals.

Perhaps it is set to "Stopped And Attacking" and you don't know it.

Daniel wright 2311
User Banned
Posted: 13th Mar 2010 00:49
wel, thanks guys for all your responses,

@baxslash , I trully do see a difrence in your code and what im doing and im pretty shure this is what i need to do here, i will test it and let you know.

@LBFN , it is a global variable for a group of enimys

Daniel wright 2311
User Banned
Posted: 13th Mar 2010 01:41
well, ok this did work here just fine thank's baxslash and all the other that did respond.




Daniel wright 2311
User Banned
Posted: 13th Mar 2010 03:33 Edited at: 13th Mar 2010 05:16
nevermind

Login to post a reply

Server time is: 2026-07-26 23:41:09
Your offset time is: 2026-07-26 23:41:09