Frictional Games Forum (read-only)
[SOLVED/I GOT PM]Strange HPL function - 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: [SOLVED/I GOT PM]Strange HPL function (/thread-17970.html)



[SOLVED/I GOT PM]Strange HPL function - FlawlessHappiness - 08-26-2012

This is how it is set up in the HPL editor:

[Image: vseu8h.png]


The area has the properties:

Name: AreaPickUpItems
PlayerInteractCallback: PickUpItems
ItemInteraction: "Checked"


I tried making the whole script (That i wanted), but failed so here is the first part, which doesn't work...

Script

void OnStart()
{

SetLocalVarInt("PlacedHandDrill", 0);
SetLocalVarInt("PlacedPoisonGland", 0);
}


void AreaPickUpItems(string &in asEntity)
{
if(GetLocalVarInt("PlacedHandDrill") == 0 && GetLocalVarInt("PlacedPoisonGland") == 0)
{
SetMessage("Messages", "NothingOnPlatform", 0);
}
}

BUT what happens is that when i touch the area, instead of setting the message it collects the two inactive items!!?? Why is this happening?
If i touch the area again it collects the items again. And again. And again... It doesn't make sense to me...

Can anybody explain this? and maybe help me out?


RE: Strange HPL function - Adny - 08-27-2012

Based on what you've explained thus far and the script provided, I have no clue what you're trying to do. Please use explicit detail to describe exactly what you want to have happen in game, and I'll help to the fullest extent of my abilities


RE: Strange HPL function - FlawlessHappiness - 08-27-2012

What i was trying to do is:

In this custom story you are playing as 2 people.
1 of them has went down to get some items, and is now back with 2 items, a hand drill and a poison gland.

If you change to the other person the 2 items will disappear. If you change back they will reappear.

Now: The person with the items (Mark) has to give the items to the other person (Simon).

There is a platform above a big hole where he can put them.

SCRIPT:

if nothing is on the platform = Display: "There is nothing on the platform" (Already here it went wrong)

if use 1 item on the platform, item disappear from inventory, and appear (static) on platform.
if touch platform, (Playing as Simon) Static-item disappear and Simon gets the item.

You should be able to put both items on the platform. and be able to pick up both items at once.

Then when you have picked both items up, you shouldn't be able to put them back again.

I tried the first thing with displaying a message. Instead of displaying it, it picks up the 2 static, inactive items on the platform...


RE: Strange HPL function - Adny - 08-27-2012

One final question, how are you switching between player A and player B? Or is it more like player A does a task, then it switches to player B, he completes a task, then back and forth?


RE: Strange HPL function - FlawlessHappiness - 08-27-2012

You switch youself... i made a script.

Simplyfied script:

FadeOut(2)
AddTimer(Timer)

void Timer
TeleportPlayer
FadeIn
SetGlobalVarInt(PlayingAsMark, 1)
SetGlobalVarInt(PlayingAsSimon, 0)


RE: Strange HPL function - Adny - 08-27-2012

But how is it triggered? Collide, interact, or some other kind of callback?


RE: Strange HPL function - FlawlessHappiness - 08-27-2012

interact