Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,731 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
HELP with c_scan #136668
06/16/07 10:23
06/16/07 10:23
Joined: May 2007
Posts: 7
V
voswouter87 Offline OP
Newbie
voswouter87  Offline OP
Newbie
V

Joined: May 2007
Posts: 7
Hi guys,
I have some different entities in my game and I want the player to have an aura that affects entities nearby him.
So I want to have a scanner that determines whether units are nearby. So I use the c_scan function.
The only problem is that the 'you' pointer doesn't seem to work. When I try to do something with 'you' nothing happens. If I call it outside the player it will affect the player, but if I call it inside the player and use 'IGNORE_ME' other entities are ignored.

Please any help on using the c_scan function would be great!

Re: HELP with c_scan [Re: voswouter87] #136669
06/16/07 10:28
06/16/07 10:28
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
better use trigger
why.. because ponter "You" with c_scan has only effect with nearest entity
so if you want to make some explo or something... trigger will be better solution I think.
Cheers

edit: about c_scan...
the other entitys must be set with my.enable_scan = on; and then event_type = event_scan
or enable_detect = on; then event_detect

Last edited by tompo; 06/16/07 21:26.

Never say never.
HELP with setting entity events [Re: tompo] #136670
06/17/07 14:17
06/17/07 14:17
Joined: May 2007
Posts: 7
V
voswouter87 Offline OP
Newbie
voswouter87  Offline OP
Newbie
V

Joined: May 2007
Posts: 7
The scan works now, I can do things with entities using 'you', the entities don't know it when they are detected though.
I did use enable scan and detect, neither work.
I also tried with my.event = event_scan; with 'event_scan' being a function. But that didn't work.
There is a text in gamestudio command help saying something about 'the wrong way to set entity events'. But that is explained nowere.

Any information on 'the right way to set entity events' is greatly appreciated.

Re: HELP with setting entity events [Re: voswouter87] #136671
06/17/07 23:32
06/17/07 23:32
Joined: Sep 2002
Posts: 700
Orange County, CA
L
LogantheHogan Offline
Developer
LogantheHogan  Offline
Developer
L

Joined: Sep 2002
Posts: 700
Orange County, CA
The only thing that it says in the manual about "the wrong way to set events" is that you should use my.event = event_scan; instead of my.event = event_scan(); So that doesn't seem to be your problem. Could you maybe post your code so we can get the "big picture"?

Re: HELP with setting entity events [Re: LogantheHogan] #136672
06/20/07 09:24
06/20/07 09:24
Joined: May 2007
Posts: 7
V
voswouter87 Offline OP
Newbie
voswouter87  Offline OP
Newbie
V

Joined: May 2007
Posts: 7
Thanks for any help, I could not show the code because of internet problems, but here it is:

I get the texts 'ready' and 'scanning', and for the first second or so I get the text 'found something', but that should be a constant text. I never get the text 'scanned'.

The building action
enable_scan = on;
while(1)
{
// now the building should animate, but it has no life animation
draw_text("ready", 380, 285, vector(255,255,255));
if (event_type == event_scan) // the building has been scanned
{
draw_text("scanned", 380, 275, vector(255,255,255));
in_area = true; // so the building is in area of effect
}
else // wait with this until the scan works
{ in_area = false; }
wait(1);
}

Is being called by the player entity every frame:
function scanner()
{
vec_set(player_pos, vector(player.x - 4, player.y, player.z)); // start scan from the player pos
found = c_scan(player_pos, player.pan, vector(360,1,area_size), // scan a full circle for area size
SCAN_ENTS | SCAN_LIMIT | IGNORE_ME | IGNORE_YOU); // don't scan player, last scanned

draw_text("scanning", 380, 315, vector(255,255,255));

if (found > 0)
{
draw_text("found something", 380, 305, vector(255,255,255));
}
}
edit: more complete

Last edited by voswouter87; 06/20/07 14:55.
Re: HELP with setting entity events [Re: voswouter87] #136673
06/20/07 22:33
06/20/07 22:33
Joined: Sep 2002
Posts: 700
Orange County, CA
L
LogantheHogan Offline
Developer
LogantheHogan  Offline
Developer
L

Joined: Sep 2002
Posts: 700
Orange County, CA
Hmm. I'm not sure what the problem is, but try instead turning the player's enable_detect flag on and then if(event_type == event_detect && you == whoever) { do your stuff; }, within the player's event. I don't know if it'll help but it may.


Moderated by  HeelX, Spirit 

Gamestudio download | 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