I have a problem that i hope you can help me solve. The problem is; that the OpenDoor() function doesn't seem to work when it's called from within a timer function (in this case IntroHalt()). The debug message "door opens" is sent but the door is not affected by the script. When i call the function from Onstart() or StartIntro() it works just fine and the door opens.
I've also tried to put the door opening script inside the timer function itself, but this does not work either..
Do i have to make a ScriptArea for this to work, or can i do something else to avoid it? So i won't have to worry about adding areas in the level editor?
Also, can you explain why i can't seem to call the door opening script from a timer?
(03-20-2013, 05:53 PM)The chaser Wrote: When making timers, the parameters (void Example ()) are always "string &in asTimer". So:
No they are not. "&in asTimer" can be changed to whatever you please.
As i said, the timers work just fine.
(03-20-2013, 05:53 PM)The chaser Wrote: What are you exactly trying to achieve at the OpenDoor thing? I don't understand what you are trying to do.
OpenDoor is a self tailored function and is called from the IntroHalt timer fucntion, and is meant to open the door with the fuctions that are provided by the engine.
StartIntro() and OpenDoor() is NOT a func included in the game. Or maybe that some functions that was in the original game wasn't put in the Script Functions page.
"Veni, vidi, vici." "I came, I saw, I conquered."
(This post was last modified: 03-21-2013, 05:57 AM by PutraenusAlivius.)
(03-21-2013, 05:56 AM)JustAnotherPlayer Wrote: StartIntro() and OpenDoor() is NOT a func included in the game. Or maybe that some functions that was in the original game wasn't put in the Script Functions page.
You can make your own functions. Just as i said StartIntro() calls the script inside void StartIntro() and starts the timers FadeIn and what not. My problem is that i can only seem to get the door opening script to work when i use it in the beginning of the map, (inside either OnStart() or StartIntro() ) which is really wierd. Go read the script language and reference guide if you have no clue how my script should work. It might clear out some misunderstandings.
(03-20-2013, 05:53 PM)The chaser Wrote: When making timers, the parameters (void Example ()) are always "string &in asTimer". So:
No they are not. "&in asTimer" can be changed to whatever you please.
As i said, the timers work just fine.
The '&' and 'in' are, seperately, both keywords used by AS. The name asTimer can change as that is just the name of the variable, and you can change &in too if you like but you shouldnt. string& is a string type that passes a memory address rather than the actual value to the function. Using &in means that the value of the variable cannot be modified, as opposed to say string &inout (or more simply string&) which would enable you to modify the value.
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.
I'm pretty sure that the cause of the issue is using
void OpenDoor(string door)
I'm surprised it doesn't cause an error, but it's likely not working because OpenDoor("prison_11"); is not passing the value correctly into the function - and because you use that string as the arguments for the rest of the calls in that function (rather than hard-coding it in) it may be just that it doesn't know what to open
Try it out as
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
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
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. ;/
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.
(This post was last modified: 03-22-2013, 04:50 PM by ingedoom.)