Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Colliding props
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#1
Colliding props

Hello everyone!

It's just a fast question: can I make that a lot of things (like 200 boxes) when collide with something, something happens?

I mean: can I do that without any "for"? If not, can I reset a "for"? Making a callback for every single box would be very tedious.

Something like:

AddEntityCollideCallback("Box"+, "asdf", "ASDF", false, -1);

This would be used for a great idea... Angel
Any replies will be useful! Big Grin

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
10-30-2012, 06:53 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: Colliding props

for(int p=1;p<201;p++) AddEntityCollideCallback("box"+_p, "AREA", "Collide", true, 1);

Trying is the first step to success.
(This post was last modified: 10-30-2012, 07:02 PM by FlawlessHappiness.)
10-30-2012, 07:02 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#3
RE: Colliding props

But, correct me if I'm wrong: "for" is something that repeats itself until arrives to a value, in this case 201. So, if the boxes collide 201 times, the function would be stopped.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
10-30-2012, 07:13 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: Colliding props

No Smile Or, i do not know exactly what it means, but if you do what i posted one of those boxes will trigger "Collide" when they collide with "AREA"

Trying is the first step to success.
10-30-2012, 07:24 PM
Find
ZodiaC Offline
Member

Posts: 120
Threads: 8
Joined: Oct 2012
Reputation: 2
#5
RE: Colliding props

(10-30-2012, 07:13 PM)The chaser Wrote: But, correct me if I'm wrong: "for" is something that repeats itself until arrives to a value, in this case 201. So, if the boxes collide 201 times, the function would be stopped.
Well in that case you could use a "do" loop I am not sure if it works the same way in angelscript but In C++ this is how it works:
do {

} while ( condition );

[Image: 2H1Mc.jpg]
(This post was last modified: 10-30-2012, 09:24 PM by ZodiaC.)
10-30-2012, 09:23 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#6
RE: Colliding props

(10-30-2012, 09:23 PM)ZodiaC Wrote:
(10-30-2012, 07:13 PM)The chaser Wrote: But, correct me if I'm wrong: "for" is something that repeats itself until arrives to a value, in this case 201. So, if the boxes collide 201 times, the function would be stopped.
Well in that case you could use a "do" loop I am not sure if it works the same way in angelscript but In C++ this is how it works:
do {

} while ( condition );
I don't know if that exists in Angel script, but, how does it work? An example, please Smile

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
(This post was last modified: 10-30-2012, 09:57 PM by The chaser.)
10-30-2012, 09:57 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#7
RE: Colliding props

A sticky area that denies all objects would allow you to use the area as if it were a script area with millions of entering (i.e. as if the last parameter is 1) collision callbacks linked to it. You could mimic exiting (i.e. as if the last parameter is -1), but not with the same sticky area.

Tutorials: From Noob to Pro
10-30-2012, 10:05 PM
Website Find
ZodiaC Offline
Member

Posts: 120
Threads: 8
Joined: Oct 2012
Reputation: 2
#8
RE: Colliding props

(10-30-2012, 09:57 PM)The chaser Wrote: I don't know if that exists in Angel script, but, how does it work? An example, please Smile
Actually it should exists cause it's one of the 3 loop commands(For,do,while)

Well in C++ it works like this:
int reply1;

do {
printf("Enter a 1.\n");
scanf("%d", &reply1);
} while (reply1 != 1);

I'm not sure if the C++ example is going to help you..

[Image: 2H1Mc.jpg]
11-01-2012, 02:20 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#9
RE: Colliding props

(11-01-2012, 02:20 PM)ZodiaC Wrote:
(10-30-2012, 09:57 PM)The chaser Wrote: I don't know if that exists in Angel script, but, how does it work? An example, please Smile
Actually it should exists cause it's one of the 3 loop commands(For,do,while)

Well in C++ it works like this:
int reply1;

do {
printf("Enter a 1.\n");
scanf("%d", &reply1);
} while (reply1 != 1);

I'm not sure if the C++ example is going to help you..
I know about Angel, but NOTHING of C++. Sorry Sad

Just an example in Angel script, please.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
11-01-2012, 02:42 PM
Find
ZodiaC Offline
Member

Posts: 120
Threads: 8
Joined: Oct 2012
Reputation: 2
#10
RE: Colliding props

(11-01-2012, 02:42 PM)The chaser Wrote: I know about Angel, but NOTHING of C++. Sorry Sad

Just an example in Angel script, please.
Ok I tried the "do" and the "while" commands with angle script and they worked perfectly
so I will try to explain them but I promise nothing..
Anyway the "do" command is executed at least one time and it syntax is this:

SetLocalVarInt("number", 0);
do
{
//All your commands goes here
AddLocalVarInt("number", 1); //It's necessary to change the number cause if you don't it will loop for ever
while (GetLocalVarInt("number") > 3) //this is where it checks .. if the number is less or equal to 3 the proccess will loop(goto "do") and check again...If the number is equal or bigger than 3 the loop will stop

That's the "do" command

The "while" commands it's the exact opposite of the "do" command!
It's checks in the begining and then loops
syntax:

SetLocalVarInt("number", 0);
while (GetLocalVarInt("number") <= 3) //This is where it checks..If it's less OR equal to 3 the loop will continue(or start) and come back here...
{
//All your commands goes here
AddLocalVarInt("number", 1); //It's necessary to change the number cause if you don't it will loop for ever
} //From here it goes to "while" command (goto while).

So if you look carefully you will notice that both of the commands are doing the exact same thing in this example...
they are ussualy used for searching arrays value.They should work exactly like in C++.
Anyway I hope you understood how they work...

[Image: 2H1Mc.jpg]
(This post was last modified: 11-01-2012, 04:19 PM by ZodiaC.)
11-01-2012, 04:03 PM
Find




Users browsing this thread: 1 Guest(s)