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
[CLOSED] Sticky Areas Not Working
theyhunger Offline
Junior Member

Posts: 15
Threads: 6
Joined: Jul 2017
Reputation: 0
#1
[CLOSED] Sticky Areas Not Working

I have "used" the cogwheel puzzle from Dungeon - Justine but changed it so you need to find all three cogwheels instead of just one for the puzzle. In-game, the first cogwheel does stick to that area but the other two does not. I don't understand why it's not working so maybe whoever is reading this can help me out. If you need information on the, here are some screenshots. Thanks!

https://imgur.com/a/UmQTA

If that doesn't work, the Sticky Area goes as follows:
MoveBody (tick)
RotateBody (tick)
PoseTime (0.5)
AttachableBodyName (elevator_cogwheel01_1_Body)
AttachFunction (StartFixMachineTimer)
AttachSound (13_attach_wheel.snt)
AttachPS (ps_hit_metal.ps)


And the code goes as follows:
void StartFixMachineTimer(string &in asEntityName, string &in asBodyName)
{
AddLocalVarInt("CogsPlaced", 1);

if(GetLocalVarInt("CogsPlaced")==3){

//Just incase setting a stick on/off after something is stuck is not a good idea.
SetEntityActive("AreaCloseToMachine", false);

AddTimer("", 1.0f, "FixMachine");

//AddDebugMessage("Make some time until cog is in place...", false);
}
}

void FixMachine(string &in asTimer)
{
PlaySoundAtEntity("run1", "L03_machine_run", "AreaMachineSound", 2.0f, false);
PlaySoundAtEntity("run2", "L03_machine_extra", "AreaMachineSound", 2.0f, false);
PlaySoundAtEntity("start", "13_ignite", "AreaMachineSound", 0.2f, false);

RotatePropToSpeed("cogwheel01", 1, 1, -1, 0, 0, false, "");
RotatePropToSpeed("cogwheel02", 1, 1, 1, 0, 0, false, "");
RotatePropToSpeed("cogwheel03", 1, 1, -1, 0, 0, false, "");

RotatePropToSpeed("elevator_machine_cog_small_5", 1, 1, 1, 0, 0, false, "");
RotatePropToSpeed("elevator_machine_cog_small_4", 1, 2, -2, 0, 0, false, "");
RotatePropToSpeed("elevator_machine_cog_small_6", 1, 1, 1, 0, 0, false, "");
RotatePropToSpeed("elevator_machine_cog_small_7", 1, 2, -2, 0, 0, false, "");

RotatePropToSpeed("elevator_machine_cog_small_2", 1, 1, 0, 0, 1, false, "");
RotatePropToSpeed("elevator_machine_cog_small_3", 1, 2, 0, 0, -2, false, "");
RotatePropToSpeed("elevator_machine_cog_small_1", 1, 1, 0, 0, 1, false, "");

RotatePropToSpeed("elevator_machine_cog_small_8", 1, 1, 1, 0, 0, false, "");
RotatePropToSpeed("elevator_machine_cog_small_9", 1, 2, -2, 0, 0, false, "");
RotatePropToSpeed("elevator_machine_cog_small_10", 1, 1, 1, 0, 0, false, "");
RotatePropToSpeed("elevator_machine_cog_small_11", 1, 2, -2, 0, 0, false, "");

RotatePropToSpeed("cogwheel_large_3", 0.6, 0.6f, 0, 0, 1, false, "");
RotatePropToSpeed("cogwheel_medium_6", 1, 1, 0, 0, -1, false, "");
RotatePropToSpeed("cogwheel_medium_7", 1, 1, 0, 0, 1, false, "");

RotatePropToSpeed("cogwheel_medium_3", 1, 1, 1, 0, 0, false, "");
RotatePropToSpeed("cogwheel_medium_4", 1, 1, -0.8, -0.2, 0, false, "");
RotatePropToSpeed("cogwheel_medium_5", 1, 1, 0.3, 0.6, 0, false, "");

RotatePropToSpeed("cogwheel_large_1", 0.6, 0.6, 0, -1, 0, false, "");
RotatePropToSpeed("cogwheel_large_2", 0.6, 0.6, 0, 1, 0, false, "");
RotatePropToSpeed("cogwheel_medium_1", 1, 1, 0, -1, 0, false, "");
RotatePropToSpeed("cogwheel_medium_2", 1, 1, 0, 1, 0, false, "");

//AddDebugMessage("Cogwheel in place, starting machine!", false);

SetLocalVarInt("MachineFixed", 1);
}

