Mirage Source

Free ORPG making software.
It is currently Sun Apr 28, 2024 4:41 am

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 31 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Something like CTF
PostPosted: Fri Jul 06, 2007 8:19 pm 
Offline
Newbie

Joined: Wed Jul 04, 2007 11:38 am
Posts: 13
Hi all,
Does someone know how i can make sometething like this:
A class that hits a flag on a map will change the flag to the color(changing sprite to blue flag) blue for example.
I'm a beginner in coding VB6 so if people want to give me hints or just help me a bit I would be thankfull. A tutorial would be nice but i can't ask that much.


Top
 Profile  
 
 Post subject: Re: Something like CTF
PostPosted: Fri Jul 06, 2007 10:26 pm 
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'd probably want to make a flag attribute (similar to block) that can take the value of anyone hitting it. Then just say, "if it's this value, it's this color draw this picture"

_________________
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: Re: Something like CTF
PostPosted: Sun Jul 08, 2007 6:21 pm 
Offline
Newbie

Joined: Wed Jul 04, 2007 11:38 am
Posts: 13
Dave wrote:
You'd probably want to make a flag attribute (similar to block) that can take the value of anyone hitting it. Then just say, "if it's this value, it's this color draw this picture"

Thanks for helping but like i said i am a beginner in VB6 and a beginner already knows these things: The problem is which variable must i use where must i put the codes.


Top
 Profile  
 
 Post subject: Re: Something like CTF
PostPosted: Sun Jul 08, 2007 6:55 pm 
Offline
Pro
User avatar

Joined: Thu Dec 14, 2006 3:20 am
Posts: 495
Location: California
Google Talk: Rezeyu@Gmail.com
Just name it like.. CTF

Or.. Flag


Top
 Profile  
 
 Post subject: Re: Something like CTF
PostPosted: Sun Jul 08, 2007 6:59 pm 
Dave told you what to do, and since he told you what to do, using code that's already in the source, you add the stuff right there. It's really simple, and Dave told you everything you need to know.

The variable or w/e, would be like tile_type_flag.. Something along those lines. Just like the block tile.


Top
  
 
 Post subject: Re: Something like CTF
PostPosted: Sun Jul 08, 2007 8:10 pm 
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
Follow the other attribute code, copying an attribute (like block) and modify the stuff to act as a flag.

That's the thing with Mirage Source, a lot of the code is already there to copy.

_________________
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: Re: Something like CTF
PostPosted: Mon Jul 09, 2007 6:44 pm 
Offline
Newbie

Joined: Wed Jul 04, 2007 11:38 am
Posts: 13
Dave wrote:
Follow the other attribute code, copying an attribute (like block) and modify the stuff to act as a flag.

That's the thing with Mirage Source, a lot of the code is already there to copy.

Okay i requested a tutrial and i get some answer that i already know well let say what i understand and what i need to learn okay:
I know how to create the TILE_TYPE_FLAG and all the stuff that comes with it i already did it.
The problem will come now: I don't know the code how to make TILE_TYPE_XXX a tile sprite.
PS. answer in codes and not in normal languages and letting me translate it to codes.


Top
 Profile  
 
 Post subject: Re: Something like CTF
PostPosted: Mon Jul 09, 2007 7:58 pm 
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
Put all of this in modThinkAboutIt

If AddBltFlagsToGameLoop = true then
Goto NextStep
End If
Exit Sub

NextStep:
For each flag in Map
CreateRects
Blt
Next

_________________
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: Re: Something like CTF
PostPosted: Mon Jul 09, 2007 8:49 pm 
Offline
Newbie

Joined: Wed Jul 04, 2007 11:38 am
Posts: 13
Dave wrote:
Put all of this in modThinkAboutIt

If AddBltFlagsToGameLoop = true then
Goto NextStep
End If
Exit Sub

NextStep:
For each flag in Map
CreateRects
Blt
Next

Okay still not understanding what are you trying to do the only thing yopur doing is getting me confused morethen i already am. Okay using the blt things is right but what after this how to open tile1.bmp and set this sprite and if it hits player change it to another sprite.


Top
 Profile  
 
 Post subject: Re: Something like CTF
PostPosted: Mon Jul 09, 2007 8:53 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
He's telling you the basic structure of the code.

And the code is doubling as a suggestion to "just think about it".

Go brood over what we've told you and come to the answers on your own.

People rarely want to create a tutorial for someone when they aren't going to use the code themselves.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: Something like CTF
PostPosted: Mon Jul 09, 2007 8:56 pm 
precrid wrote:
Dave wrote:
Put all of this in modThinkAboutIt

If AddBltFlagsToGameLoop = true then
Goto NextStep
End If
Exit Sub

NextStep:
For each flag in Map
CreateRects
Blt
Next

Okay still not understanding what are you trying to do the only thing yopur doing is getting me confused morethen i already am. Okay using the blt things is right but what after this how to open tile1.bmp and set this sprite and if it hits player change it to another sprite.


