(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
void OnStart()
{
OpenDoor("prison_11");
}
void OpenDoor(string &in door)
{
AddDebugMessage(door + " opens");
SetSwingDoorDisableAutoClose(door, true);
SetSwingDoorClosed(door, false, false);
SetMoveObjectState(door, 0.1f);
AddPropForce(door, -500, 0, 0, "world");
}
This spits out "prison_11 opens" as out would expect and the door opens just fine.
My problem seems to be that this:
void CollideScriptArea_1(string &in ParentName, string &in ChildName, int alState)
{
AddDebugMessage("Player collides with " + ChildName);
OpenDoor("prison_11");
}
void OpenDoor(string &in door)
{
AddDebugMessage(door + " opens");
SetSwingDoorDisableAutoClose(door, true);
SetSwingDoorClosed(door, false, false);
SetMoveObjectState(door, 0.1f);
AddPropForce(door, -500, 0, 0, "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. ;/
SetSwingDoorDisableAutoClose(door, true);
SetSwingDoorClosed(door, false, false);
SetMoveObjectState(door, 0.1f);
AddPropForce(door, -500, 0, 0, "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.