Frictional Games Forum (read-only)
Challenge Threadᆦ ᆦ ᆦ - 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)
+--- Thread: Challenge Threadᆦ ᆦ ᆦ (/thread-14681.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19


RE: [CHALLENGE THREAD] - Your Computer - 05-01-2012

(05-01-2012, 05:20 AM)Homicide13 Wrote: Hm Wait a second, why are you using the "->" to reference the class' member functions?

Most likely a C++ habit he unconsciously let through.


RE: [CHALLENGE THREAD] - Homicide13 - 05-01-2012

Alright, that's what I thought, but I just wanted to make sure. ;_;



RE: [CHALLENGE THREAD] - nemesis567 - 05-01-2012

Huh? Maybe. I thought, array, pointer, pointer requires ->.



RE: [CHALLENGE THREAD] - Your Computer - 05-01-2012

(05-01-2012, 01:35 PM)nemesis567 Wrote: Huh? Maybe. I thought, array, pointer, pointer requires ->.

You're confusing yourself with something else. Then again, even in C++ arrays or classes aren't always allocated with the new keyword (though, only classes can have methods).


RE: [CHALLENGE THREAD] - Apjjm - 05-01-2012

My solution:
Code:
void OnStart()
{
    //Attach some prop detectors to the bridges
    AddAttachedPropToProp("bridge_1","collider_1","bridgeCollider.ent",0,0,0,0,0,0);
    AddAttachedPropToProp("bridge_2","collider_2","bridgeCollider.ent",0,0,0,0,0,0);
    
    //Callbacks
    AddEntityCollideCallback("barrel01_*","collider_1","cbAddPropBridgeDown",false,0);
    AddEntityCollideCallback("Player","collider_1","cbAddPropBridgeDown",false,0);
    AddEntityCollideCallback("barrel01_*","collider_2","cbAddPropBridgeUp",false,0);
    AddEntityCollideCallback("Player","collider_2","cbAddPropBridgeUp",false,0);
    
}


//Add/Remove a prop to the bridge we need to pull down
void cbAddPropBridgeDown(string &in asParent, string &in asChild, int alState)
{    
    if(asParent == "Player")
        AddLocalVarInt("BridgeDown",3 * alState); //Player ways 3x more than a barrel...
    else
        AddLocalVarInt("BridgeDown",alState);
    moveBridges();
}

//Add/Remove a prop to the bridge we need to pull up
void cbAddPropBridgeUp(string &in asParent, string &in asChild, int alState)
{
    
    if(asParent == "Player")
        AddLocalVarInt("BridgeUp",3 * alState); //Player ways 3x more than a barrel...
    else
        AddLocalVarInt("BridgeUp",alState);
    moveBridges();
}

//Determine what levels the bridges should move to
void moveBridges()
{
    //Relative weights on bridges
    int up   = GetLocalVarInt("BridgeUp");
    int down = GetLocalVarInt("BridgeDown");
    int diff = up - down;
    AddDebugMessage("Up: " + up + " Down: " + down + " Diff: " + diff,false);
    
    //Work out relative weights & clamp (to stop bridges going through the floor).
    float state = diff * 0.1f;
    if(state>1.0f)       state = 1.0f;
    else if(state<-0.5f) state = -0.5;
    
    //Move based on relative weights
    SetMoveObjectStateExt("bridge_1",-state,0.65f,1.5f,0.125f,true);
    SetMoveObjectStateExt("bridge_2",state,0.65f,1.5f,0.125f,true);
}
I used the Bridge Collider entity which i provided as an addition file.


RE: [CHALLENGE THREAD] - nemesis567 - 05-01-2012

quite simpler than mine.



RE: [CHALLENGE THREAD] - Homicide13 - 05-01-2012

Hm I don't know much about physics, but wouldn't even one object's worth of imbalance cause the bridges move to their respective maximum/minimum positions?



RE: [CHALLENGE THREAD] - Apjjm - 05-01-2012

(05-01-2012, 06:01 PM)Homicide13 Wrote: Hm I don't know much about physics, but wouldn't even one object's worth of imbalance cause the bridges move to their respective maximum/minimum positions?
Not always, but you are free to make that interpretation. The behaviour depends on the mechanics "behind the scenes" of the balancing on the bridges (Obviously if it is just bridge->pulley->pulley->bridge then yes). The specification I gave wanted a counterbalance puzzle, I am not too concerned how people interpreted that (and how the bridges should behave - assuming it isn't totally unintuitive) past the point of putting boxes onto bridge 1 effects bridge 2 in a proportional and opposite manner - so either is/was acceptable.


RE: [CHALLENGE THREAD] - Homicide13 - 05-02-2012

So what is the new challenge? Smile



RE: [CHALLENGE THREAD] - Theforgot3n1 - 05-02-2012

First i was like: Yeah, there will be some guy solving everything instantly anyway. But I just noticed that you are answering most of the challenges. Which means that people don't know how to answer these.
If you could make the challenges slightly easier, maybe I can actually participate. Big Grin

Or ah, don't mind me.