Mirage Source
Help please with this very easy code - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51)
+----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44)
+----- Thread: Help please with this very easy code (/showthread.php?tid=2262)



Help please with this very easy code - Cigar And A Sheep - 17-10-2008

Ok so i just joined today and i have taken a crack at jumping head first into mirage. My first edit I wanted to try would be to add a new morale called "Cola" just for fun. So here is the code i have
Code:
Public Sub UpdateDrawMapName()
    DrawMapNameX = (MAX_MAPX + 1) * PIC_X \ 2 - ((Len(Trim$(Map.Name)) \ 2) * 8)
    DrawMapNameY = 1
    
    Select Case Map.Moral
        Case MAP_MORAL_NONE
            DrawMapNameColor = QBColor(BrightRed)
            
        Case MAP_MORAL_SAFE
            DrawMapNameColor = QBColor(White)
        
        Case MAP_MORAL_COLA
            DrawMapNameColor = QBColor(Blue)

        
        Case Else
            DrawMapNameColor = QBColor(White)
    End Select
    
End Sub

On the top line
Code:
Public Sub UpdateDrawMapName()
it says that it is not defined when i run the client.


Re: Help please with this very easy code - Mattyw - 17-10-2008

Under " ' Map constants " add " Public Const MAP_MORAL_COLA As Byte = 2 ", you do that for all Morals & such other stuff in modConstants, you also do the same in Server. Enjoy.


Re: Help please with this very easy code - Cigar And A Sheep - 17-10-2008

Still not working. I added that line of code to the map constants client side and server side.


Re: Help please with this very easy code - Mattyw - 17-10-2008

Well, gave direct location, couldn't have been easier. =-p No problem.


Re: Help please with this very easy code - Cigar And A Sheep - 17-10-2008

I edited my post please read it and answer again.


Re: Help please with this very easy code - Mattyw - 17-10-2008

Show us all the Moral stuff added.


Re: Help please with this very easy code - Cigar And A Sheep - 17-10-2008

Code:
' Map constants
Public Const MAX_MAPS As Long = 100
Public Const MAX_MAPX As Byte = 15
Public Const MAX_MAPY As Byte = 11
Public Const MAP_MORAL_NONE As Byte = 0
Public Const MAP_MORAL_SAFE As Byte = 1
Public Const MAX_MORAL_COLA As Byte = 2

Here is where i placed it in the map constants client side.

Code:
' Map constants
Public Const MAX_MAPS As Long = 100
Public Const MAX_MAPX As Byte = 15
Public Const MAX_MAPY As Byte = 11
Public Const MAP_MORAL_NONE As Byte = 0
Public Const MAP_MORAL_SAFE As Byte = 1
Public Const MAX_MORAL_COLA As Byte = 2

Here is where i placed it in the server constants client side.

Code:
Public Sub UpdateDrawMapName()
    DrawMapNameX = (MAX_MAPX + 1) * PIC_X \ 2 - ((Len(Trim$(Map.Name)) \ 2) * 8)
    DrawMapNameY = 1
    
    Select Case Map.Moral
        Case MAP_MORAL_NONE
            DrawMapNameColor = QBColor(BrightRed)
            
        Case MAP_MORAL_SAFE
            DrawMapNameColor = QBColor(White)
        
        Case MAP_MORAL_COLA
            DrawMapNameColor = QBColor(Blue)
        
        Case Else
            DrawMapNameColor = QBColor(White)
    End Select
    
End Sub

This is what i have in game logic client side.

Also, if the game knows about the morale, where do you tell the program what the morale does? I would like the question answered becasue if you add anything new say a new layer or spell thing, or map attribute, where do you tell the program what it does you know what i mean?


Re: Help please with this very easy code - Mattyw - 17-10-2008

Go to "frmMapProperties", "cmbMoral", then add "Cola Zone". SHOULD work?


Re: Help please with this very easy code - Nean - 17-10-2008

You have MAX_MORAL_COLA instead of MAP_MORAL_COLA

=3


Re: Help please with this very easy code - Mattyw - 17-10-2008

Nean Wrote:You have MAX_MORAL_COLA instead of MAP_MORAL_COLA

=3

& that. XD

Sorry, quick & easy mistake. Lawl.


Re: Help please with this very easy code - Rian - 17-10-2008

It depends on what you want to use the Cola Map moral for. For example, if you want the Cola Moral to make players drop gold when they die, then you'll be looking for Sub NPCAttackPlayer and Sub AttackPlayer.


Re: Help please with this very easy code - Dragoons Master - 17-10-2008

When you want to add things to your game, I think the most easy way to proceed is to use the find(Ctrl+F) and find(duh) everything that's been used and where, then you add the new functionality basically by coping and pasting. Search for every piece of code that has MAP_MORAL_SAFE, I think that's a good starting point.
Good luck.