Frictional Games Forum (read-only)

Full Version: Colliding props
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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
for(int p=1;p<201;p++) AddEntityCollideCallback("box"+_p, "AREA", "Collide", true, 1);
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.
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"
(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 );
(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
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.
(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..
(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.
(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...
Pages: 1 2