Muliple triggers, or one trigger with multiple uses?

Post Reply
User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Muliple triggers, or one trigger with multiple uses?

Post by tsuujin » Mon May 31, 2010 2:04 am

So playing Midkemia Online there is a combat model that revolves around one skill having multiple stages.

The player initiates an attack against you, you see this skill telegraph.
A delay occurs, length depending on the skill.
The skill comes through. It can hit, miss or be defended against.

I started out using one trigger for each state. So "Stormlance" has a trigger for telegraph, a trigger for hit, a trigger for defended, et cetera.


Lately, however, I've started changing how this works. Now I create one trigger instance, name it for the skill, put every possible trigger into it and use the scripting to determine which of the lines I've actually caught.

This is done with:
Code: [show] | [select all] lua
if line:match("^([A-Z][a-z]+) draws") then
	msg:Telegraph("thrust",matches[2],"you")
elseif line:match("You twirl to the side, partially dodging") then
	msg:Defended("thrust",matches[2],"you")
else
	msg:Hit("thrust",matches[2],"you")
end
I'm curious as to the speed difference, though. I know that the calls to match() are going to slow things down a bit, but has anyone tested to see by how much? I can't be the only person doing something similar.

I'd also like to propose a change to the API, but I'll do that in a separate thread.

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: Muliple triggers, or one trigger with multiple uses?

Post by tsuujin » Mon May 31, 2010 2:17 am

Images, so you can see what I'm talking about:


One trigger per state:
individual.png
One trigger per ability:
included.png

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests