Page 1 of 1

Ok this one is a bit of a brain twister...

Posted: Thu Dec 27, 2007 3:35 pm
by fug4life
And I'm getting out of my depth.

I download this keypad prefab and I'm using it in my map no problem.
http://www.fpsbanana.com/prefabs/416

The problem started when I got all ambitious,...

Basically I wrote a mappadd in the hope that you can configure the keypad's 4 digit code to whatever configuration you want.
And also have the door the keypad relates to be openable or start locked requiring interaction with the keypad.

Now I managed to get this working, but as Deathy and TheMoon discovered not all 4 digit combinations of numbers 0-9 are possible?

The system is quite complex and a little beyond me, I get a bit lost when trying to figure it out. Or maybe the mappadd causes a bug I don't know?

The first and the one TheDeathy and TheMoon tested read like this:

Code: Select all

oc_archive_b10
{
    Remove
    {
        ClassName
        {
            "npc_ichthyosaur" {}
        }
        TargetName
        {
            "maker1" {}
            "maker2" {}
            "keypad_%i_case" {}
        }
    }
	
    Add
    {
        "logic_case"
        {
            "targetname" "keypad_%i_case"
            "Case01" "0"
            "Case02" "1"
            "Case03" "2"
            "Case04" "3"
            "Case05" "4"
            "OnCase01" "keypad_%i_compare,SetCompareValue,2,0,-1" // Value,2 is the first number of the keycode change to any value from 0-9
            "OnCase02" "keypad_%i_compare,SetCompareValue,3,0,-1" // Value,3 is the second number of the keycode change to any value from 0-9
            "OnCase03" "keypad_%i_compare,SetCompareValue,0,0,-1" // Value,0 is the third number of the keycode change to any value from 0-9
            "OnCase04" "keypad_%i_compare,SetCompareValue,9,0,-1" // Value,9 is the fourth number of the keycode change to any value from 0-9
            "OnCase05" "keypad_%i_accept,PlaySound,,0,-1"
            "OnCase05" "keypad_%i_door,Open,,0,-1"
            "OnCase05" "keypad_%i_case,InValue,0,0,-1"
            "OnCase05" "keypad_%i_correctcounter,SetValueNoFire,0,0,-1"
            "origin" "174 495 -256"
        }
    }
    Modify
    {
         ClassName
        {
            "worldspawn"
            {
                "mapversion" "519"
            }
        }
        TargetName
        {
            "keypad_%i_door"
            {
                "spawnflags" "5136" //To toggle the door openable by players add the value 5136, to lock the door simply remove the value 5136
            }
        }
Now I realised that that logic auto sends inputs to the logic_compare and was wondering if the inputs are lost in using the mapadd.
So I tried adding the logic compare.


Code: Select all

oc_archive_b10
{
    Remove
    {
        ClassName
        {
            "npc_ichthyosaur" {}
            "logic_compare" {}
        }
        TargetName
        {
            "maker1" {}
            "maker2" {}
            "keypad_%i_case" {}
            }
    }
	
    Add
    {
        "logic_case"
        {
            "targetname" "keypad_%i_case"
            "Case01" "0"
            "Case02" "1"
            "Case03" "2"
            "Case04" "3"
            "Case05" "4"
            "OnCase01" "keypad_%i_compare,SetCompareValue,2,0,-1" // Value,2 is the first number of the keycode change to any value from 0-9
            "OnCase02" "keypad_%i_compare,SetCompareValue,4,0,-1" // Value,3 is the second number of the keycode change to any value from 0-9
            "OnCase03" "keypad_%i_compare,SetCompareValue,1,0,-1" // Value,0 is the third number of the keycode change to any value from 0-9
            "OnCase04" "keypad_%i_compare,SetCompareValue,2,0,-1" // Value,9 is the fourth number of the keycode change to any value from 0-9
            "OnCase05" "keypad_%i_accept,PlaySound,,0,-1"
            "OnCase05" "keypad_%i_door,Open,,0,-1"
            "OnCase05" "keypad_%i_case,InValue,0,0,-1"
            "OnCase05" "keypad_%i_correctcounter,SetValueNoFire,0,0,-1"
            "origin" "174 495 -256"
        }
        "logic_compare"
        {
            "targetname" "keypad_%i_compare"
            "InitialValue" "0"
            "CompareValue" "0"
            "OnEqualTo" "keypad_%i_correctcounter,Add,1,0,-1"
            "OnNotEqualTo" "keypad_%i_branch,SetValue,1,0,-1"
            "origin" "126 495 -256"
        }
    }
Now to get the logic_compare in I used to generated scripts 1 to remove it the 1 to add it then I added to the mappadd I'm using for the map.

Basically, I can't see that the prefab maker hasn't ruled out any possibles, And I'm not sure if I the mappadd dosen't like something like removing the ichy's template_makers. And the weirdest part is it all works ok for changing to somenumbers even with the first peice of code I used without the logic_compare...

Two numbers we know don't work are 0592,2412.
Infact Im gonna compile the map without mapadds using those numbers as the defualt code and see if it's the prefab setup...

:siezure:

Posted: Thu Dec 27, 2007 6:05 pm
by fug4life
Well it would seem the good news is it's not the mappadd. Its in the string of entities somewhere, the prefab dosen't allow some number configurations. All I gotta do Is try work it all out :(
How do I know well I did what I said and tested the bad numbers by actually editing the enities in hammer rather than using any mapadd.

Next question totally unrelated:
A func_areaport or portal window can pass through func_details?


EDIT: Problem solved!!! :D