Frictional Games Forum (read-only)
[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


RE: Collide function issue - PutraenusAlivius - 09-18-2014

(09-18-2014, 08:44 AM)Mudbill Wrote:
(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.

If Player is in the area, GivePlayerDamage 10, with a looping timer until he dies.

GetEntitiesCollide doesn't support Player. How do you propose this can be done?

Dammit, I should of given more info.

Spoiler below!

Okay, make a big area that covers the hallway. Put an AddEntityCollideCallback function to that area. When the Player collides, execute this:
PHP Code:
if(alState == 1)
{
AddTimer("r"5.0f"r");


The action in that alState function should be the looping timer that loops every n seconds and when the Player exits the area (that is if he does exit) remove the timers.




RE: Collide function issue - MrBehemoth - 09-18-2014

Badcat, try adding the callback after you enable the area, not in OnStart().


RE: Collide function issue - Mudbill - 09-18-2014

That does sound like it could work well.

On another note, I feel like this thread has kinda skewed from the original problem though. Yes, these are alternative solutions, but if what he wanted was a certain "wall of death" that follows the player, then these suggestions work more like a "slow death within an area" sorta thing. Kinda like poison. It might work in his situation, but it might also not.


RE: Collide function issue - Radical Batz - 09-18-2014

(09-18-2014, 09:24 AM)Mudbill Wrote: That does sound like it could work well.

On another note, I feel like this thread has kinda skewed from the original problem though. Yes, these are alternative solutions, but if what he wanted was a certain "wall of death" that follows the player, then these suggestions work more like a "slow death within an area" sorta thing. Kinda like poison. It might work in his situation, but it might also not.

Yes just as Mudbill said, it's some sorta like a wall of death like areas one after another are following you if you don't make it in time, and if you collide with them you die.

I really don't like the idea where you keep getting hurt as you mentioned Romulator cause it really won't be fair to the player :/ even if it won't deal too much damage at all.


RE: Collide function issue - Mudbill - 09-18-2014

How about making a custom entity?

Use the technical box as the mesh, make it invisible, then set it to a MoveObject. Have it move and pass through entities in the hallway. Perhaps that can trigger a collision on the player if these two happen to touch each other. Don't forget a collision box and remember, you can still see it in debug mode with inspection on.


RE: Collide function issue - Radical Batz - 09-18-2014

(09-18-2014, 09:59 AM)Mudbill Wrote: How about making a custom entity?

Use the technical box as the mesh, make it invisible, then set it to a MoveObject. Have it move and pass through entities in the hallway. Perhaps that can trigger a collision on the player if these two happen to touch each other. Don't forget a collision box and remember, you can still see it in debug mode with inspection on.

That's a good idea and might work Smile
I will try it as soon as I get back after I need to take a shower, thank you for the idea Mudbill I can't believe I haven't thought of that Blush


RE: Collide function issue - Radical Batz - 09-18-2014

Guys move box doens't work, mr. behimoth's suggestion didn't work :/

I don't know what's causing this really, I tried setting some areas active, then when I collide with them, still does nothing, hmm the script is perfectly fine tho, even if I tried this.

PHP Code:
AddEntityCollideCallback("Player""ScriptArea_4""Diecollide"false1); 
    
AddEntityCollideCallback("Player""ScriptArea_6""Diecollide"false1);
    
AddEntityCollideCallback("Player""ScriptArea_7""Diecollide"false1);
    
AddEntityCollideCallback("Player""ScriptArea_8""Diecollide"false1);
    
AddEntityCollideCallback("Player""ScriptArea_9""Diecollide"false1);
    
AddEntityCollideCallback("Player""ScriptArea_10""Diecollide"false1);
    
AddEntityCollideCallback("Player""ScriptArea_11""Diecollide"false1);
    
AddEntityCollideCallback("Player""ScriptArea_12""Diecollide"false1);
    
AddEntityCollideCallback("Player""ScriptArea_13""Diecollide"false1);
    
AddEntityCollideCallback("Player""ScriptArea_14""Diecollide"false1); 

PHP Code:
void Diecollide(string &in asParentstring &in asChildint alState
{    
    
AddPlayerHealth(-200);
    
AddDebugMessage("SOMETHING SOMETHING"false);


which still doesn't do a damn thing. the hell?

I can't take it anymore!

I tried making the player collide with the statue which works but not the area, Is it wrong to have a script area false and getting active cause I don't get it 0_0


RE: Collide function issue - burge4150 - 09-18-2014

Why don't you post the entire HPS file for the level you're working on?


RE: Collide function issue - PutraenusAlivius - 09-18-2014

If I remember this right, functions given to an inactive area won't do anything. I think you need to activate them first then give them the function. (Ex. AreaB is inactive. You activate AreaB then add a short timer which tells AreaB to do x activity)


RE: Collide function issue - Radical Batz - 09-18-2014

Good morning everybody i would love to tell you what caused it not to work which is the world's stupidest thing?

Well.... I had to change the stupid name of the area, like what is wrong by having it the vanilla name? "ScriptArea_1"? Oh well it's how hpl2 works but at least i got this piece of shit working by the world's stupidest way.

Thank you guys for helping me and and all of your hard work. Big Grin