Gamestudio Links
Zorro Links
Newest Posts
Old models with Mixamo animations
by rayp
Yesterday at 21:21
rayp's old school fast zombie FPS project
by rayp
Yesterday at 21:10
Votes for future features
by AndrewAMD
Yesterday at 18:08
Series within loop
by tradingest
Yesterday at 15:24
TMF info
by AndrewAMD
Yesterday at 15:24
text outline breiter machen?
by tagimbul
Yesterday at 12:26
Reset vars
by tradingest
Yesterday at 00:40
AUM Magazine
Latest Screens
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Evonet Beta v1.0 : Online Project Development Template
Lake scene
Who's Online
5 registered (Akow, RealSerious3D, AndrewAMD, thewalruss, 1 invisible), 442 Guests and 3 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
jiffdbf, jgtrader, Chefmac, BazGen, pallab1964
18079 Registered Users
Topic Options
Rate This Topic
#473636 - 07/30/18 21:23 Compass-Minimap same as Call of Duty 2
Ladlass Offline
Guest

Registered: 07/28/18
Posts: 4
Loc: istanbul
Hi guys, I am trying to make a minimap where the player is in the center and when we rotate the compass rotates too like cod2. But I couldn't make it, I am a newbie, I searched the forum but find nothing solid and useful, can you guys help me with example code or anything I can learn how to make my own.

Thanks

Top
#473639 - 07/31/18 06:56 Re: Compass-Minimap same as Call of Duty 2 [Re: Ladlass]
Dooley Offline
User

Registered: 05/12/05
Posts: 587
Loc: Chicago, IL
These are the resources I try to use, to the best of my ability, in order of priority:

The Manual
Template Scripts included in GStudio7 (or 8) folder
AUM Magazine (it has a lot of older C-Script code, but sometimes it can be easily converted to Lite-C)
Ask here on the forum once all other options have been attempted

Good luck!
_________________________
Check out "Star Explorers" on Steam:
http://store.steampowered.com/app/502720/Star_Explorers/

Anomalies released on Steam: http://store.steampowered.com/app/546780


Top
#473640 - 07/31/18 11:24 Re: Compass-Minimap same as Call of Duty 2 [Re: Dooley]
Ayumi Offline
User

Registered: 10/12/08
Posts: 638
Loc: Germany
First i would try make a Bitmap as BMP with a black cycle and only Text "N, S,W,E" (North, South, West, East) to test.

Than create a Panel with your Position and add this Bitmap to your Panel. Your Bitmap Needs same size in x and y or you Need to set Panel Center_x/Center_y.

Code:
PANEL* PanCompass = 
{
   bmap = bmap_create("Compass.bmp");
   pos_x = 0;
   pos_y = 0;
   flags |= SHOW;   
}





Put your Player in WED to any place.
In a while, you only Need to set "pan" from Player to your Panel.

Code:
while(1)
{
   PanCompass.angle = player.pan - 90; // test it...i only guess
   wait(1);
}



Think about, Panel.angle isn t same as players pan. That means, if Players pan is North, the Degree is 90, not 0.

The second part is calculate the position from Player.
If i have time, i will build an example.

Top
#473642 - 07/31/18 12:49 Re: Compass-Minimap same as Call of Duty 2 [Re: Ayumi]
Ladlass Offline
Guest

Registered: 07/28/18
Posts: 4
Loc: istanbul
Thank you so much Ayumi, that example for the position would be awesome if you have time.

Top
#473651 - 08/01/18 21:10 Re: Compass-Minimap same as Call of Duty 2 [Re: Ladlass]
Ayumi Offline
User

Registered: 10/12/08
Posts: 638
Loc: Germany
Here you are. Give your Entitys in WED skill 1 a counter (1,2,3...)
This example works with C_Scan, but you also can do it with vec_dist or c_trace in another while. C_scan is slow but easy to use.

