View Full Version : Scripting help
08-12-2009, 08:59 PM
I am making a mini-dueling arena in a new project I am working on, (FOR TSL) and I have run into a problem. I want to make a script that fires when the player is at very low health, which restores the player's health and destroys the opponent, to end the duel before the player dies. My problem is that I am somewhat inexperienced in scripting, and don't quite know how to do this. My question is, are there any scripts out there that can do that, or can anybody supply an example I can build off?
Any help is greatly appreciated.
08-13-2009, 09:10 AM
Sounds like an interesting project. I haven't got all my notes here at work, so I can't write a script, but what you will want to do is the following;
The script you use to start the fight needs to also set your PC's minimumHP=1 (do this for your opponent too if you don't want them to die either)
You then need to create an 'on heartbeat' script for your opponent (the .utc has an 'on heartbeat' field, any script in here will fire every couple of seconds)
This script should check your PC's hitpoints;
If PC's HP<10
Remove the opponent
Remove the min HP=1 (or you'll be invincible)
Kickstart whatever dialog follows the fight.
If you intend your opponent to die, it might be worth also creating an 'on death' script (again there's a field in the .utc) to remove the min HP=1 and kickstart whatever dialog follows the fight.
Hope this was helpful. You can find most of the scripting language for the above in the tutorials section. That's the best I can do here, but that might be enough to get you underway.
08-14-2009, 11:57 AM
Okay, using some tutorials, I threw something together that works pretty well! Thanks for the help, Papership!
vBulletin®, Copyright ©2000-2013, Jelsoft Enterprises Ltd.