Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Nymphodora, Quad), 923 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Compass-Minimap same as Call of Duty 2 #473636
07/30/18 19:23
07/30/18 19:23
Joined: Jul 2018
Posts: 4
istanbul
L
Ladlass Offline OP
Guest
Ladlass  Offline OP
Guest
L

Joined: Jul 2018
Posts: 4
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

Re: Compass-Minimap same as Call of Duty 2 [Re: Ladlass] #473639
07/31/18 04:56
07/31/18 04:56
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
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!

Re: Compass-Minimap same as Call of Duty 2 [Re: Dooley] #473640
07/31/18 09:24
07/31/18 09:24
Joined: Oct 2008
Posts: 679
Germany
Ayumi Offline
User
Ayumi  Offline
User

Joined: Oct 2008
Posts: 679
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.

Re: Compass-Minimap same as Call of Duty 2 [Re: Ayumi] #473642
07/31/18 10:49
07/31/18 10:49
Joined: Jul 2018
Posts: 4
istanbul
L
Ladlass Offline OP
Guest
Ladlass  Offline OP
Guest
L

Joined: Jul 2018
Posts: 4
istanbul
Thank you so much Ayumi, that example for the position would be awesome if you have time.

Re: Compass-Minimap same as Call of Duty 2 [Re: Ladlass] #473651
08/01/18 19:10
08/01/18 19:10
Joined: Oct 2008
Posts: 679
Germany
Ayumi Offline
User
Ayumi  Offline
User

Joined: Oct 2008
Posts: 679
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();
}


Re: Compass-Minimap same as Call of Duty 2 [Re: Ayumi] #473687
08/04/18 15:48
08/04/18 15:48
Joined: Jul 2018
Posts: 4
istanbul
L
Ladlass Offline OP
Guest
Ladlass  Offline OP
Guest
L

Joined: Jul 2018
Posts: 4
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?

Re: Compass-Minimap same as Call of Duty 2 [Re: Ladlass] #473688
08/04/18 16:40
08/04/18 16:40
Joined: Oct 2008
Posts: 679
Germany
Ayumi Offline
User
Ayumi  Offline
User

Joined: Oct 2008
Posts: 679
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"

Re: Compass-Minimap same as Call of Duty 2 [Re: Ayumi] #473690
08/04/18 22:30
08/04/18 22:30
Joined: Jul 2018
Posts: 4
istanbul
L
Ladlass Offline OP
Guest
Ladlass  Offline OP
Guest
L

Joined: Jul 2018
Posts: 4
istanbul
Thanks again, I made it as I wanted.


Moderated by  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

Powered by UBB.threads™ PHP Forum Software 7.7.1