PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: I NEED HELP!
(02-18-2013, 02:17 PM)Adrianis Wrote: For 3, you'll want to use AddPropForce to push the door, but have the function repeat using a timer, and have the force switch sides so it is pushing the door closed, then open, closed again etc. You could just look in the wine cellar scripts to see how FG did it, of course.
Perhaps something like this...
void OnEnter()
{
SetSwingDoorDisableAutoClose("doorname", true); // to make sure the door does not close
AddTimer("DoorBangOpen", 2, "DoorBang");
}
void DoorBang(string &in strTimer)
{
if (strTimer == "DoorBangOpen") {
AddPropForce("doorname", 0, 0, 500, "local"); // you'll need to play around with the force value / direction
AddTimer("DoorBangClose", 1, "DoorBang");
}
else if (strTimer == "DoorBangClose") {
AddPropForce("doorname", 0, 0, -1000, "local"); // you'll need to play around with the force value / direction, note reversal of direction from above
AddTimer("DoorBangOpen", 2, "DoorBang");
}
}
For point 2, you want the piano to be playing, but to stop playing when the player looks at it. Then you want the piano to start playing again when the player looks away? and stop again when they look back? etc etc... Kinda like that. But i want it to play once, like this;
When i was not looking, the piano plays.
When i was looking at it, it suddenly stops (like JJJRRRREEENNNG!), and there's a dust figure. Just once.
Also, in number #3, the force value / direction is what? the "500" thing?
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
02-18-2013, 02:43 PM |
|
TheGreatCthulhu
Member
Posts: 213
Threads: 10
Joined: Oct 2010
Reputation:
32
|
RE: I NEED HELP!
About the "500 thing":
The 3 numerical values are the (x, y, z) components of the force vector - I don't know how familiar you are with vector math, but essentially, the numbers determine the orientation of a vector in a 3D coordinate system, as well as the magnitude (length) of that vector - that is, the direction and the intensity of the force.
Now, there's "world" coordinate system - the one you see associated with the grid in the editor, that is, the one used to position things in the level; and there are "local" coordinate systems, which are specific to each object/entity - these are the ones the level editor uses for rotations.
So (0, 0, 500) represents a force that is directed along the local z-axis, and has the magnitude of 500.
(0, 0, -500) would also be a force along the local z-axis, same magnitude, but it now points in the opposite direction..
(500, 0, 0) is the vector of the same magnitude, but it's now directed along the local x-axis (90degs from the previous orientations in the horizontal plane).
(0, 500, 0) is a same-length vector, pointing directly up along local the y-axis.
(500, 500, 500) has a somewhat larger magnitude than before (it's a diagonal of a 500x500x500 cube), but it now points in a different direction, along the x=y=z line.
In the image below the coordinate system is setup so that the z-axis is up, but the same principles apply - you get the idea.
|
|
02-18-2013, 03:05 PM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: I NEED HELP!
(02-18-2013, 03:05 PM)TheGreatCthulhu Wrote: About the "500 thing":
The 3 numerical values are the (x, y, z) components of the force vector - I don't know how familiar you are with vector math, but essentially, the numbers determine the orientation of a vector in a 3D coordinate system, as well as the magnitude (length) of that vector - that is, the direction and the intensity of the force.
Now, there's "world" coordinate system - the one you see associated with the grid in the editor, that is, the one used to position things in the level; and there are "local" coordinate systems, which are specific to each object/entity - these are the ones the level editor uses for rotations.
So (0, 0, 500) represents a force that is directed along the local z-axis, and has the magnitude of 500.
(0, 0, -500) would also be a force along the local z-axis, same magnitude, but it now points in the opposite direction..
(500, 0, 0) is the vector of the same magnitude, but it's now directed along the local x-axis (90degs from the previous orientations in the horizontal plane).
(0, 500, 0) is a same-length vector, pointing directly up along local the y-axis.
(500, 500, 500) has a somewhat larger magnitude than before (it's a diagonal of a 500x500x500 cube), but it now points in a different direction, along the x=y=z line.
In the image below the coordinate system is setup so that the z-axis is up, but the same principles apply - you get the idea.
So if i want the door to be banging on the X-Axis, i script the force as
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
02-18-2013, 03:17 PM |
|
Adrianis
Senior Member
Posts: 620
Threads: 6
Joined: Feb 2012
Reputation:
27
|
RE: I NEED HELP!
Oh apologies for not explaining that - yeh 500, 0, 0 will apply '500' force along the positive X axis, wheras -500 would be the negative X axis, or in other words, the opposite direction. The actual quantity of force needed is quite high, otherwise you don't notice it - 500/1000 will definately make it move so you'll know if it's working, but it may be too much / too little so play around with the values till you find something that works.
Also, the last parameter on that list, "local" - that's the coordinate system to use. It can be "world", which basically means it follows the x, y, z system that applies for the entire map (as seen in your map editor), so the position of the door (and its rotation, if you change it) does not matter. The direction of the force needed is easy to find when the coordinate system used is "world", because you can just drag the entity in the map editor and watch the position value change, so you can see if it is +/- x or z.
"local" means it uses the coordinate system of the actual entity, so no matter where or what rotation the door is at, it will always apply to the same direction for that door (this means that you can apply exactly the same force/direction to any door, even if it is rotated 90 degrees to another, and it will still open/close correctly). From playing around with this myself, IIRC the open/close angle for applying force is the 'z' axis, though I may be completely wrong so change the values to the X axis if it doesn't work
It may be worth noting that I haven't tested that script
(This post was last modified: 02-18-2013, 11:07 PM by Adrianis.)
|
|
02-18-2013, 11:04 PM |
|
|