Author Topic: Hit Points script  (Read 8540 times)

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: Hit Points script
« Reply #15 on: 2006-04-02, 10:35:52 PM »
Well, it would help if we knew what line 39 was.  Try posting the updated script, at least up to line 39
Edward Dassmesser

gwal

  • Regular
  • **
  • Posts: 69
  • Game Progress: Outer Space / Items
    • View Profile
Re: Hit Points script
« Reply #16 on: 2006-04-03, 06:22:04 PM »
This is a bit off-topic, but anyone who want to try a more 'simple' method of hitpoints should look at the script from the Dark Elf game. It uses UserData, and a variable for each enemy's hitpoints.

cbass

  • Expert
  • Regular
  • *****
  • Posts: 97
  • script this
    • View Profile
    • Squest RPG
Re: Hit Points script
« Reply #17 on: 2006-04-03, 09:54:56 PM »
I very much agree that Userdata is the best and easiest place to store enemy hp.

If you want a more fancy display for their hp bar, like above their heads, or a display of the most recent enemy that has attacked you or has been attacked, i know this is very possible in the sgdk environment.

Actually, i implemented the latter in this very rough and unfinished project here:
LINK
Run the .EXE in the code folder.
the script is not in normal script, it is a compiled com object, but the source is included.  it probably won't be very helpful if you don't have VB 6.0, but the .bas files where the source is located are readable with a text editor. 


If you want a fancy display like that you have to get a little more complicated.  You have to have a MaxHP and a currentHP for each monster.  You then have to edit inventory and how they are displayed every time the monster losses hp (usually in the onspritecollide event).


If you have any question, or are totally confused,  I can pull the correct snippets of code from the source and post them.  (providing I have sufficient motivation tomorrow :) )  Should be enough to get you started.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Hit Points script
« Reply #18 on: 2006-04-04, 09:22:07 PM »
I haven't looked at the script, so I can't tell for sure if anyone has discovered this or not, but I should point out (in case you haven't) that you can store as much data as you want in the userdata property of a sprite.  You can store an array in the UserData property.  And If necessary, each element of the array can be another array, ad nauseum.

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: Hit Points script
« Reply #19 on: 2006-04-04, 10:22:35 PM »
I think you mean ad infinitum...

ad nauseam: So as to disgust or nauseate.

Unless you mean to create arrays so repetitively that it becomes nauseating.  I suppose they're similar.  And I also suppose it can't really go to infinite depth, due to a maximial limitation on machines imposed by their registers, memory, and hard drives.  Yeah, I'll stop trying.  Good enough.
« Last Edit: 2006-04-04, 10:26:08 PM by durnurd »
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Hit Points script
« Reply #20 on: 2006-04-05, 05:23:07 AM »
Right, that's why I chose "ad nauseum" instead of "ad infinitum" because you can't go on forever, but you can go on until you get sick of it :).  If "ad ridiculousum" were a real term, I might have used that instead.