Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
4 registered members (fogman, Grant, AndrewAMD, juanex), 989 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
how to get a pointer from a clicked entity? #389623
12/16/11 13:16
12/16/11 13:16
Joined: Dec 2011
Posts: 5
C
Conscript Offline OP
Newbie
Conscript  Offline OP
Newbie
C

Joined: Dec 2011
Posts: 5
my problem is when i click my entity(man), it recognizes that he was clicked. But when I click a location from the ground, it doesn't go when the location that I'd clicked.

the codes in the while()loop doesn't works so I'd erased it.
here:

ENTITY* entModel;
function scan_ent()
{
if (mouse_ent)
{
entModel = mouse_ent;
vec_set(mat_model.ambient_green,vector(155,0,0));


while(entModel==you)
{
.......
}
}
}



action play_walk() //animation of "walk" for this entity
{
enable_mouse = 2;
my.emask |= ENABLE_CLICK;
my.event = scan_ent;
entModel = me;

while(1)
{
walk_percent += 3*time_step ;
ent_animate(me,"walk",walk_percent,ANM_CYCLE);
wait(1);
}
}

and one thing, i'm a beginner in this language. please help thx

Re: how to get a pointer from a clicked entity? [Re: Conscript] #389627
12/16/11 13:25
12/16/11 13:25
Joined: Jul 2005
Posts: 187
L
lostzac Offline
Member
lostzac  Offline
Member
L

Joined: Jul 2005
Posts: 187
If I am understanding what you are trying to do is get your man to move to the position that you click...If so read up on Aum 34...You will have to update the code to fit your version of GS..but it should give you the basic understanding of how to do it....


John C Leutz II

Re: how to get a pointer from a clicked entity? [Re: lostzac] #389630
12/16/11 13:32
12/16/11 13:32
Joined: Dec 2011
Posts: 5
C
Conscript Offline OP
Newbie
Conscript  Offline OP
Newbie
C

Joined: Dec 2011
Posts: 5
i see it.. thank you sir
grin

Re: how to get a pointer from a clicked entity? [Re: Conscript] #389632
12/16/11 13:45
12/16/11 13:45
Joined: Jul 2005
Posts: 187
L
lostzac Offline
Member
lostzac  Offline
Member
L

Joined: Jul 2005
Posts: 187
Not an issues glad I could help


John C Leutz II

Re: how to get a pointer from a clicked entity? [Re: Conscript] #389633
12/16/11 13:45
12/16/11 13:45
Joined: Dec 2011
Posts: 5
C
Conscript Offline OP
Newbie
Conscript  Offline OP
Newbie
C

Joined: Dec 2011
Posts: 5
sir...what version does in this AUM 34? A6 or A7?
because i'm using A7..

Re: how to get a pointer from a clicked entity? [Re: Conscript] #389634
12/16/11 13:49
12/16/11 13:49
Joined: Jul 2005
Posts: 187
L
lostzac Offline
Member
lostzac  Offline
Member
L

Joined: Jul 2005
Posts: 187
Laugh I think its all the way back to A5....It is not that hard to update the code...If you would like I can do it for ya real quick


John C Leutz II

Re: how to get a pointer from a clicked entity? [Re: lostzac] #389636
12/16/11 13:56
12/16/11 13:56
Joined: Dec 2011
Posts: 5
C
Conscript Offline OP
Newbie
Conscript  Offline OP
Newbie
C

Joined: Dec 2011
Posts: 5
Haha..really? The only problem about creating my game is this mouse event for entities..
can you help me about this mouse event?

Re: how to get a pointer from a clicked entity? [Re: Conscript] #389639
12/16/11 14:08
12/16/11 14:08
Joined: Jul 2005
Posts: 187
L
lostzac Offline
Member
lostzac  Offline
Member
L

Joined: Jul 2005
Posts: 187
Hmmm I thought I replied to this....Yeah pm me with what you want and Ill be glad to help


John C Leutz II

Re: how to get a pointer from a clicked entity? [Re: lostzac] #389719
12/17/11 14:25
12/17/11 14:25
Joined: Dec 2009
Posts: 128
China
frankjiang Offline
Member
frankjiang  Offline
Member

Joined: Dec 2009
Posts: 128
China
hey ,Conscript , this is my game project`s code, you can read it and know how to click any entity.
Code:
void mouseEvent()
{
	STRING* _s = NULL;
	C_LINK* _link = NULL;
	PANEL* p = NULL;
	ENTITY* ent = NULL;
	while(1)
	{
		if (mouse_left) // left button pressed over panel?
		{
			p = mouse_panel;
			if(p!=NULL)
			{
				_link = &(p->link);
				if(_link->name != NULL )
				{
					_s = str_create(_link->name);
					
					if(str_cmp(_s,Name_InputText1) == 1 )
					{
                        lockTextCom(0);
					}
                    else if(str_cmp(_s,Name_PickPanel1) == 1 )
                    {  
                        lockTextCom(1);
                    }
					ptr_remove(_s);		
				}
			}

			ent = mouse_ent;
			if(ent!=NULL)
			{            
				_link =  &(ent->link);
				if(_link->name != NULL )
				{
					_s = str_create(_link->name);
					if(str_cmp(_s,Name_Role1) == 1)
					{
                        logS("you hit role by mouse left");    
					}
					ptr_remove(_s);		
				}
			}	
		}
		wait(1);
	}  
}




development 3d game is interesting!
Re: how to get a pointer from a clicked entity? [Re: frankjiang] #389860
12/19/11 05:11
12/19/11 05:11
Joined: Dec 2011
Posts: 5
C
Conscript Offline OP
Newbie
Conscript  Offline OP
Newbie
C

Joined: Dec 2011
Posts: 5
hey... something's wrong...
i'd check the action.. because the error says "Crash in unit SYS"

action unit() //animation of "walk" for this entity
{
my.emask |= ENABLE_CLICK;
my.event = scan_ent;

attack_percent += 3*time_step;
ent_animate(me,"attack",attack_percent,ANM_CYCLE);
while(1)
{
if(my.move == 1)
{
walk_percent += 3*time_step ;
ent_animate(me,"walk",walk_percent,ANM_CYCLE);
c_move(me,vector(Distance,0,0),vector(0,0,0),IGNORE_PASSABLE | GLIDE);

if(vec_dist(Distance.x,my.x) < 10)
{
my.move = 0;
}
}
wait(1);
}
}

here in triggers the error

but when I removed this part

if(vec_dist(Distance.x,my.x) < 10)
{
my.move = 0;
}

the error disappeared.. when i click the entity, it plays the animation. But there's an error again in clicking the ground..
when i click the ground after I'd click the entity... the game doesn't respond..

what is the meaning of this?

if(vec_dist(Distance.x,my.x) < 10)
{
my.move = 0;
}


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