3 Mar 2016

The long break - Hunting

Lame joke is lame.

There was no new posts for some time (thank you captain obvious!), but I'm slowly making progress, yay!



I've almost finished hunting userform and hope to finish VBA code soon.




Well, nothing to see here. It's just a boring window. More interesting things happen in the code!

Here's the Initialize Procedure (with public variables added):


Public maxTime As Integer
Public sTime As Integer
Public hTime As Integer
Public player As String
Private Sub UserForm_Initialize()

Application.ScreenUpdating = False

Dim ws As Worksheet Dim ws_char1, ws_char2, ws_char3 As Worksheet Dim Status1, Status2, Status3 As String Dim sleep1Time, sleep2Time, sleep3Time As Integer Dim hunt1Time, hunt2Time, hunt3Time As Integer Set ws = Sheets("Corr")
Set ws_char1 = Sheets("char1")
Set ws_char2 = Sheets("char2")
Set ws_char3 = Sheets("char3")

timebox.Locked = True
timebox.Value = 0

player = Range("B2")

ws_char1.Select
Status1 = Range("D7")
sleep1Time = Range("G4")
hunt1Time = Range("G5")
If sleep1Time = "" Then sleep1Time = 0
If hunt1Time = "" Then hunt1Time = 0

ws_char2.Select Status2 = Range("D7") sleep2Time = Range("G4") hunt2Time = Range("G5") If sleep2Time = "" Then sleep2Time = 0 If hunt2Time = "" Then hunt2Time = 0
ws_char3.Select
Status3 = Range("D7")
sleep3Time = Range("G4")
hunt3Time = Range("G5")
If sleep3Time = "" Then sleep3Time = 0
If hunt3Time = "" Then hunt3Time = 0

maxTime = WorksheetFunction.max(sleep1Time + hunt1Time, sleep2Time + hunt2Time, sleep3Time + hunt3Time)
If maxTime = 0 Then maxTime = 24

Select Case player
Case "P1"
ws_char1.Select

Case "P2"
ws_char2.Select

Case "P3"
ws_char3.Select
End Select

Select Case Status
Case "Sleep"
MsgBox "The character is sleeping.", vbOKOnly

Case Else
Range("D7") = "Hunting"
End Select

ws.Select

Application.ScreenUpdating = True

End Sub


Hunt & arrows buttons and checkbox:



Private Sub hButton_Click()

Dim ws As Worksheet
Dim ws_char As Worksheet

Set ws = Sheets("Corr")

Select Case player
Case "P1"
Set ws_char = Sheets("char1")
If ws.Range("E2") = 1 Then ws.Range("E2") = 0

Case "P2"
Set ws_char = Sheets("char2")
If ws.Range("E9") = 1 Then ws.Range("E9") = 0

Case "P3"
Set ws_char = Sheets("char3")
If ws.Range("E17") = 1 Then ws.Range("E17") = 0
End Select
ws_char.Select

Range("D7") = "Hunt"
Range("G4") = sTime
Range("G5") = hTime

End Sub


Private Sub timebutton_Change()

timebutton.max = maxTime
timebutton.Min = 0
timebox.Value = timebutton.Value
If timebutton.Value = maxTime Then CheckBox1.Enabled = False Else CheckBox1.Enabled = True

End Sub

Private Sub SleepChBox_Click()

Select Case SleepChBox.Value
Case True
hTime = timebox.Value
sTime = maxTime - hTime

Case False
hTime = timebox.Value
sTime = 0
End Select

End Sub


Code responsible for counting in-game time had to be changed too. I haven't posted it before so I will show only updated version here:


Sub Cycle()

Dim time As Long
Dim hrs As Integer
Dim mins As Integer
Dim ws As Worksheet

Set ws = Sheets("Corr")

ws.Select
time = Range("BD2")

Select Case time
Case 1440
Select Case min_time
Case 0
time = 5
Case Else
time = 5 + min_time * 60
End Select

Case Else
Select Case min_time
Case 0
time = time + 5
Case Else
time = time + min_time * 60
End Select

End Select

hrs = WorksheetFunction.RoundDown(time / 60, 0)
If hrs = 24 Then hrs = 0
mins = time - hrs * 60
If hrs = 0 And mins = 1440 Then mins = 0

Range("BD2") = time
Range("BE2") = hrs
Range("BF2") = mins

End Sub

6 Dec 2015

I'M BACK... with some changes and additions!

There was no posts for a long time. Luckily, I didn't waste all that time!


