Implementing: Procs

EQ2Emulator Development forum.

Moderator: Team Members

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Procs

Post by Jabantiz » Fri Dec 06, 2013 12:35 pm

You can't set a timer with AddControlEffect, it is just AddControlEffect(Spawn, type) and a RemoveControlEffect(Spawn, type), unless you add a timer some other way that I am not aware of

Code: Select all

int EQ2Emu_lua_AddControlEffect(lua_State* state) {
	if(!lua_interface)
		return 0;
	Spawn* spawn = lua_interface->GetSpawn(state);
	int8 type = lua_interface->GetInt32Value(state, 2);
	LuaSpell* luaspell = lua_interface->GetCurrentSpell(state);
	int32 spell_id = 0;
	if (luaspell && luaspell->spell && luaspell->caster && type != 0) {

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Implementing: Procs

Post by John Adams » Fri Dec 06, 2013 12:53 pm

Thought we had an AddTimer() LUA.

But let me guess... that only works in spawn scripts ;)

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Procs

Post by Jabantiz » Fri Dec 06, 2013 1:15 pm

The timer can be set in a spell, however the call back function needs to be in the spawn script for who the timer was set, so every combat spawn would need a script with the callback function in it if used for spell related stuff.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Implementing: Procs

Post by John Adams » Sun Dec 08, 2013 3:36 pm

Okay, guess who's confused again? <thumbs at self>

I am messing with Hunker Down, and I see what may or may not be a spell proc? and haven't quite figured out how to script it yet...
-- On a melee hit this spell may cast Pin on target of attack. Lasts for 10.0 seconds. Triggers about 5.0 times per minute.
-- Roots target
-- 5% chance to dispel when target takes damage
-- 5% chance to dispel when target receives hostile action
-- Epic targets gain an immunity to Root and Will not multi-attack if the primary attack was avoided. effects of 30.0 seconds and duration is reduced to 3.3 seconds.
Just looking at the text, it "may" cast Pin on a melee hit. Is that 50/50? lol.. so I got as far as AddProc(Target, 1, 50) and panicked.

Lasting 10 seconds: we got timers? Not sure if the above convo was about this feature or not.
Triggers: I'll search the forums again, swore we talked about this one too

And of course, the dispells and Epic craziness.

Right now, it does the other stuff in Hunker Down, except this Pin spell.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Procs

Post by Jabantiz » Sun Dec 08, 2013 3:43 pm

The above discussion about timers was exactly for this type of scenario. The AddProc was right, would give the spell a 50% chance to go off when the proc does get triggered it will call the proc function.

Here is an example of a script I just made last night, handles 2 types of procs
http://mmoemulators.com:9301/eq2db/edit ... ell_script

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Implementing: Procs

Post by John Adams » Sun Dec 08, 2013 3:55 pm

Okay, so 3 things then...

1) How do I tell it "only on Melee hit", or is it safe to assume I WILL hit, so let's not split hairs? :)
2) Lasts 10 seconds... assuming this is the Root. How do I tell it to kill the proc after 10 secs?
3) Triggers 5 times a minute... Considering the duration of Hunker Down is 30s, does this mean it will continue to proc up to 5 times a minute beyond 30s... til when? Far as I know, once the duration expires, function remove() is called and we're done.

This is probably more an SOE Developer question lol... but this is my first Proc, so I need a little insight.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Implementing: Procs

Post by Jabantiz » Sun Dec 08, 2013 4:24 pm

John Adams wrote:1) How do I tell it "only on Melee hit", or is it safe to assume I WILL hit, so let's not split hairs? :)
Set the proc type, defined in entity.h

Code: Select all

#define PROC_TYPE_OFFENSIVE				1
#define PROC_TYPE_DEFENSIVE				2
#define PROC_TYPE_PHYSICAL_OFFENSIVE	3
#define PROC_TYPE_PHYSICAL_DEFENSIVE	4
#define PROC_TYPE_MAGICAL_OFFENSIVE		5
#define PROC_TYPE_MAGICAL_DEFENSIVE		6
#define PROC_TYPE_BLOCK					7
#define PROC_TYPE_PARRY					8
#define PROC_TYPE_RIPOSTE				9
#define PROC_TYPE_EVADE					10
#define PROC_TYPE_HEALING				11
#define PROC_TYPE_BENEFICIAL			12
So for melee hits only it would be 3 so AddProc(Target, 3, 50)
John Adams wrote:2) Lasts 10 seconds... assuming this is the Root. How do I tell it to kill the proc after 10 secs?
That is what the discussion was for, no way to kill it after the given time right now, leaning towards adding a timer for spells, haven't looked to much into it yet just been adding Say() to let the player know that part of the spell isn't working. We could create a spell from scratch to handle it as well but I think a timer would be easier as far as content dev goes.
John Adams wrote:3) Triggers 5 times a minute... Considering the duration of Hunker Down is 30s, does this mean it will continue to proc up to 5 times a minute beyond 30s... til when? Far as I know, once the duration expires, function remove() is called and we're done.
As soon as you call RemoveProc() in the remove function that is it. SOE decided having 5 times per minute was better then % chance per hit (I personally hate the per min). On live once the spell ends the proc will be removed as well, it won't last for the full min.

The easiest way, but not always accurate is to do math assuming a 3.0sec delay weapon, it can hit 20 times a min, so over 20 hits the proc can go off 5 times so the percent chance is 25% (5/20 = 0.25) per hit.

User avatar
Zcoretri
Team Member
Posts: 1642
Joined: Fri Jul 27, 2007 12:55 pm
Location: SoCal

Re: Implementing: Procs

Post by Zcoretri » Mon Dec 09, 2013 1:03 pm

John Adams wrote:Okay, guess who's confused again? <thumbs at self>

I am messing with Hunker Down, and I see what may or may not be a spell proc? and haven't quite figured out how to script it yet...
-- On a melee hit this spell may cast Pin on target of attack. Lasts for 10.0 seconds. Triggers about 5.0 times per minute.
-- Roots target
-- 5% chance to dispel when target takes damage
-- 5% chance to dispel when target receives hostile action
-- Epic targets gain an immunity to Root and Will not multi-attack if the primary attack was avoided. effects of 30.0 seconds and duration is reduced to 3.3 seconds.
Just looking at the text, it "may" cast Pin on a melee hit. Is that 50/50? lol.. so I got as far as AddProc(Target, 1, 50) and panicked.

Lasting 10 seconds: we got timers? Not sure if the above convo was about this feature or not.
Triggers: I'll search the forums again, swore we talked about this one too

And of course, the dispells and Epic craziness.

Right now, it does the other stuff in Hunker Down, except this Pin spell.
I did some observing in live last night and this is what I noticed with the wizard spell Shackle.
When the spell runs it's duration, or it is dispelled by hostile or damage, the icon changed to 'Root' and started to count down.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests