Aller au contenu

Photo

Any tutorials for scripting battle events?


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
Grani

Grani
  • Members
  • 558 messages
 Hi there,
I wanted to make some of the fights in my module a bit more... interesting and not just a simple encounter, just with a stronger enemy.
Anyway, I didn't know how to call it, but I simply mean scripting events that fire at specific points of the battle, i.e. when PC's or the enemy's health got down enough, or after the fight lasts for X seconds and stuff like this.

I don't know if there is any specific category for this kind of scripts, but any info on where I could learn more about them is welcome.

Thanks. :)

Modifié par Grani, 24 août 2013 - 11:12 .


#2
MagicalMaster

MagicalMaster
  • Members
  • 2 003 messages
You could try to pull apart the scripts on Siege of the Heavens if you wanted.

In terms of the two events you listed there...

Health Percentage
The simplest way to do this would be to add it into the OnDamaged event. You'd literally add something like...

int x = GetLocalInt('done");

if (x == 0 && GetCurrentHP < GetMaxHP/2)
{
SetLocalInt("done");

blah blah blah
}

That, for example, would execute at 50% health. You do need to make sure it doesn't fire more than once presumably, hence the x variable. That's the basic gist.

Another alternative is to have some function or script constantly calling and checking the value of the HP - and then use similar logic. This is what I did in Siege.

After X Seconds
Again, you could do this in a few ways. You could simply figure out a way that combat has begun and then call a DelayCommand for something execute X seconds later. If you want to combine multiple events "Like things every X seconds and things every X%," you may want to do something along the lines of what I did in Siege - which prevented too many things going off at once (unless you WANT that to happen). Effectively just used local variables to ensure abilities didn't overlap too much.

#3
Grani

Grani
  • Members
  • 558 messages
That makes sense, thank you. :)