P.S. the names of the Sticky Areas are just simply StickyArea_1-3.
The only difference between the three sticky areas is that the attachable body name is slightly different. It changes from elevator_cogwheel01_1_Body to elevator_cogwheel02_1_Body and elevator_cogwheel03_1_Body.

If you need any more info or screenshots, let me know! Smile
(This post was last modified: 04-15-2018, 12:27 PM by theyhunger.)
04-13-2018, 05:04 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: Sticky Areas Not Working

The only thing that determines whether an entity can attach to the area is its name.

You need to be 100% sure that the attachable body names match the names of the entities.
I would recommend renaming them to something much shorter than what they are right now, to counteract mistakes.

Try naming the cogwheels "cog_1", "cog_2" and "cog_3", and at the same time, renaming the attachable body names in the sticky areas to the appropriate name.

Trying is the first step to success.
(This post was last modified: 04-14-2018, 10:52 PM by FlawlessHappiness.)
04-14-2018, 10:51 PM
Find
theyhunger Offline
Junior Member

Posts: 15
Threads: 6
Joined: Jul 2017
Reputation: 0
#3
RE: Sticky Areas Not Working

(04-14-2018, 10:51 PM)FlawlessHappiness Wrote: The only thing that determines whether an entity can attach to the area is its name.

You need to be 100% sure that the attachable body names match the names of the entities.
I would recommend renaming them to something much shorter than what they are right now, to counteract mistakes.

Try naming the cogwheels "cog_1", "cog_2" and "cog_3", and at the same time, renaming the attachable body names in the sticky areas to the appropriate name.

Thanks for the suggestion but it didn't work, I renamed the cogs to cog01-02-03, same for the attachable names but to no avail. :/
04-15-2018, 09:03 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#4
RE: Sticky Areas Not Working

Open up your cogwheel in the Model Editor. Since it is asking for a Body, make sure you are referencing the Body of the cogwheel by name in your Sticky Area properties. It will be a green box of some sort surrounding the cogwheel. Then your code should be "<Cogwheel>_<Body>".

Discord: Romulator#0001
[Image: 3f6f01a904.png]
04-15-2018, 10:45 AM
Find
theyhunger Offline
Junior Member

Posts: 15
Threads: 6
Joined: Jul 2017
Reputation: 0
#5
RE: Sticky Areas Not Working

(04-15-2018, 10:45 AM)Romulator Wrote: Open up your cogwheel in the Model Editor. Since it is asking for a Body, make sure you are referencing the Body of the cogwheel by name in your Sticky Area properties. It will be a green box of some sort surrounding the cogwheel. Then your code should be "<Cogwheel>_<Body>".

Thanks Romulator but I've decided to just use one of the cogwheels instead of three (I can use three for the elevator). Since the first one works, I'll just use that instead (so it will be like Justine). Thanks anyways! Smile
04-15-2018, 12:26 PM
Find
Ongka Offline
Member

Posts: 225
Threads: 3
Joined: Nov 2010
Reputation: 20
#6
RE: [CLOSED] Sticky Areas Not Working

Judging from the screenshot I'd say the problem is that the other two sticky areas are deactivated (red name).
If you've already checked the entity names I don't see any other reason as to why it would work with one but not the other.

[Image: 18694.png]
04-16-2018, 07:31 AM
Find
theyhunger Offline
Junior Member

Posts: 15
Threads: 6
Joined: Jul 2017
Reputation: 0
#7
RE: [CLOSED] Sticky Areas Not Working

(04-16-2018, 07:31 AM)Ongka Wrote: Judging from the screenshot I'd say the problem is that the other two sticky areas are deactivated (red name).
If you've already checked the entity names I don't see any other reason as to why it would work with one but not the other.

Thanks for the suggestion but I forgot to add the fact that it will activate when you get close to the puzzle area, here's what I mean:

void CollideAreaCloseToMachine(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
SetEntityActive("CogSticky", true);

if(alState == -1)
SetEntityActive("CogSticky", false);
}
04-17-2018, 07:33 PM
Find




Users browsing this thread: 4 Guest(s)