Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Doors behave stangely
ingedoom Offline
Member

Posts: 120
Threads: 12
Joined: Feb 2012
Reputation: 0
#7
RE: Calling functions from timers

(03-22-2013, 12:29 PM)Adrianis Wrote: Checkout this part of the AS manual,
http://www.angelcode.com/angelscript/sdk...c_ref.html
Thx for &in explanation =) It ws really helpful. But it didn't solve the problem though.

(03-22-2013, 12:29 PM)Adrianis Wrote: This line,
if(ScriptDebugOn() and ! HasItem("lantern"))
Can you use 'and'? the proper operator should be && for and, but forgive me if it works your way. Doesnt look like that would be the cause of the issue anyway.
You can use "and" instead of && just fine. =)

(03-22-2013, 12:29 PM)Adrianis Wrote: If that fails, add or change the AddDebugMessage call in OpenDoor to print the value of the 'door' string so that we can see if it is the name causing the problem, or if there is something wrong with the rest of the calls in that function

PHP Code: (Select All)
    void OnStart()
                {
        
OpenDoor("prison_11");
                }
    
void OpenDoor(string &in door)
        {
            
AddDebugMessage(door " opens");
            
SetSwingDoorDisableAutoClose(doortrue);
            
SetSwingDoorClosed(doorfalsefalse);
            
SetMoveObjectState(door0.1f);
            
AddPropForce(door, -50000"world");
        } 
This spits out "prison_11 opens" as out would expect and the door opens just fine.

My problem seems to be that this:
PHP Code: (Select All)
    void CollideScriptArea_1(string &in ParentNamestring &in ChildNameint alState)
        {
            
AddDebugMessage("Player collides with " ChildName);
            
OpenDoor("prison_11");
        }
    
void OpenDoor(string &in door)
        {
            
AddDebugMessage(door " opens");
            
SetSwingDoorDisableAutoClose(doortrue);
            
SetSwingDoorClosed(doorfalsefalse);
            
SetMoveObjectState(door0.1f);
            
AddPropForce(door, -50000"world");
        } 
Spits out the same message "prison_11 opens", but yet the door doesn't open.

No matter what i do, the script beneath only works when i call it in the beginning, like in void OnStart(), but not when call it from somewhere else. ;/
PHP Code: (Select All)
            SetSwingDoorDisableAutoClose(doortrue);
            
SetSwingDoorClosed(doorfalsefalse);
            
SetMoveObjectState(door0.1f);
            
AddPropForce(door, -50000"world"); 

It is very strange. I hope you know what might be wrong.

Okay i finally solved it.... There is nothing wrong with the script by the way, it is just the way doors behave that seem to be the problem.
I found out that is i if i opened and closed the door, the opening script worked also when called inside the areacollison function.
i solved it by simply setting the openstate to 0.1 in the level editor, and then in the beginning of the script make it close. That enabled my script to work. =)

F**king doors srsly.

[Image: 23778.png]
(This post was last modified: 03-22-2013, 04:50 PM by ingedoom.)
03-22-2013, 04:21 PM
Website Find


Messages In This Thread
Doors behave stangely - by ingedoom - 03-20-2013, 05:36 PM
RE: Calling functions from timers - by The chaser - 03-20-2013, 05:53 PM
RE: Calling functions from timers - by ingedoom - 03-20-2013, 06:01 PM
RE: Calling functions from timers - by Adrianis - 03-22-2013, 12:29 PM
RE: Calling functions from timers - by ingedoom - 03-22-2013, 04:21 PM
RE: Calling home made functions - by ingedoom - 03-21-2013, 07:25 AM
RE: Doors behave stangely - by Adrianis - 03-22-2013, 05:18 PM



Users browsing this thread: 1 Guest(s)