Paint a Bitmap with 256 x 256 Pixel + Alpha Channel. This will be the Compass.
Paint a Bitmap with 256 x 256 Pixel + Alpha Channel (only Alpha). This will be your second Panel for your Entitys.
The second Panel is need, because maybe you later want rotate the pan of your Enemys too. In the first Panel it s not possible, because you also rotate this Panel.

I also need this Code, so later i will code a newer version without c_scan. So far.


Code:
// EntGroups
#define EntGroup skill1
#define TypeEnemy 1

#define EntGroupType skill2
#define Machine 1
#define People 2


var EntsPan[3];

PANEL* PanCompass = 
{
	bmap = "Compass.dds";
	pos_x = 10;
	pos_y = 10;
	layer = 1;
}

PANEL* PanCompassEnemys = 
{
	bmap = "CompassEnemy.dds";
	needle(22,22, "Enemy.pcx",8,8,0,0,360, EntsPan[0]);
	needle(22,22, "Enemy.pcx",8,8,0,0,360, EntsPan[1]);
	needle(22,22, "Enemy.pcx",8,8,0,0,360, EntsPan[2]);
	pos_x = 10;
	pos_y = 10;
	layer = 2;
}



action Enemy()
{
	my.emask |= ENABLE_SCAN;
}

void ScanEvent()
{
	if(event_type == EVENT_DETECT)
	{
		if(you != NULL)
		{
			// 5000 Quants Scanbereich
			// 256 Pixel beträgt die Bitmap
		
		  	var x = player.x - you.x;
		  	var y = player.y - you.y;
		  	var newX = 0;
		  	var newY = 0;
	   
		  	newX = abs(x);
		  	newY = abs(y)* -1;
		  	if(player.x > you.x)
		  	{
		  		newX = abs(x) * -1;
			}
		  
		   if(player.y > you.y)
		   {
		   	newY = abs(y) ;
			}
			
		  	var rangeX = (newX * 128) / 5000;
		  	var rangeY = (newY * 128) / 5000;
//		  	
//			printf("%f %f", (double)x, (double)y);
			pan_setpos(PanCompassEnemys, 6, you.EntGroup, vector(rangeX +128, rangeY+128, 0));							
		}
	}
}

void RotateCompassPan()
{	
	while(player)
	{
		PanCompass.angle = player.pan -90;
		wait(1);	
	}
}

void RotateCompass()
{
	while(player == NULL) wait(10);
	my = player;
	
	my.emask |= ENABLE_DETECT;
	my.event = ScanEvent;

	RotateCompassPan();

	wait(-2);
	
	while(player)
	{	
		c_scan(camera.x,camera.pan, vector(360,0,10000), IGNORE_ME | SCAN_ENTS | SCAN_LIMIT);
		wait(-0.5);
	}
}

void InitializeMinimap()
{
	PanCompass.flags = SHOW|TRANSLUCENT;
	PanCompass.center_x = PanCompass.size_x * 0.5;
	PanCompass.center_y = PanCompass.size_y * 0.5;
	PanCompassEnemys.flags = SHOW|TRANSLUCENT;

	RotateCompass();
}


Top
#473687 - 08/04/18 17:48 Re: Compass-Minimap same as Call of Duty 2 [Re: Ayumi]
Ladlass Offline
Guest

Registered: 07/28/18
Posts: 4
Loc: istanbul
Hi Ayumi, when I rotate the second pan, the needles of it won't rotate with the panel, they stay at the same position. Can you help?

Top
#473688 - 08/04/18 18:40 Re: Compass-Minimap same as Call of Duty 2 [Re: Ladlass]
Ayumi Offline
User

Registered: 10/12/08
Posts: 638
Loc: Germany
It s an Panel, you should take the online manual ,looking and learning yourself.

Panel -> Panel elements -> Needles ->
"Needles can not be displayed on rotated panels"

Top
#473690 - 08/05/18 00:30 Re: Compass-Minimap same as Call of Duty 2 [Re: Ayumi]
Ladlass Offline
Guest

Registered: 07/28/18
Posts: 4
Loc: istanbul
Thanks again, I made it as I wanted.

Top


Moderator:  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de