Mirage Source

Free ORPG making software.
It is currently Fri Mar 29, 2024 5:41 am

All times are UTC




Post new topic Reply to topic  [ 1251 posts ]  Go to page 1, 2, 3, 4, 5 ... 51  Next
Author Message
PostPosted: Sun Dec 31, 2006 2:45 am 
Offline
Knowledgeable
User avatar

Joined: Thu Dec 28, 2006 8:57 pm
Posts: 297
Location: This magical place called 'reality'
Hello, I have been browsing the forums the past few days, looking for interesting things. I found Magnus's tutorial on carrying over EXP after a player levels up. It is my first time coding in Mirage, so here goes (I re-made my levelup sub)

Code:
Sub CheckPlayerLevelUp(ByVal Index As Long)
'**S*O*U*R*C*E***E*D*I*T****************************************************************
'* Deathlycat -                                                                        *
'*      Revamped entire levelup system to have EXP carry over after a player levels up *
'* 12/30/06                                                                            *
'***************************************************************************************
    Do While GetPlayerExp(Index) >= GetPlayerNextLevel(Index)
        ' When a player has more EXP than the TNL states, give them the EXP that they have left after they level up
        Call SetPlayerExp(Index, (GetPlayerExp(Index)) - (GetPlayerNextLevel(Index)))
        Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1)
        ' Gives the player stat points based on their current level divided by 10
        Call SetPlayerPOINTS(Index, (GetPlayerPOINTS(Index)) + (GetPlayerLevel(Index) / 10) + 1)
        ' Tells everyone that that player leveled up
        Call GlobalMsg(GetPlayerName(Index) & " has gained a level!", Brown)
        Call PlayerMsg(Index, "You have gained a level!  You now have " & GetPlayerPOINTS(Index) & " stat points to distribute.", BrightBlue)
    Loop

   
End Sub


Is this good :D or is it messed up to an evil extent :twisted: ?


Last edited by Stomach Pulser on Sun Dec 31, 2006 3:40 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 31, 2006 3:06 am 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
Does it work? If it does, then it's fine. It looks like it works to me :)

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 31, 2006 3:09 am 
Offline
Pro

Joined: Mon May 29, 2006 1:40 pm
Posts: 430
I think you could use a little less comments :P 1 every other line is a little excessive. Oh and the entire do loop(including do and loop should be indented more, nothing else(except some dim statements) should line up with the sub and end sub. Hopefully you don't take this as an insult or bad criticism, just trying to point out things you might want to fix in the future.

I'm not sure if the code works or not, did you test it?


Top
 Profile  
 
 Post subject: It works
PostPosted: Sun Dec 31, 2006 4:19 am 
Offline
Knowledgeable
User avatar

Joined: Thu Dec 28, 2006 8:57 pm
Posts: 297
Location: This magical place called 'reality'
I tested the code and it works fine, giving me the EXP that I rightfully deserve. Thanks for feedback, I wanted to make sure it wouldn't totally screw up my game before I put it into action :D

_________________
P2B Feed: Custom AI
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 31, 2006 5:30 am 
Offline
Pro

Joined: Mon May 29, 2006 2:58 pm
Posts: 370
Code:
'****************************************************************
'* Deathlycat -
'*      Revamped entire levelup system to have EXP carry over after a player levels up
'* 12/30/06
'****************************************************************
Sub CheckPlayerLevelUp(ByVal Index As Long)

     ' If a player has enough EXP to level up, level them up
     Do While GetPlayerExp(Index) >= GetPlayerNextLevel(Index)

         ' When a player has more EXP than the TNL states, give them the EXP that they have left
         Call SetPlayerExp(Index, (GetPlayerExp(Index)) - (GetPlayerNextLevel(Index)))
         ' Levels the player up
         Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1)
         ' Gives the player stat points based on their current level divided by 10
         Call SetPlayerPOINTS(Index, (GetPlayerPOINTS(Index)) + (GetPlayerLevel(Index) / 10))
         ' Tells everyone that that player leveled up
         Call GlobalMsg(GetPlayerName(Index) & " has gained a level!", Brown)
         ' Tells the player that they leveled up and how much stat points they have
         Call PlayerMsg(Index, "You have gained a level!  You now have " & GetPlayerPOINTS(Index) & " stat points to distribute.", BrightBlue)

     Loop
   
End Sub


ther' we go

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 31, 2006 3:40 pm 
Offline
Knowledgeable
User avatar

Joined: Thu Dec 28, 2006 8:57 pm
Posts: 297
Location: This magical place called 'reality'
Thanks! I got it indented in my source code now.

_________________
P2B Feed: Custom AI
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 31, 2006 11:03 pm 
Offline
Persistant Poster
User avatar

