![]() |
[SCRIPT] Collide function issue - 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] Collide function issue (/thread-26190.html) Pages:
1
2
|
Collide function issue - Radical Batz - 09-17-2014 Hello everybody on the forum, this is me Badcat with another stupid problem that never works. So the problem here is that I made tons of script areas which goes active in a certian timer, every 1 second a script area appears one after another. Like so ![]() Now when the player collides with the area, it should kill him instantly but ofc everything bad happens to me so it doesn't work. I also made this in void OnStart PHP Code: for(int i=1; i<=28; ++i) AddEntityCollideCallback("Player", "ScriptArea_"+i, "Diecollide", false, 1); PHP Code: void Diecollide(string &in asParent, string &in asChild, int alState) Of what will happen when the player collides with the certain area. I also added a debug message to the script but still nothin, guess what?? The debug message doesn't appear cause hpl2 hates me. So if you guys could help me solve the problem or not then thnx, idk and I can't find a problem like always. I tried help from Flawless, Neelke, Lazzer but we couldn't find it so if you guys do then peace and thnx :p RE: Collide function issue - Daemian - 09-18-2014 Hey. I think you can't declare a collide callback on a disabled area. They are sad because you disabled them, so they won't take any code from you. :D Try that, if that's the problem, you should declare the callback along with the timer after it enables the area. edit: By 'along with the timer', I mean to include that portion of code into the function that is called by the timer you mentioned. RE: Collide function issue - burge4150 - 09-18-2014 A little bug I've found when referencing script areas (or items) through for loop variables: Yours: PHP Code: for(int i=1; i<=28; ++i) AddEntityCollideCallback("Player", "ScriptArea_"+i, "Diecollide", false, 1); The way that I have to do it to make it work: PHP Code: for(int i=1; i<=28; ++i) AddEntityCollideCallback("Player", "ScriptArea_"+i+"", "Diecollide", false, 1); (One other thing - I've never included the "int" in the for loop declaration. Not sure if that's the issue or not because I'm not familiar with it.) Note the change in ScriptArea"+i, adding the second + and empty quotes "" has fixed this same issue for me multiple times. Give it a shot and let me know. I'm pretty sure this will fix things for you. For further reference, one of my own functions to do something exactly the same: PHP Code: void InitAreas() RE: Collide function issue - i3670 - 09-18-2014 Try PHP Code: for(int i=1;i<=28;i++){ RE: Collide function issue - Mudbill - 09-18-2014 I don't think this is necessarily a bug, as you guys have put it. It might just be the fact that the callback is triggered "OnEnter" of the area (state 1). If you're already in the area when it activates, I don't think it counts as entering it. Also, why not just use GivePlayerDamage? I don't see why you add a negative value instead. Of course it might work, but I expect this script to be favorable. RE: Collide function issue - Radical Batz - 09-18-2014 (09-18-2014, 01:44 AM)Daemian Wrote: Hey. I think you can't declare a collide callback on a disabled area. As I said the areas goes active one after another by a loop timer. Both i3670 and Burge's scripts doesn't work ![]() RE: Collide function issue - PutraenusAlivius - 09-18-2014 Can't you just make a big area that covers the whole hallway, then use a script to check if the Player is in them, use GivePlayerDamage with timer so that the Player would be given damage per second. If Player is in the area, GivePlayerDamage 10, with a looping timer until he dies. RE: Collide function issue - Mudbill - 09-18-2014 (09-18-2014, 08:15 AM)First Captain Wrote: Can't you just make a big area that covers the whole hallway, then use a script to check if the Player is in them, use GivePlayerDamage with timer so that the Player would be given damage per second. GetEntitiesCollide doesn't support Player. How do you propose this can be done? RE: Collide function issue - Wapez - 09-18-2014 Did you try to just change AddPlayerHealth(-200); to GivePlayerDamage(100, "BloodSplat", true, true); ? RE: Collide function issue - Radical Batz - 09-18-2014 (09-18-2014, 08:51 AM)Wapez Wrote: Did you try to just change Yup, i really don't know how to fix this, the debug message ain't even appearing so something ain't right, the health system is not the problem. :/ |