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
Rod Puzzle
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#11
RE: Rod Puzzle

Toggle grid-snapping off, and then move it manually

Trying is the first step to success.
06-13-2012, 09:37 PM
Find
BrooksyFC Offline
Senior Member

Posts: 329
Threads: 11
Joined: Jul 2011
Reputation: 6
#12
RE: Rod Puzzle

Yeah I've moved them. Are these script areas or something else? Like sticky?

Think A Little, Change A Lot
06-13-2012, 09:59 PM
Find
Putmalk Offline
Senior Member

Posts: 290
Threads: 13
Joined: Apr 2012
Reputation: 15
#13
RE: Rod Puzzle

(06-12-2012, 03:27 PM)beecake Wrote: void OnStart()
{

AddUseItemCallback("", "Rod_1", "ScriptArea_1", "UseRod_1", true);
///Rod_1 = 1st rod ///ScriptArea_1 is around the first hole
AddUseItemCallback("", "Rod_2", "ScriptArea_2", "UseRod_2", true);
///Rod_2 = 2nd rod ///ScriptArea_2 is around the second hole
AddUseItemCallback("", "Rod_3", "ScriptArea_3", "UseRod_3", true);
///Rod_3 = 3rd rod ///ScriptArea_3 is around the third hole
}

void UseRod_1(string &in asItem, string &in asEntity)
{
SetEntityActive("Rod_1_Static", true); ///Place a static rod inside the hole inactive
RemoveItem("Rod_1); ///This will remove it from the inventory

AddLocalVarInt("3_Rods", 1); ///Adds 1 to the LocalVarInt

if(GetLocalVarInt("3_Rods") == 3) ///Check if the LocalVarInt = 3
{
///Do stuff when all 3 has been placed
}
}

void UseRod_2(string &in asItem, string &in asEntity)
{
SetEntityActive("Rod_2_Static", true);
RemoveItem("Rod_2);

AddLocalVarInt("3_Rods", 1); ///Adds 1 to the LocalVarInt

if(GetLocalVarInt("3_Rods") == 3) ///Check if the LocalVarInt = 3
{
///Do stuff when all 3 has been placed
}
}

void UseRod_3(string &in asItem, string &in asEntity)
{
SetEntityActive("Rod_3_Static", true);
RemoveItem("Rod_3);

AddLocalVarInt("3_Rods", 1); ///Adds 1 to the LocalVarInt

if(GetLocalVarInt("3_Rods") == 3) ///Check if the LocalVarInt = 3
{
///Do stuff when all 3 has been placed
}
}

Everything with red color should be deleted
This is a very ineffective way of solving the problem; all of that can be done in one function to make it easier to a) read, b) debug, c) shorter code.

06-13-2012, 11:18 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#14
RE: Rod Puzzle

(06-13-2012, 09:59 PM)BrooksyFC Wrote: Yeah I've moved them. Are these script areas or something else? Like sticky?
The script beecake provided you is the simplest way to deal with your problem and will not be exactly like the puzzle in the original game (it would take me a few pages to write out exactly what to put in the editor and what to write for scripting, so I will not). If you want it to be exactly like in game, you will have to view FG's map in the map maker while looking at their script for the corresponding level to make sure you fully see how it's done.

To make the rods go into the corresponding hole, in the Level Editor, simply place the rod into the machine like you want it to appear in game (ie angle it properly and put about 1/2 or 1/4 of it in the machine's hole). Next, in the "General"tab, make sure "Active" is not checked; then, go to the next tab "Entities" and make sure "static physics" is checked.

(This next part is speculation, if you don't have this problem, ignore it.) If you select the rod in your inventory and place it over the machine, does it light up? (if yes, skip, if no, read) To make sure you can interact with the machine with each rod, place a script area over the machine that is roughly the same size. Name this area however you'd like, just know that it is going to be the child (thing you're interacting with) in your useitemcallback. Make sure to go into the "Area" tab and towards the bottom, make sure "ItemInteraction" is checked. This should solve the interaction problem.


As for the scripting portion, make sure to remove the item from you inventory, and set the rod with the corresponding color to the one you removed active. Then, add the local variable. When you reach the desired amount of variables (3?), you can trigger your function. If you are unfamiliar with variables, check out this tutorial on the FrictionalGames Wiki, it should be helpful:

http://wiki.frictionalgames.com/hpl2/tut...lvariables


I hope this helped you out. It is sometimes difficult to communicate exactly what to put in the level editor through text, hopefully I made it understandable.

I rate it 3 memes.
06-14-2012, 12:05 AM
Find
BrooksyFC Offline
Senior Member

Posts: 329
Threads: 11
Joined: Jul 2011
Reputation: 6
#15
RE: Rod Puzzle

Right, I've managed to get the rods into the machine, how do I have it so the player can't take the rods back out? Cause at the mo they go in but I can remove them

Think A Little, Change A Lot
06-16-2012, 11:56 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#16
RE: Rod Puzzle

You should place the rod_static instead of the item. The static versions are not pickup-able.

Trying is the first step to success.
06-16-2012, 12:46 PM
Find
BrooksyFC Offline
Senior Member

Posts: 329
Threads: 11
Joined: Jul 2011
Reputation: 6
#17
RE: Rod Puzzle

I've only found the rods under items. How do I make them static so they are unpickable

Think A Little, Change A Lot
06-16-2012, 01:42 PM
Find
BrooksyFC Offline
Senior Member

Posts: 329
Threads: 11
Joined: Jul 2011
Reputation: 6
#18
RE: Rod Puzzle

Do I have to use the model editor or is it in the level editor? Cause I can't seem to find it

Think A Little, Change A Lot
06-18-2012, 08:17 AM
Find
Dutton Offline
Member

Posts: 121
Threads: 3
Joined: Apr 2012
Reputation: 2
#19
RE: Rod Puzzle

1) Click on the rod with the selection tool.

2) Head to the Entity tab next to General.

3) Check the StaticPhysics option.

[Image: 15isy6C]
06-18-2012, 08:47 AM
Find
BrooksyFC Offline
Senior Member

Posts: 329
Threads: 11
Joined: Jul 2011
Reputation: 6
#20
RE: Rod Puzzle

Yeah I've checked that and I can still pick it up, like when I put it in, it is still glowing like it's still active.

Think A Little, Change A Lot
06-18-2012, 09:54 AM
Find




Users browsing this thread: 2 Guest(s)