| 03-30-2009, 09:40 PM | #1 |
Basically : I want players to be able to set a real value by typing a message. In this case, it's a respawn rate. Since you apparently cannot use variables for a Time - Periodic Event function, I have it set to : Every (Convert to real(Custom Value of Fountain 0051)) seconds of game time What I would like to know is how to recognize a number in a chat string? Example : -spawn 15 Will set the custom value of the fountain to 15, causing the enemies to spawn every 15 seconds. Any help please? Hopefully I explained it well enough I can add pictures if you need. GUI please XD |
| 03-30-2009, 10:20 PM | #2 |
That won't work because the custom value of the fountain is read only once, when the event is registered. After that, even if you change the custom value, the trigger will still run as often as before. In fact, when the event is registered, the custom value of the fountain is likely still 0. |
| 03-30-2009, 10:38 PM | #3 |
I was smart enough to set the custom value of the fountain before turning on the spawn trigger. But is there any other way to do this - By changing the integer used or turning the trigger off and back on or anything? |
| 03-30-2009, 11:01 PM | #4 |
i would recommend u to use timer for dynamic timing |
| 03-30-2009, 11:04 PM | #5 |
What type of method are you using to spawn with? If you are using structs, give each spot point some type of identification and then check if the entered string is of the format <identification id> <real>, and set the spawn time of the struct that is associated with the identification id to the typed value, and make the timer reference that value. |
| 03-30-2009, 11:37 PM | #6 | |
Quote:
|
| 03-31-2009, 04:17 AM | #7 |
The timer idea seems to work perfectly, allowing me to set it as a one shot timer with a length that i can set to a variable. (Using a one shot timer and then restarting the timer as a one shot in the spawn trigger, to prevent fail if the time is changed during a repeating timer). However, my original question now remains the same. How can I recognize the value entered in the chat message to set the variable? Ex Player enters chat message: "-spawn [number]" Set SpawnRate = [number] Set Timer as a one-shot timer that will expire in SpawnRate seconds |
| 03-31-2009, 04:45 AM | #8 |
| 03-31-2009, 09:22 PM | #9 |
additionally to what akolyt0r said, you should check if SpawnRate equals zero and throw out comprehensive error messages if its an invalid value. |