Joined: Wed Nov 29, 2006 11:25 pm
Posts: 860
Location: Ayer
I hate commenting my code. Its annoying to see it :o But welcome!

:: Pando

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 31, 2006 11:09 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Pando wrote:
I hate commenting my code. Its annoying to see it :o But welcome!

:: Pando


Good luck having a few people working on the same piece.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 01, 2007 12:47 am 
Offline
Knowledgeable

Joined: Wed May 31, 2006 8:00 pm
Posts: 142
I always make pattens with my comments, I hate seeing text that doesn't match the patten of the surrounding code (You know, how you sometimes have repeating if statements, or perhaps setting a group of variables or yada yada)

_________________
xFire:- funkynut


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 01, 2007 1:34 am 
Offline
Pro

Joined: Mon May 29, 2006 1:40 pm
Posts: 430
funkynut wrote:
I always make pattens with my comments, I hate seeing text that doesn't match the patten of the surrounding code (You know, how you sometimes have repeating if statements, or perhaps setting a group of variables or yada yada)


No, I guess I'm just not OCD like you :P


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 01, 2007 2:19 am 
Offline
Knowledgeable

Joined: Wed May 31, 2006 8:00 pm
Posts: 142
pffft, ocd my butt, kinda hard to explain while I'm in the celebration state of mind.

Basically, It just makes it easier on my eyes to look through my code

_________________
xFire:- funkynut


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 01, 2007 3:50 am 
Offline
Knowledgeable
User avatar

Joined: Thu Dec 28, 2006 8:57 pm
Posts: 297
Location: This magical place called 'reality'
OK, I implemented characters changing their direction without moving...but I have 2 questions for this.

1.) How can I implement key coding (i.e. Pressing alt + up arrow at same time) to have direction changes, because right now I just have a single key for each direction.

2.) When I am moving one direction, holding down the right arrow for say, if I also hold down my change direction key, after I start moving, My char will change directions for that split second during movement when you aren't moving. It will instantly change back after that second, so you will barely see the change, but it is noticeable. Any known fix, or will it simply be solved when I implement question 1?

[EDIT]
OK, on a different note, I found out how to increase the number of NPCs you can have on a map through experimenting and analyzing code! It is the first thing that I have implemented solely by me! I am starting to get the hang of things now!

Happy new Year!

_________________
P2B Feed: Custom AI
Image


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 01, 2007 5:05 am 
Offline
Pro

Joined: Mon May 29, 2006 2:15 am
Posts: 368
to my knowledge, alt can't be used. i tried to find a way to use it a while ago (although i didn't look very hard), and couldn't find one.

_________________
Image
Image
The quality of a man is not measured by how well he treats the knowledgeable and competent, but rather how he treats those less fortunate than himself.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 01, 2007 5:17 am 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
You could use a low level keyboard hook to keep track of the state of the alt key... then if it's down when the arrow key is pressed...

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 01, 2007 5:30 am 
Offline
Knowledgeable
User avatar

Joined: Thu Dec 28, 2006 8:57 pm
Posts: 297
Location: This magical place called 'reality'
Dave wrote:
You could use a low level keyboard hook to keep track of the state of the alt key... then if it's down when the arrow key is pressed...

What is a low level keyboard hook? Anyways, alt was just an example.

_________________
P2B Feed: Custom AI
Image


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 01, 2007 8:05 pm 
Offline
Pro

Joined: Mon May 29, 2006 1:40 pm
Posts: 430
google it or look on pscode. It lets you capture key presses(even from other apps) and decide whether to pass them on or not.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 02, 2007 3:41 pm 
Offline
Knowledgeable
User avatar

Joined: Thu Dec 28, 2006 8:57 pm
Posts: 297
Location: This magical place called 'reality'
Would you have to use keyboard hooks to combine controls (i.e Ctrl + 4), or could you use a different methods.

_________________
P2B Feed: Custom AI
Image


Top
 Profile  
 
PostPosted: Sun Jan 23, 2022 1:19 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
wwwa


Top
 Profile  
 
PostPosted: Sun Jan 23, 2022 1:20 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
162.8


Top
 Profile  
 
PostPosted: Sun Jan 23, 2022 1:21 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Bett


Top
 Profile  
 
PostPosted: Sun Jan 23, 2022 1:22 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Bett


Top
 Profile  
 
PostPosted: Sun Jan 23, 2022 1:23 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Gabr


Top
 Profile  
 
PostPosted: Sun Jan 23, 2022 1:24 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Zara


Top
 Profile  
 
PostPosted: Sun Jan 23, 2022 1:26 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Soun


Top
 Profile  
 
PostPosted: Sun Jan 23, 2022 1:27 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Akir


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1251 posts ]  Go to page 1, 2, 3, 4, 5 ... 51  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group