Dude.. It's really simple to add. We're not just going to hand you the code. You need to learn to do something on your own. And this is super easy. You say you understand how to do something, but yet you don't. You define the tile type, then where it checks all the other tile types, add a check for the new tile type, and if it is that type, then make it execute the code and what not.

Just copy the rest of the stuff. You'll understand better.


Top
  
 
 Post subject: Re: Something like CTF
PostPosted: Mon Jul 09, 2007 9:24 pm 
Offline
Newbie

Joined: Wed Jul 04, 2007 11:38 am
Posts: 13
Okay i think your thinking im sitting here and only let other people work for me i really try but its not workinh i did these things:
Added at ' Tile consants <did this also server side
Code:
Public Const TILE_TYPE_FLAG = 21

Added at ' Blit out attribs if in editor
Code:
If .Type = TILE_TYPE_FLAG Then Call DrawText(TexthDC, x * PIC_X + sx + 8 - (NewPlayerX * PIC_X) - NewXOffset, y * PIC_Y + sx + 8 - (NewPlayerY * PIC_Y) - NewYOffset, "SC", QBColor(BrightRed))


I do not ask for a complete tutorial but only for some explanation because i still don't get it.


Last edited by precrid on Mon Jul 09, 2007 9:28 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Something like CTF
PostPosted: Mon Jul 09, 2007 9:27 pm 
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
If you're using a seperate picture file for flags, you'll need to load them into a surface the same way the other graphics are in modDirectX.

To make it switch, you'll just do something like, "If player.x = flag.x And player.y = flag.y then..."
And to change color, you could just have to flag colors and do flag.color = 2

_________________
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: Re: Something like CTF
PostPosted: Mon Jul 09, 2007 9:29 pm 
Offline
Newbie

Joined: Wed Jul 04, 2007 11:38 am
Posts: 13
Dave wrote:
If you're using a seperate picture file for flags, you'll need to load them into a surface the same way the other graphics are in modDirectX.

To make it switch, you'll just do something like, "If player.x = flag.x And player.y = flag.y then..."
And to change color, you could just have to flag colors and do flag.color = 2

LOL this is the first answer that i understand the first answer that shows me where to search thanks.
So you mean something like this.
Code:
    ' Init flags ddsd type and load the bitmap
    DDSD_flag.lFlags = DDSD_CAPS
    DDSD_flag.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN Or DDSCAPS_SYSTEMMEMORY
    Set DD_flagSurf = DD.CreateSurfaceFromFile(App.Path & "\GFX\fn.bmp", DDSD_Flag)
    SetMaskColorFromPixel DD_ItemSurf, 0, 0


fn.bmp contains 3 flag sprites they are all 32x32 so the total size is 32 height and 96 width.
one flag is gray(no team) another flag is red and another one is blue. Another question i got is: must "DDSD_flag.lFlags ,DDSD_flag.ddsCaps.lCaps ,DD_flagSurf" must all words that are red be flag or tile??

player must be class for example class 1 is team 1 class 2 is team 2 for example


Last edited by precrid on Mon Jul 09, 2007 9:50 pm, edited 4 times in total.

Top
 Profile  
 
 Post subject: Re: Something like CTF
PostPosted: Mon Jul 09, 2007 9:31 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
He's only told you where new surfaces are created.

If you don't even know that, I doubt you'll be able to get the main code done for the system.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: Something like CTF
PostPosted: Mon Jul 09, 2007 9:46 pm 
Offline
Newbie

Joined: Wed Jul 04, 2007 11:38 am
Posts: 13
Robin wrote:
He's only told you where new surfaces are created.

If you don't even know that, I doubt you'll be able to get the main code done for the system.

Okay i don't know anythign im so dumb that even a baby is smarter etc etc etc are you happy now are you ready to tell me some usefull stuff then only cracking me off. I really get tired of those reactions. I know i have to learn but you can't learn if you don't know.


Top
 Profile  
 
 Post subject: Re: Something like CTF
PostPosted: Mon Jul 09, 2007 9:54 pm 
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
Then make it so the flag = the player's class.

Flag is fine, tile is already used for the tiles.

_________________
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: Re: Something like CTF
PostPosted: Tue Jul 10, 2007 10:08 am 
Offline
Newbie

