JetlinerX
Senior Member
Posts: 599
Threads: 49
Joined: Jun 2011
Reputation:
19
|
Is this possile?
Hey all-
I know you are all incredibly smart with this engine. After all, you practically made guns! xD So is the following scare, possible?
A player hits an area, which causes an object to raise (preferably slowly) and hover there for a specific amount of time, then be launched away. Is it possible, and HOW?!
|
|
04-15-2012, 04:30 AM |
|
Statyk
Schrödinger's Mod
Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation:
241
|
RE: Is this possile?
I would have the model on a MoveObject and set the axis to Y to be scripted to move up, stop, then have it deactivate and activate the same model, new .ent set to be a normal Object (Grab), with AddPropForce/AddPropImpulse.
|
|
04-15-2012, 04:42 AM |
|
Adrianis
Senior Member
Posts: 620
Threads: 6
Joined: Feb 2012
Reputation:
27
|
RE: Is this possile?
Check out this thread... http://www.frictionalgames.com/forum/thread-14448.html
It may be simpler for what you want than what Statyk has suggested. You just need to get the values right for the amount of upward force, then after a set amount of time, stop applying a constant upward force and apply a very large amount of force in whatever direction you want. Hope that helps
|
|
04-15-2012, 05:49 PM |
|
DRedshot
Senior Member
Posts: 374
Threads: 23
Joined: Jun 2011
Reputation:
11
|
RE: Is this possile?
Just for fun I thought I'd try to do this, I made this little script
void OnStart{
AddEntityCollideCallback("Player" , "FlyArea" , "FlyNow" , false , 1);
}
void FlyNow(string &in asParent, string &in asChild, int alState) // Player hits area
{
SuperFlyScript("vase_1"); // Function to start flying
}
void SuperFlyScript(string &in asEntity){
AddTimer(asEntity, 0.05f, "FloatUp");
AddTimer(asEntity, 1.5f, "PushHard");
}
void FloatUp(string &in asEntity){ // Entity floats for 1.5s
if(GetTimerTimeLeft(asEntity)!=0.0f){
AddDebugMessage("FloatModeActivated!", true);
AddPropImpulse(asEntity , 0.0f , 0.5f , 0.0f , "world");
AddTimer(asEntity, 0.05f, "FloatUp");
}
}
void PushHard(string &in asEntity){ // Entity is pushed away!
AddDebugMessage("PushModeActivated!", true);
AddPropForce(asEntity , 3000.0f , 1000.0f , 0.0f , "local");
RemoveTimer(asEntity);
}
You can even use different entities! SuperFlyScript(asEntity);
(Heavy objects probably wont be affected, because only a small force is applied)
|
|
04-15-2012, 07:19 PM |
|
palistov
Posting Freak
Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation:
57
|
RE: Is this possile?
AddPropForce is all you need....and a lot of patience.
Make a looping function that runs every 0.0166f seconds. Every time the function runs, increase a local variable by a miniscule amount, and translate that variable into vertical force applied to the object. At a certain point, stop increasing the variable, and pause. After a certain amount of time, add a force to throw the object away and stop the timer which keeps it afloat.
Good luck, and make sure you bring a soda or something while you test it out....slight miscalculations can cause your object to fly through a wall. Haha.
|
|
04-15-2012, 10:29 PM |
|
Apjjm
Is easy to say
Posts: 496
Threads: 18
Joined: Apr 2011
Reputation:
52
|
RE: Is this possile?
You could also use a sticky area for the initial floating, then detatch the floating prop and apply a large impulse or force.
|
|
04-15-2012, 10:42 PM |
|
palistov
Posting Freak
Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation:
57
|
RE: Is this possile?
Haha Apjjm's idea is actually quite clever. I can't remember off the top of my head what the function is, but there should be a variable to change the speed the object attaches in the properties of the sticky area.
|
|
04-16-2012, 12:11 AM |
|
nemesis567
Posting Freak
Posts: 874
Threads: 65
Joined: May 2011
Reputation:
10
|
RE: Is this possile?
Apjjm, if he did that it wouldn't be so dynamic.
Today I dreamt the life I could live forever. You only know that when you feel it for you know not what you like until you've experienced it.
|
|
04-16-2012, 12:56 AM |
|
|