Author
|
Topic: opening a gate
|
abbey |
posted 05-07- 12:09 PM CT (US)
In my Dmod, I have got this gate that i want a key to open, But I don't know what sort of script i will need to use. I need To use the key on the gate and then the gate needs to disappear, To let Dink through. So can someone please help.thanxs
|
joshriot
|
posted 05-07- 02:24 PM CT (US)
make it so when you get the key, &key = 1 or something. then make it so when you talk to the fence if &key = 1 { sp_active(¤t_sprite, 1); } if &key = 0 { say("`i suck i need a key", 1); } i dont know, something like that |
abbey
|
posted 05-08- 12:16 PM CT (US)
you see The key is in my inventory and i want to use it on the gate, and then the gate and the key disapear |
kissbadik
|
posted 05-08- 03:51 PM CT (US)
You could use the holding drop command to get the key to disappear after you have armed and used it. You could also set the &key variable to 0 as joshriot said and until the player arms the key by selecting it in your inventory the gate wont let dink thru. I've tried doing this but I couldn't get it to work properly due to the fact that I've been programming for about a week and I'm not entirely sure on how to do it. Sorry. |
Drakeman
|
posted 05-09- 01:58 AM CT (US)
If you want to have the CTRL button action make the gate disappear then you need to put something in the use procedure of the script for the key "item-key".You could do a check to see if dink is in front of the gate by a couple of if statements. One for the map, and one for the area in front of the gate if (&player_map == XX) if ((inside_box.... ) I can't remember the whole thing of inside_box, but check it out from the dinkc.txt file or other tutorial stuff. Then if both conditions are true Dink is standing in front of the gate. You now need to control the gate sprite. To do that use a global variable in the gate script as a temporary hold. So in the gate script main procedure use &temphold = ¤t_sprite; Now you can get rid of the gate from the "item-key" script by referring to &temphold. sp_active(&temphold, 0); or you can make it shrink... or you can move it to open it. |
abbey
|
posted 05-10- 12:05 PM CT (US)
Thanks for the help everyone. oh and another thing how can I drop an item, You see I have a sword , then Dink finds a better sword, I then want to click on the old sword and then be given the option to drop it or not. |
Beuc
|
posted 05-13- 09:43 AM CT (US)
"int count_item(char name_of_item_script) Returns how many items with this script name they have." You may use this to check if he has the sword, then: "void kill_this_item( char name_of_item_script )
Kills first instance of this item by name of script. If it's currently armed, it will run it's disarm and drop, otherwise it will just run the drop script and remove it." to delete the old sword, and: "int add_item(char scriptname[8], int seq, int frame);" to add the new scword :) |
abbey
|
posted 05-13- 05:45 PM CT (US)
Thank for the help |