Joined: Wed Jul 04, 2007 11:38 am
Posts: 13
Okay i think i need this code to change flag sprite
Code:
    If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Type = TILE_TYPE_FLAG Then
        If GetPlayerClass(1) (here must the sprite code that i don't know)
End If
    If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Type = TILE_TYPE_FLAG Then
        If GetPlayerClass(1) (here must the sprite code that i don't know)
End If


This code could be ofcourse fault well im sure that its fault but i tried.


Top
 Profile  
 
 Post subject: Re: Something like CTF
PostPosted: Tue Jul 10, 2007 4:51 pm 
Offline
Persistant Poster
User avatar

Joined: Tue May 30, 2006 2:07 am
Posts: 836
Location: Nashville, Tennessee, USA
Google Talk: rs.ruggles@gmail.com
I believe it's something like this:

Code:
If Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Type = TILE_TYPE_FLAG Then
        If GetPlayerClass(MyIndex) = 0 Then
             Map(GetPlayerMap(Index)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Anim = Class0Flag
        End If
        If GetPlayerClass(MyIndex) = 1 Then
             Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Anim = Class1Flag
        End If
End If


Now, where I have Class0Flag and Class1Flag, you need to count how many tiles your flag is in your tile set. So if Class 0 Flag was the 3rd tile, in the second row, Class0Flag should be replaced with the number 9.

Code:
0123456
789----
-------

_________________
I'm on Facebook! Google Plus My Youtube Channel My Steam Profile

Image


Top
 Profile  
 
 Post subject: Re: Something like CTF
PostPosted: Thu Jul 12, 2007 12:28 am 
Offline
Newbie

Joined: Wed Jul 04, 2007 11:38 am
Posts: 13
Sonire wrote:
I believe it's something like this:

Code:
If Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Type = TILE_TYPE_FLAG Then
        If GetPlayerClass(MyIndex) = 0 Then
             Map(GetPlayerMap(Index)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Anim = Class0Flag
        End If
        If GetPlayerClass(MyIndex) = 1 Then
             Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Anim = Class1Flag
        End If
End If


Now, where I have Class0Flag and Class1Flag, you need to count how many tiles your flag is in your tile set. So if Class 0 Flag was the 3rd tile, in the second row, Class0Flag should be replaced with the number 9.

Code:
0123456
789----
-------


sorry but i do not understnad the last code.
Code:
0123456
789

A normal tileset got 8 tiles a row so for example if the flag is on the 8th tile of the first row this wouldn't work? right.
And how does the computer knows the height and the width of each tile.
And at last where must i add his code??


Top
 Profile  
 
 Post subject: Re: Something like CTF
PostPosted: Thu Jul 12, 2007 12:33 am 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
You're both wrong, it's 7.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: Something like CTF
PostPosted: Thu Jul 12, 2007 12:39 am 
Offline
Persistant Poster
User avatar

Joined: Tue May 30, 2006 2:07 am
Posts: 836
Location: Nashville, Tennessee, USA
Google Talk: rs.ruggles@gmail.com
Yes, but I didn't say it was only 6 tiles across. I was just demonstrating how the tiles are numbered. And I'm pretty sure it starts with 0, not 1.

Precrid, that second bit of code wasn't code. It was just a demonstration of tile order. That code probably wont work 100%, as it was just a suggestion, and not actually tried. However, if it did work I'd probably put it in bltTile.

_________________
I'm on Facebook! Google Plus My Youtube Channel My Steam Profile

Image


Top
 Profile  
 
 Post subject: Re: Something like CTF
PostPosted: Thu Jul 12, 2007 2:23 am 
Offline
Newbie

Joined: Wed Jul 04, 2007 11:38 am
Posts: 13
Sonire wrote:
Yes, but I didn't say it was only 6 tiles across. I was just demonstrating how the tiles are numbered. And I'm pretty sure it starts with 0, not 1.

Precrid, that second bit of code wasn't code. It was just a demonstration of tile order. That code probably wont work 100%, as it was just a suggestion, and not actually tried. However, if it did work I'd probably put it in bltTile.

Okay that code would not help could you post a code that could help please.


Top
 Profile  
 
 Post subject: Re: Something like CTF
PostPosted: Thu Jul 12, 2007 2:29 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
The reason we're trying to help you is because we want you to get it working, but we're getting to the point where we're writing it for you.

It's hard for us to give code on a feature that is unique like this one, because we don't have the code available to us. That means we either need to add the feature to a blank MS and see what we need to do, which is a lot of time and effort that we'd rather spend elsewhere, or make up some code on the spot that probably wont work.

I'm sure you can see the problem with each method.

As for drawing the flags, look at the way Tiles are drawn. There's rec, and rec_pos. Those are both rectangles saying the source and destination. You just need to use the correct source rect to pick which color flag you draw. It measures in pixels so it should be easy to figure them out. Useful constants are PIC_X, PIC_Y (which are both = 32 = Tile Size)

Pretty much copying most of the code from BltTile.

_________________
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: Re: Something like CTF
PostPosted: Thu Jul 12, 2007 2:55 am 
Offline
Persistant Poster
User avatar

Joined: Tue May 30, 2006 2:07 am
Posts: 836
Location: Nashville, Tennessee, USA
Google Talk: rs.ruggles@gmail.com
precrid wrote:
I'm a beginner in coding VB6 so if people want to give me hints or just help me a bit I would be thankfull. A tutorial would be nice but i can't ask that much.


The code I posted will probably work if you put it in Sub bltTile, which is in modGameLogic. That is of course assuming that your flags are in your tile set. Did you try the code at all? Or just assume that it wouldn't work because it's untested?

_________________
I'm on Facebook! Google Plus My Youtube Channel My Steam Profile

Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 31 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 16 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:  
Powered by phpBB® Forum Software © phpBB Group