Quote:
|
Originally Posted by p2p_Sir_Link
By NPCs I meant the non-standard in the level editor. Racil and some other LATs asked me for a script for a pot. I gave it to them, of course, for it was the day of the NPC-Servers coming, and I knew the LATs needed has much help as possible.
|
If the bush was modeled after the pot, it could use a tad of improvement. Not that it's disfunctional, but there are just a few things that don't make sense in the bush script (now that I've seen it).
The main thing is the use of dontblock and blockagain. dontblock is used before hide. This doesn't make sense because hidden objects dont block anyway. blockagain is used after drawunderplayer, and blockagain unsets drawunderplayer. blockagain and dontblock aren't even needed for the script because visibility already handles the things they would be used for.
What else, more of an opinion, there is a sleep 10 instead of a timeout = 10. The timeout isn't even used. Why not call it after ten seconds instead of sleep 10? I don't even trust sleep, and timeout also seems cleaner unless your script is going into an infinite timeout which I would suggest avoiding as often as possible. The only times I would use timeouts as such are when I need to detect keydown, when I need to detect coordinates outside of any events, or, which doesn't work very well, acceleration and rotation. Too bad move doesn't have parameters for acceleration or rotation/radius/direction. (Those last three would go together.)
Another thing I might do to shorten the script, though I wouldn't if I were feeling lazy, is put all of the names of droppables into an array and create a parallel array with the probabilities of dropping each item. Then I would run a for loop to check what to lay and then break it after it has laid. It could also increase the scripts speed if you made the least probable item the last checked and the most probable item the first checked in this kind of situation.
On the same level, setimg. I wouldn't use it unless the image of the script were to change, since image is already in the regular syntax of an NPC.
Overall, though, the bush script gives me a sense that whoever made it is a good scripter who just got a little bit lost in gscript. I don't even know why I wouldn't have read rights for these kind of things. I didn't start cleaning up on these sort of things in my scripts until recently. I hope you interpret this as an insightful post rather than a critical post, because it's not supposed to be a critical post.