Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by dr_panther. 05/18/24 11:01
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (7th_zorro, dr_panther), 724 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Local Pointer ! [Re: mEnTaL] #343804
10/10/10 14:52
10/10/10 14:52
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
action ally()
{
if (my.status==attacking)
{................}
........
my.event=detect_target;
}

function detect_target ()
{
if (event_type == EVENT_DETECT)
{
if (you.skill2==1) // enemy detected
{
my.status=attacking;
my.parent = you;
}
}
}


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Local Pointer ! [Re: mEnTaL] #343805
10/10/10 15:16
10/10/10 15:16
Joined: Nov 2008
Posts: 216
J
jane Offline
Member
jane  Offline
Member
J

Joined: Nov 2008
Posts: 216
you can test this (no errors ... but work ???):

action ally()
{
if (my.status==attacking)
{................}
........
my.event=detect_target;
}

function detect_target ()
{
ENTITY*target1;
if (event_type == EVENT_DETECT)
{
if (you.skill2==1) // enemy detected
{
my.status=attacking; target1=you; }
}
}

Re: Local Pointer ! [Re: jane] #343806
10/10/10 15:18
10/10/10 15:18
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I'm sorry jane, but that's senseless because you cannot access the pointer from outside the event function.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Local Pointer ! [Re: Superku] #343812
10/10/10 15:51
10/10/10 15:51
Joined: Nov 2008
Posts: 216
J
jane Offline
Member
jane  Offline
Member
J

Joined: Nov 2008
Posts: 216
@Suprku

its right, the pointer is only in the event function useable.

its a way, give: ally 1 the skill5 = 1; ally 2 the skill5 = 2; ...

function detect_target ()
{
if (event_type == EVENT_DETECT)
{
if (you.skill2==1) // enemy detected
{
my.status=attacking; you.skill5 = my.skill5; }
}
}

and use the skill5 for the AI :

have the enemy now the skill5=2 search the ally with skill5=2 and attack
this one.

Re: Local Pointer ! [Re: jane] #343818
10/10/10 16:46
10/10/10 16:46
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
seems somewhat illogical to store an identifier on each skill,

if you need to use parent for anything else, store handles in the skills

Code:
#define ally skill5
ENTITY* get_ally(ENTITY* e){
	return(ptr_for_handle(e.ally));
}

void set_ally(ENTITY* e, ENTITY* a){
	e.ally = handle(a);
}

action ally_action(){
	set_ally(me, you); //store ally
	you = get_ally(me); //retrieve ally
}



Re: Local Pointer ! [Re: MrGuest] #343826
10/10/10 17:49
10/10/10 17:49
Joined: Jul 2009
Posts: 96
M
mEnTaL Offline OP
Junior Member
mEnTaL  Offline OP
Junior Member
M

Joined: Jul 2009
Posts: 96
@Superku I tried ur way, but how the NPC will have its own 'target1' pointer set to the detected entity ??

@jane Your method doesn't help because all allies must be identical, only their 'target1' pointer must be set to the entity detected by their event.

@MrGuest I could be wrong, but I think you haven't understood the problem. The Ally entity has its LOCAL pointer called target1 which must point to the entity detected by the "detect_target()" event.


Re: Local Pointer ! [Re: mEnTaL] #343827
10/10/10 17:53
10/10/10 17:53
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
"@Superku I tried ur way, but how the NPC will have its own 'target1' pointer set to the detected entity ??"

?
Replace "target1" simply with "my.parent", where's the problem?


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Local Pointer ! [Re: Superku] #343831
10/10/10 18:09
10/10/10 18:09
Joined: Jul 2009
Posts: 96
M
mEnTaL Offline OP
Junior Member
mEnTaL  Offline OP
Junior Member
M

Joined: Jul 2009
Posts: 96
Yes.. My mistake. That's exactly what I want. It works. 10x !

Page 2 of 2 1 2

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