Mirage Source

Free ORPG making software.
It is currently Fri Apr 19, 2024 12:31 pm

All times are UTC




Post new topic Reply to topic  [ 45 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Making advanced items
PostPosted: Tue Jan 13, 2009 9:52 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
I noticed that the items are barren. There's no stats for them whatsoever, can anyone post a tut or maybe steer me in the right direction? I thought of ripping it from Elysium, but... No. Just no.

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Thu Jan 15, 2009 12:14 am 
Offline
Knowledgeable
User avatar

Joined: Sun Feb 10, 2008 7:40 pm
Posts: 200
Do you mean Item requirements? Or something like adding STR, DEF ect.?

_________________
I is back!


Top
 Profile  
 
PostPosted: Thu Jan 15, 2009 4:09 am 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Required stats, item stats, attack modifiers, etc, etc.

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Fri Jan 16, 2009 12:51 am 
Offline
Knowledgeable
User avatar

Joined: Sun Feb 10, 2008 7:40 pm
Posts: 200
What I need is a Level Requirement and class requirement thing for items.

_________________
I is back!


Top
 Profile  
 
PostPosted: Fri Jan 16, 2009 1:22 am 
Offline
Pro

Joined: Mon May 29, 2006 5:01 pm
Posts: 420
Location: Canada, BC
Google Talk: anthony.fleck@gmail.com
Just add the new thing you want to the item UDT then add a box or scrollbar or whatever to the item editor, parse everything properly and make it save right. Then just whenever a player goes to equip something have it check if they are the correct level or class by calling to the saved item. Pretty simple.

If you want item bonuses it's like the same way more or less just when you have the getplayerstats check, look to see if they are wearing any items that may increase their stat points and if so just add it in.


Top
 Profile  
 
PostPosted: Fri Jan 16, 2009 5:29 pm 
Offline
Pro
User avatar

Joined: Wed Jun 07, 2006 8:04 pm
Posts: 464
Location: MI
Google Talk: asrrin29@gmail.com
Something like this?

Image
Image

_________________
Image
Image


Top
 Profile  
 
PostPosted: Fri Jan 16, 2009 10:14 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Asrrin29 wrote:
Something like this?

Image
Image


Yes, that's very sexy.

Thanks for the suggestions, everyone. I'll get to work soon. :)

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Fri Jan 16, 2009 11:14 pm 
Offline
Knowledgeable
User avatar

Joined: Sun Feb 10, 2008 7:40 pm
Posts: 200
Exactly like that, with the class and level req.

_________________
I is back!


Top
 Profile  
 
PostPosted: Fri Jan 16, 2009 11:32 pm 
Offline
Pro
User avatar

Joined: Wed Jun 07, 2006 8:04 pm
Posts: 464
Location: MI
Google Talk: asrrin29@gmail.com
timster0 wrote:
Exactly like that, with the class and level req.



I reworked the ENTIRE item stats code to get this to work. you basically start with the basics, adding in every variable you want to items, saving them server side, and passing the variables between server and client. add to the editor client side. once you have the variables being passed back and forth successfully, then you need to actually make the variables do something. I found it very frustrating to find every instance of when a player has items being removed or added, so instead of finding them all I did stat checks straight in the player's GetStat subs. If for some reason I needed to find the player's natural stat I just used Player(I).Stat(whatever). (I'm psuedo-coding it heavy right there, but you get the picture.) For other types of stats, such as life stealing, crit%, etc. I added the proper subs into the attack code. I reccommend using case statements, because If/Then/Else will get very messy in very short order.

The Item pop-up code was quicker but a little more difficult, I passed all the variables to the client every time it asked to see them, and used a transparent richtextbox and formatted it based on the stats I had. That is why you don't see empty fields (like Level Req, because that particular item has no level req).

_________________
Image
Image


Top
 Profile  
 
PostPosted: Sat Jan 17, 2009 12:45 am 
Offline
Knowledgeable
User avatar

Joined: Sun Feb 10, 2008 7:40 pm
Posts: 200
Wow, that's way to complicated for me. Need to get better at coding first.

_________________
I is back!


Top
 Profile  
 
PostPosted: Sat Jan 17, 2009 1:37 am 
Offline
Pro

Joined: Mon May 29, 2006 5:01 pm
Posts: 420
Location: Canada, BC
Google Talk: anthony.fleck@gmail.com
Asrrin made it sound way more complicated than it actually is haha.

Add this to your ItemRec UDT on client and server side.

Code:
Stat(1 To Stats.Stat_Count - 1) As Byte


Then parse the data back and forth properly and have it all save and make it work with the editor.

On the server side find the GetPlayerStat function and make it look like this.

Code:
Public Function GetPlayerStat(ByVal Index As Long, ByVal Stat As Stats) As Long
Dim Add As Long, i As Long

    Add = 0

    For i = 1 To Equipment.Equipment_Count - 1
        If GetPlayerEquipmentSlot(Index, i) > 0 Then
            Add = Add + Item(GetPlayerInvItemNum(Index, GetPlayerEquipmentSlot(Index, i))).Stat(Stat)
        End If
    Next i

    GetPlayerStat = Player(Index).Char(TempPlayer(Index).CharNum).Stat(Stat) + Add
End Function


That's how I did mine. So if you have any item equipped it checks for any bonuses that have been added then just adds it to the stat. This works in MS4.


Top
 Profile  
 
PostPosted: Sat Jan 17, 2009 1:51 am 
Offline
Knowledgeable
User avatar

Joined: Sun Feb 10, 2008 7:40 pm
Posts: 200
Thx, umm how do you "parse" stuff?

_________________
I is back!


Top
 Profile  
 
PostPosted: Sat Jan 17, 2009 1:59 am 
Offline
Pro

Joined: Mon May 29, 2006 5:01 pm
Posts: 420
Location: Canada, BC
Google Talk: anthony.fleck@gmail.com
Basically it's just transferring data between a server and client.

So in modHandleData you can see that in the HandleEditItem sub the client is receiving data from the server and organizing it to it's appropriate defined types. If you look on the server side for the part of it that sends the data to the client you'll see how it's setup.

So in modServerTCP on the server you can see the SendEditItemTo sub and how it's sending the data. Keep it all organized and in order and it's pretty easy.

I might write a tutorial on this advanced items thing but don't count on it. I just almost have in this topic :P.


Top
 Profile  
 
PostPosted: Sat Jan 17, 2009 2:59 am 
Offline
Pro
User avatar

Joined: Wed Jun 07, 2006 8:04 pm
Posts: 464
Location: MI
Google Talk: asrrin29@gmail.com
well, for my code it is a bit more complicated, because one I don't have a .stats, I have .STR, .DEX, etc. Second, in addition to the four basic stats I have MP, SP, HP, AP (Attack Power), RAP (Ranged Attack Power). so I have to use case statements.

_________________
Image
Image


Top
 Profile  
 
PostPosted: Sat Jan 17, 2009 3:04 am 
Offline
Pro
User avatar

Joined: Tue Nov 13, 2007 2:42 pm
Posts: 509
Here's a sub I have to see if you can use an item:

In the item UDT:
Code:
LevelReq As Long
    ClassReq(0 To MAX_CLASSES) As Byte
    StatReq(1 To Stats.Stat_Count - 1) As Byte


Code:
'***************************************
' Check to see if you can use an item
'***************************************
Public Function CanUseItem(ByVal Index As Long, ByVal ItemNum As Long) As Boolean
Dim i As Long

    CanUseItem = False
   
    ' Check for level requirement
    If Item(ItemNum).LevelReq > 0 Then
        ' If there's a level requirement then check if you can use it
        ' Checks if your level is below the req and if so - will exit
        If Current_Level(Index) < Item(ItemNum).LevelReq Then
            SendActionMsg Current_Map(Index), "[Level Req: " & Item(ItemNum).LevelReq & "]", ActionColor, ACTIONMSG_SCREEN, 0, 0, Index
            Exit Function
        End If
    End If
   
    ' Check for class requirement
    ' Will check your current class to the item
    ' If your class is 0 then that means you can not use the item so we exit
    If Item(ItemNum).ClassReq(Current_Class(Index)) <= 0 Then
        SendActionMsg Current_Map(Index), "[Your class can not use this item.]", ActionColor, ACTIONMSG_SCREEN, 0, 0, Index
        Exit Function
    End If
   
    ' Check for stat requirement
    ' Will check all stats - if one isn't high enough will exit
    For i = 1 To Stats.Stat_Count - 1
        ' Make sure the stat has a requirement
        If Item(ItemNum).StatReq(i) > 0 Then
            If Current_BaseStat(Index, i) < Item(ItemNum).StatReq(i) Then
                SendActionMsg Current_Map(Index), "[" & StatName(i) & " req: " & Item(ItemNum).StatReq(i) & "]", ActionColor, ACTIONMSG_SCREEN, 0, 0, Index
                Exit Function
            End If
        End If
    Next
   
    ' If we get through all the checks it means we can use the item
    CanUseItem = True
End Function


Top
 Profile  
 
PostPosted: Sat Jan 17, 2009 3:55 am 
Offline
Knowledgeable
User avatar

Joined: Sun Feb 10, 2008 7:40 pm
Posts: 200
OK, I'm starting to understand it better now. Thanks Dugor, that sub really helped me figure things out.

_________________
I is back!


Top
 Profile  
 
PostPosted: Sun Jan 18, 2009 9:00 am 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Anthony wrote:
Asrrin made it sound way more complicated than it actually is haha.

Add this to your ItemRec UDT on client and server side.

Code:
Stat(1 To Stats.Stat_Count - 1) As Byte


Then parse the data back and forth properly and have it all save and make it work with the editor.

On the server side find the GetPlayerStat function and make it look like this.

Code:
Public Function GetPlayerStat(ByVal Index As Long, ByVal Stat As Stats) As Long
Dim Add As Long, i As Long

    Add = 0

    For i = 1 To Equipment.Equipment_Count - 1
        If GetPlayerEquipmentSlot(Index, i) > 0 Then
            Add = Add + Item(GetPlayerInvItemNum(Index, GetPlayerEquipmentSlot(Index, i))).Stat(Stat)
        End If
    Next i

    GetPlayerStat = Player(Index).Char(TempPlayer(Index).CharNum).Stat(Stat) + Add
End Function


That's how I did mine. So if you have any item equipped it checks for any bonuses that have been added then just adds it to the stat. This works in MS4.


Thanks a lot dude, this really helped me out. Could you give an example of parsing one of the stats though? It might be that I'm missing something obvious, or the fact it's two in the morning, but that's the only thing I have a problem understanding. If I can get that, than I think I can definitely program this in myself... Than again, that's the biggest part. xD

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Sun Jan 18, 2009 9:25 am 
Offline
Pro

Joined: Mon May 29, 2006 5:01 pm
Posts: 420
Location: Canada, BC
Google Talk: anthony.fleck@gmail.com
Parsing for the item editor? This is a sub here.

Code:
Sub SendUpdateItemToAll(ByVal ItemNum As Long)
Dim Packet As String, i As Byte

With Item(ItemNum)
    Packet = SUpdateItem & SEP_CHAR & ItemNum & SEP_CHAR & Trim$(.Name) & SEP_CHAR & .Pic & SEP_CHAR & .Type
   
    For i = 1 To Stats.Stat_Count - 1
        Packet = Packet & SEP_CHAR & .Stat(i)
    Next i

    Packet = Packet & SEP_CHAR & .Exp & SEP_CHAR & .Gold & END_CHAR
End With
    Call SendDataToAll(Packet)
End Sub


Then for receiving it in the client.

Code:
Sub HandleUpdateItem(ByRef Parse() As String)
Dim n As Long, ItemNum As Long, i As Byte

    ItemNum = Val(Parse(1))
   
    ' Update the item
    Item(ItemNum).Name = Parse(2)
    Item(ItemNum).Pic = Val(Parse(3))
    Item(ItemNum).Type = Val(Parse(4))
    Item(ItemNum).Data1 = 0
    Item(ItemNum).Data2 = 0
    Item(ItemNum).Data3 = 0
   
    n = 5
    For i = 1 To Stats.Stat_Count - 1
        Item(ItemNum).Stat(i) = Val(Parse(n))
       
        n = n + 1
    Next i

End Sub


Or are you talking about sending the data to the client so you can have it displayed as like a 10 + (2) sort of thing?


Top
 Profile  
 
PostPosted: Sun Jan 18, 2009 7:05 pm 
Offline
Knowledgeable
User avatar

Joined: Sun Feb 10, 2008 7:40 pm
Posts: 200
Those subs would go in modgamelogic right?

_________________
I is back!


Top
 Profile  
 
PostPosted: Sun Jan 18, 2009 7:32 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Gah, I just I don't understand how to actually add the stats to the items.

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Tue Jan 20, 2009 12:58 am 
Offline
Knowledgeable
User avatar

Joined: Sun Feb 10, 2008 7:40 pm
Posts: 200
I understand setting requirements, but not making the items add stats. I guess it would be like a spell Buff maybe.

_________________
I is back!


Top
 Profile  
 
PostPosted: Tue Jan 20, 2009 4:52 am 
If weapon(getplayerweapon(myindex)).bonusstr > 0 then
call setplayertempstr(myindex, getplayerstr(myindex))
call setplayerstr(myindex, getplayerstr(myindex) + weapon(getplayerweapon(myindex)).bonusstr)
end if

Something along that, pending how you store the item's bonus stats and such.


Top
  
 
PostPosted: Tue Jan 20, 2009 6:26 am 
Offline
Pro

Joined: Mon May 29, 2006 5:01 pm
Posts: 420
Location: Canada, BC
Google Talk: anthony.fleck@gmail.com
I don't see how much better we can explain it O_o haha.


Top
 Profile  
 
PostPosted: Mon Jan 26, 2009 5:06 am 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Holy fucking shit, i was retarded. I worked on this tonight, and actually thought about it, and it was incredibly simple. Well at least the item requirements are, I have yet to do the stat modifiers. Thanks for all the help guys. :D

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
PostPosted: Mon Jan 26, 2009 11:41 pm 
Offline
Knowledgeable
User avatar

Joined: Sun Feb 10, 2008 7:40 pm
Posts: 200
Really? Then I'm gonna try it as well.

_________________
I is back!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 45 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 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