Gamestudio Links
Zorro Links
Newest Posts
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
1 registered members (AndrewAMD), 1,089 guests, and 2 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
Have player pick up coins?? #350549
12/16/10 22:24
12/16/10 22:24
Joined: Sep 2010
Posts: 42
NS, Canada
gSet Offline OP
Newbie
gSet  Offline OP
Newbie

Joined: Sep 2010
Posts: 42
NS, Canada
I know this seems like an absolutely trivial issue, but no matter how much reading I do in the manual or on the boards, or how many different things I try, I can't seem to make this work. All I want to do is make the player able to pick up a coin, such that when the player touches a coin an event is called. I've tried having the coins c_scan for the player, as well as the other way around. I've tried having the coin c_rotate with ENABLE_IMPACT so that the event is called, but the event is called as soon as the coins are created. What could I do to make this work? It should be so simple! If someone can show me what code to use, there won't be any room for stupid mistakes on my part wink


"If it's true what you say to me, that the whole world will mourn his death - If the whole world will weep, I will give him back his breath."
Re: Have player pick up coins?? [Re: gSet] #350551
12/16/10 22:40
12/16/10 22:40
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
L
Liamissimo Offline
Serious User
Liamissimo  Offline
Serious User
L

Joined: Jul 2009
Posts: 1,198
Berlin, Germany
Code:
action coin()
{
	while(me)
	{
		c_scan(my.x,my.pan,vector(360,360,75),IGNORE_ME);
		if(you == player)
		{
			coins += 1;
			ent_remove(me);
		}
		wait(1);
	}
}



Just take this as action an add it to the coin, coins is the variable vor the coins that the player have, c_scan scans for the player, type in the script of your player
Code:
player = me;



For further questions ask laugh


"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen."
-JCL, 2011
Re: Have player pick up coins?? [Re: Liamissimo] #350588
12/17/10 11:22
12/17/10 11:22
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
Originally Posted By: TheLiam
Code:
action coin()
{
	while(me)
	{
		c_scan(my.x,my.pan,vector(360,360,75),IGNORE_ME);
		if(you == player)
		{
			coins += 1;
			ent_remove(me);
		}
		wait(1);
	}
}



Just take this as action an add it to the coin, coins is the variable vor the coins that the player have, c_scan scans for the player, type in the script of your player
Code:
player = me;



For further questions ask laugh
I wouldn't use c_scan for each coin, it'd be better on FPS using
vec_dist(my.x, player.x)
and also in the action have a
while(!player){wait(1);}
otherwise you'll be having a few errors along the way

Re: Have player pick up coins?? [Re: MrGuest] #350589
12/17/10 11:33
12/17/10 11:33
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline
User
badapple  Offline
User

Joined: Apr 2006
Posts: 624
DEEP 13
you dont need a while loop for such things , especially one running a c scan every frame.

a simple enable impact should do just fine , and its event function can check to see if it was the player who collided

enable impact does not require a while loop running.

Re: Have player pick up coins?? [Re: badapple] #350590
12/17/10 11:36
12/17/10 11:36
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
L
Liamissimo Offline
Serious User
Liamissimo  Offline
Serious User
L

Joined: Jul 2009
Posts: 1,198
Berlin, Germany
enable impact isn't good for collecting things, you don't want to collide with every coin you are collecting do you? wink


"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen."
-JCL, 2011
Re: Have player pick up coins?? [Re: Liamissimo] #350934
12/20/10 14:29
12/20/10 14:29
Joined: Sep 2010
Posts: 42
NS, Canada
gSet Offline OP
Newbie
gSet  Offline OP
Newbie

Joined: Sep 2010
Posts: 42
NS, Canada
Thanks a bunch! It seems so similar to what I'd been doing that I'm not sure what wasn't working, but with a couple of slight modifications this does exactly what I needed it to. The way it's set up, when you grab a coin your pos and the pos of all the coins are randomized (I know it sounds like a crappy game... It's for research lol), and so I had to remove all the coins, randomize the position array, and the player pos, and replace them all. I didn't realize that c_scan modified you, so that's actually extremely useful - I'd been using emask.


"If it's true what you say to me, that the whole world will mourn his death - If the whole world will weep, I will give him back his breath."

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