(10-23-2013, 09:58 PM)T122002 Wrote: I just tried exactly what you did by changing the names and I just checked and there are no entities with the same name on this map.
I will post a new, working script with the same function for you later today.
Because you don't have to use an area to spawn another area in cases like this. I can explain why:
What we REALLY want to know here is whether the player has the acid jar while entering the area that spawns the monster. You can do that in many ways, and you chose to keep the monster area unactive until the player walks into another area while having the acid. However, there is better options. The option you chose is bad because:
1. It requires several script areas in the Level Editor.
2. It requires a lot more coding.
3. It's harder to track what's wrong.
The best solution in this case would be to always keep the area that spawns the monster active, and make it trigger every time the player enter it. We do that by changing something in the callback function for that area.
Changing "true" to "false" decides that the area will not be removed the first time the player collides with it. That way, it can trigger several times, until manually turned off.
But there are still some things to do. The script triggers several times, but we only want the monster to spawn once, when the player has the acid. Well, this is solved by this:
The marked line of code has a very useful function: the functions within it's brackets is only called if the player has the item "glass_container_filled", otherwise they will be skipped.
This means that when the player enters the area with the acid, the monster will spawn, but when the player doesn't have the acid, nothing happens.
To make sure that the monster doesn't spawn several times due to the player entering the area again, we manually remove the area when the player enters it and has the acid. The player will after this only be able to enter it once with the acid - after the area has done it's work and is removed from the game. The script is done!
The only thing you have to do is rename the "glass_container_1" to "glass_jar_1" in the Level Editor, remove the SuitorScare area, and then copy my script.
I hope you understand what I did in this script, and why. If you have any further questions or if you need help with something else, feel free to let me know.
Founder & Legally Accountable Publisher of Red Line Games.
Environment & Gameplay Designer and Scripter. http://moddb.com/mods/in-lucys-eyes
Because you don't have to use an area to spawn another area in cases like this. I can explain why:
What we REALLY want to know here is whether the player has the acid jar while entering the area that spawns the monster. You can do that in many ways, and you chose to keep the monster area unactive until the player walks into another area while having the acid. However, there is better options. The option you chose is bad because:
1. It requires several script areas in the Level Editor.
2. It requires a lot more coding.
3. It's harder to track what's wrong.
The best solution in this case would be to always keep the area that spawns the monster active, and make it trigger every time the player enter it. We do that by changing something in the callback function for that area.
Changing "true" to "false" decides that the area will not be removed the first time the player collides with it. That way, it can trigger several times, until manually turned off.
But there are still some things to do. The script triggers several times, but we only want the monster to spawn once, when the player has the acid. Well, this is solved by this:
The marked line of code has a very useful function: the functions within it's brackets is only called if the player has the item "glass_container_filled", otherwise they will be skipped.
This means that when the player enters the area with the acid, the monster will spawn, but when the player doesn't have the acid, nothing happens.
To make sure that the monster doesn't spawn several times due to the player entering the area again, we manually remove the area when the player enters it and has the acid. The player will after this only be able to enter it once with the acid - after the area has done it's work and is removed from the game. The script is done!
The only thing you have to do is rename the "glass_container_1" to "glass_jar_1" in the Level Editor, remove the SuitorScare area, and then copy my script.
I hope you understand what I did in this script, and why. If you have any further questions or if you need help with something else, feel free to let me know.
Sorry I didn't reply to your previous comment about you being busy. Its alright!
And thank you so much for posting the correct script and explaining in a nice, detailed manor for a newbie scripter like me to fully understand what you're talking about! I was able to follow along with what you put into the new script just fine. So now I know how everything goes together in a correct way! And I've always done the bad way you told me, such as adding in more script areas that are not necessary. I honestly didn't know what I was supposed to do, so I thought more script areas would work. But you're definitely right. Its very confusing and I couldn't find where the mistakes were because of all the extra coding.
I'm not that great with if statements, but I understood what you did here in this coding.
In the end, thank you so much for helping me out! I was way too confused and it seemed like I tried everything I could from Timers to if statements, which probably isn't much. I just wasn't able to figure this thing out.
Once again, thank you! This means a lot to me!
Glad it worked out fine! For further lessons and tutorials I suggest you check out the wiki, it's stuffed with goodies! http://wiki.frictionalgames.com/
Founder & Legally Accountable Publisher of Red Line Games.
Environment & Gameplay Designer and Scripter. http://moddb.com/mods/in-lucys-eyes