First of all, I've managed to write code that could 'render' bigger rooms. Unfortunately, I had to abandon this idea, because it affected too many macros. I guess I'll stick with corridor based game.

It is possible to create items now. The idea is quite simple: combine two object in order to get another one.



  • No. 1 & 2- contain items from the selected character's inventory,
  • No. 3- type icon and available amount of items chosen in the 1st step,
  • No. 4- similar to no. 3, but shows info about  objects from 2nd step,
  • No. 5- info about final item that can be created.
I need to add some place where more information about items will be visible.


The next thing is modding / healing screen! Some options will be available only for Medic and Engineer class or characters with high Medicine or Engineering skill.


Lots of buttons here! I know that the layout is terrible right now. I will probably have to change it, but the amount of clickable objects will stay the same.
  • No. 1a, 1b, 1c- buttons that allow character change (all next steps concern only selected character),
  • No. 2- body part selection,
  • No. 3- information about modifications, health of selected part,
  • No. 4- modifications the character carry in the inventory,
  • No. 5- info about selected mod,
  • No. 6- buttons? Yep, these are buttons for sure!
GF: 'Why would you amputate something?'
Me: 'Let's say that you forgot to heal you hand and its health reached 0. You're not able to restore HP of anything that's below 1 health point. You can get rid of a 'dead' part and add e.g. a mechanical one.'

That's how this works! Of course, it is impossible to amputate head or torso, but you will be able to upgrade them with mods increasing accuracy and/or health etc.
What's more only Medic (or Medical-trained character) is able to heal wounded parts (non mechanical) and only Engineer (or character with high enough Engineering skill) can repair damaged modifications.


I've also been slowly adding items to the game and thinking about some kind of plot. Let's hope that I'll be able to come up with something not too illogical!



PS: Here's a simple code that updates Crafting userform after selecting the first item. Just in case someone was curious :P



'it1_r & it_id1 are public variables

Private Sub it1_AfterUpdate()

Dim char As String
Dim list_index As Integer
Dim ws As Worksheet
Dim ws_char As Worksheet

Set ws = Sheets("Corr")
char = ws.Range("B2")
list_index = it1.ListIndex

Select Case char
Case "P1"
Set ws_char = Sheets("char1")
Case "P2"
Set ws_char = Sheets("char2")
Case "P3"
Set ws_char = Sheets("char3")
End Select

ws_char.Select

