Author
|
Topic: Another question, oh great sages. More scripting help.
|
Gerben |
posted 07-12- 07:19 AM CT (US)
I know the freeze(1) and freeze(& current_sprite) command, but how can I freeze and unfreeze other sprites in the same area? I want someone to order an attack if Dink says the wrong thing. The guards should start to move then. Thanks!
|
Nexis
|
posted 07-13- 05:28 AM CT (US)
Well if you want to freeze and unfreeze other sprites you basically have two options.One, you can make a few globabl variables that store the other sprites number. Or two, you can have the script that is trying to freeze the sprites be the one that creates them. I don't really know of any other good way of doing it (I suppose you could check every single number to see if it matched up to the correct sprite but that could get messy and would be prone to error). |
Gerben
|
posted 07-13- 08:33 AM CT (US)
Ah, I get it, the number 1 stand for the sprite number. With dink being number one! As the editor shows you which sprite you have touched last it will be really easy to freeze the sprite.But I already used your second suggestion and it works fine now. One more question, however. Is it possible to chance the vision in a sprite script ? Or can you only do that from a room script ? Thanks! |
Nexis
|
posted 07-14- 06:00 AM CT (US)
About using the sprite numbers from the editor, I have been told they are different than the numbers that appear in the game so I don't recommend that either (and it makes it really messy if you need to add in a new sprite or delete an old one).Visions can only be changed with the screen base script. There is a command called forcevision() that's supposed to change it in any script but that command doesn't work (just like the hurt() script doesn't work, or at least I've never gotten it to work). |
Gerben
|
posted 07-17- 06:14 AM CT (US)
Oke, but now I have come across a new problem. I've made one sprite create two new ones, the guards. Icould unfreeze them by using the unfreeze(&guard1); command. But now I want something to happen when both guards have died. I know I can do this by using get_sprite_with_this_brain() , but I need the script to be run. Normally I would do this by putting it in void die(void) . But since the guards do not use scripts I don't know when or how to run it. Is there some way to attach a script to a sprite you've generated from another script ? I know there is something like script_attach, but this just gives the old script to a new sprite. Mmmm, I could use this command, but there must be an easier way. Thanks! |
Nexis
|
posted 07-17- 06:23 AM CT (US)
Actually, you've got the right idea. To do something like that you just use script_attach. You can use this command to attach script to any new sprites you've created. |
FF4LIFE
|
posted 07-17- 11:09 PM CT (US)
Hey, Nexis, the force vision command does work. I've used it a couple of times and its EXTREMELY useful and fun. Just enter: forcevision(int 1) That works for me =)
|
Gerben
|
posted 07-18- 01:33 AM CT (US)
Uhm you mean actually type force_vision(int 1); To change to vision 1? I thought int .... resembled a number. But anaway, I just type attach_script (&guard); ? This means that I have to make sure that the original script does not mess up my guard. But I think I will be able to do it. I just have to use a lot of variables. |
Gerben
|
posted 07-18- 01:35 AM CT (US)
Ah, I get it, you just leave out the underscore ? So I can type forcevision (&vision#); ? |
Nexis
|
posted 07-18- 06:07 AM CT (US)
Wow, that's really awesome if it does work. Well except for part about me finding out about it now that is. |
Nexis
|
posted 07-18- 06:23 AM CT (US)
Hmm...just tried again with that line of code that you supplied and it didn't work. How about providing and example script for us. Are you using this on the base screen script or a normal script attached to a sprite? |