![]() |
[SCRIPT] Colliding props - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: [SCRIPT] Colliding props (/thread-18991.html) Pages:
1
2
|
Colliding props - The chaser - 10-30-2012 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... ![]() Any replies will be useful! ![]() RE: Colliding props - FlawlessHappiness - 10-30-2012 for(int p=1;p<201;p++) AddEntityCollideCallback("box"+_p, "AREA", "Collide", true, 1); RE: Colliding props - The chaser - 10-30-2012 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. RE: Colliding props - FlawlessHappiness - 10-30-2012 No ![]() RE: Colliding props - ZodiaC - 10-30-2012 (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 ); RE: Colliding props - The chaser - 10-30-2012 (10-30-2012, 09:23 PM)ZodiaC Wrote:I don't know if that exists in Angel script, but, how does it work? An example, please(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: ![]() RE: Colliding props - Your Computer - 10-30-2012 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. RE: Colliding props - ZodiaC - 11-01-2012 (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, pleaseActually 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.. RE: Colliding props - The chaser - 11-01-2012 (11-01-2012, 02:20 PM)ZodiaC Wrote:I know about Angel, but NOTHING of C++. Sorry(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, pleaseActually it should exists cause it's one of the 3 loop commands(For,do,while) ![]() Just an example in Angel script, please. RE: Colliding props - ZodiaC - 11-01-2012 (11-01-2012, 02:42 PM)The chaser Wrote: I know about Angel, but NOTHING of C++. SorryOk 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... |