Select Case list_index
Case 0
amt0.Caption = Range("C27")
it_id1 = Range("K27")
it1_r = Range("B27").Row
Set slot0.Picture = LoadPicture(ThisWorkbook.Path & "\items\" & it_id1 & ".jpg")
Case 1
amt0.Caption = Range("C28")
it_id1 = Range("K28")
it1_r = Range("B28").Row
Set slot0.Picture = LoadPicture(ThisWorkbook.Path & "\items\" & it_id1 & ".jpg")
Case 2
amt0.Caption = Range("C29")
it_id1 = Range("K29")
it1_r = Range("B29").Row
Set slot0.Picture = LoadPicture(ThisWorkbook.Path & "\items\" & it_id1 & ".jpg")
Case 3
amt0.Caption = Range("C30")
it_id1 = Range("K30")
it1_r = Range("B30").Row
Set slot0.Picture = LoadPicture(ThisWorkbook.Path & "\items\" & it_id1 & ".jpg")
Case 4
amt0.Caption = Range("C31")
it_id1 = Range("K31")
it1_r = Range("B31").Row
Set slot0.Picture = LoadPicture(ThisWorkbook.Path & "\items\" & it_id1 & ".jpg")
Case 5
amt0.Caption = Range("C32")
it_id1 = Range("K32")
it1_r = Range("B32").Row
Set slot0.Picture = LoadPicture(ThisWorkbook.Path & "\items\" & it_id1 & ".jpg")
Case 6
amt0.Caption = Range("C33")
it_id1 = Range("K33")
it1_r = Range("B33").Row
Set slot0.Picture = LoadPicture(ThisWorkbook.Path & "\items\" & it_id1 & ".jpg")
Case 7
amt0.Caption = Range("C34")
it_id1 = Range("K34")
it1_r = Range("B34").Row
Set slot0.Picture = LoadPicture(ThisWorkbook.Path & "\items\" & it_id1 & ".jpg")
Case 8
amt0.Caption = Range("C35")
it_id1 = Range("K35")
it1_r = Range("B35").Row
Set slot0.Picture = LoadPicture(ThisWorkbook.Path & "\items\" & it_id1 & ".jpg")
Case 9
amt0.Caption = Range("C36")
it_id1 = Range("K36")
it1_r = Range("B36").Row
Set slot0.Picture = LoadPicture(ThisWorkbook.Path & "\items\" & it_id1 & ".jpg")
End Select

it1it2 = it1_id & it2_id

Select Case it1it2 ' Just random numbers here! I need to update items list first.

Case "300"

Case "001001"

Case "054295"

End Select

End Sub


7 Oct 2015

Try hard and fail even harder!

There was no new posts for a long time. I decided to upload a few screenshots of my attempt of making larger rooms.


Looks fine so far!


The idea was quite simple: make visibility range wider. Let me explain (or embroil) it with a picture:

I just wanted my excel game to be able to 'render' AFTER rooms.


Unfortunately...

Well, that's only one shape... I can fix it!

...something...

Just a few more things. Maybe there is still hope!

...went...

Oh, I give up! I need a break!

...terribly wrong!


I know, I know. I messed VBA code up. I'm going to try to correct the errors and make it work. It will take probably a lot of time, but I don't care!

I! WANT! BIGGER! ROOMS! GODDAMMIT!


Luckily, one new part of code works well: turn system
It allows every character to make one move forward per turn. It will be possible to turn around as much as you want, as long as you stay in the same place. After player's turn, enemies will move and attack (if it is possible).


What's next (except for new 'view distance')?
I'd like to make two categories of enemies: melee fighters and ones that attack from distance. It will require a new 'addition' to the movement macro.
I also think that it would be nice to show some of my code on here. Not everything, 24k lines of code is a little bit too much, but at least some parts.

2 Sep 2015

Enemies 12/31 - Spider


Name: Spider
Type: Animal
Health Points: 110
Damage (min - max): 10- 30
Speed: 1,3
Items: cannot and use carry anything


Drawn by Retta (for more go HERE)

29 Aug 2015

Enemies 11/31 - Crawler

I'm back with enemies from Cell Dungeons!


Name: Crawler
Type: Humanoid
Health Points: 180
Damage (min - max): 5- 25
Speed: 0,75
Items: can carry Weapons, Armors, Helmets, Shields, but cannot use them


Drawn by Retta (for more go HERE)

Basic screens + progress info

As I promised: below you can find ideas of a few userforms that will be in the game.



CHARACTER CUSTOMIZATION



At this moment there are 5 classes: Berserker, Sharpshooter, Medic, Engineer and Thief. Each class has different amount of health points and is able to carry different number of items (depends on weight and number of items).

Progress:
All buttons are working and skills are stored on different sheets (one sheet per character). Skills have descriptions that, after clicking on the skill, appear in the box above DONE buton.

What's left:
I need to come up with some descriptions of classes. Additionally, I will have to prepare a lot of images of characters.



SKILLS



It is almost the same as the previous userform. It only has some additions like damage and defence indicators. There is also a small info about level and a little line showing leveling progres.

Good news: everything is working here... except for images :(



PICKING UP ITEMS FROM THE GROUD



Player will be able to choose items that he/she wants to have in the inventory. Squares on the left side will contain small images indicating type of item. Next shapes will show names and weight of items. The last, big box will provide information about items (picking up weapon that isn't as good as the one that you already have would be stupid, right?).

Everything's done here, but (again) images are missing. I think that labels might be useful.



EQUIPMENT



Quite simple equipment screen. I don't think I can say someting more about it, apart from the fact that this was probably the most annoying thing to code in VBA! It took me a few hours to make it work properly. There are around 10 000 lines of code and... it works flawlessly and fast! HELL YEAH!



BONUS!!!

Do you want to know how the map looks like now? Here it is! [It will not be visible in the final version.]


Unfortunately, I have no idea how to make some rooms or places different than corridors. I've tried to create something more complicated, but my code doesn't want to cooperate.
I will think about this 'issue' later. Now, it is time to add enemies and let them roam through the corridors!

16 Aug 2015

Something new! Back to the... past?

Since Cells Dungeon works almost 100% fine, I've decided to create a completely new game.

What's gonna be new? First of all, first person perspective! How? Like the old Might & Magic games.


Thank Google Images for the picture!


And yes, there will be more than one character to control. Exactly, three characters. 

What has been done so far?
Well, not a lot. I've spent like 10h coding and adjusting everything, so don't expect miracles. Anyway, '3D' corridors generation is already working. Also movement, collision detection (with walls only at the moment) and character selection are ready.


Early access available soon on Steam! ;D

I'm trying to create a nice character creator, inventory and skills windows. In the next post I will provide an some screenshots of these things.