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 Collide function issue
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#11
RE: Collide function issue

(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: (Select All)
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.


"Veni, vidi, vici."
"I came, I saw, I conquered."
09-18-2014, 09:04 AM
Find
MrBehemoth Offline
Senior Member

Posts: 408
Threads: 19
Joined: Feb 2014
Reputation: 40
#12
RE: Collide function issue

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

09-18-2014, 09:22 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#13
RE: Collide function issue

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.

09-18-2014, 09:24 AM
Find
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#14
RE: Collide function issue

(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.

09-18-2014, 09:31 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#15
RE: Collide function issue

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.

(This post was last modified: 09-18-2014, 09:59 AM by Mudbill.)
09-18-2014, 09:59 AM
Find
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#16
RE: Collide function issue

(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

(This post was last modified: 09-18-2014, 10:24 AM by Radical Batz.)
09-18-2014, 10:23 AM
Find
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#17
Sad  RE: Collide function issue

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: (Select All)
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: (Select All)
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

(This post was last modified: 09-18-2014, 02:22 PM by Radical Batz.)
09-18-2014, 02:09 PM
Find
burge4150 Offline
Member

Posts: 56
Threads: 15
Joined: Feb 2014
Reputation: 0
#18
RE: Collide function issue

Why don't you post the entire HPS file for the level you're working on?
(This post was last modified: 09-18-2014, 02:29 PM by burge4150.)
09-18-2014, 02:28 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#19
RE: Collide function issue

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)

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 09-18-2014, 02:31 PM by PutraenusAlivius.)
09-18-2014, 02:31 PM
Find
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#20
RE: Collide function issue

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

09-18-2014, 02:33 PM
Find




Users browsing this thread: 4 Guest(s)