Frictional Games Forum (read-only)
[CHAOS] Is this possile? - 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: [CHAOS] Is this possile? (/thread-14803.html)



Is this possile? - JetlinerX - 04-15-2012

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?!



RE: Is this possile? - Statyk - 04-15-2012

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.



RE: Is this possile? - Adrianis - 04-15-2012

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



RE: Is this possile? - DRedshot - 04-15-2012

Just for fun I thought I'd try to do this, I made this little script Smile
Code:
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)



RE: Is this possile? - palistov - 04-15-2012

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.


RE: Is this possile? - Apjjm - 04-15-2012

You could also use a sticky area for the initial floating, then detatch the floating prop and apply a large impulse or force.


RE: Is this possile? - palistov - 04-16-2012

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.


RE: Is this possile? - nemesis567 - 04-16-2012

Apjjm, if he did that it wouldn't be so dynamic.