Page 1 of 1

Indicating a player is doing action.

Posted: Thu Sep 17, 2015 10:53 pm
by uwill99
Is there a value in scripting that would indicate a player is starting the action? Or a value that is specific to player character that I can use in a script? I mean this in terms of differentiating player characters versus non-player characters. I'm currently using

Code: Select all

function onSpellCast(caster,target,spell)
	if caster:isPC() then
		local dmg = doElementalNuke(25*SPELL_POWER,1,caster,spell,target,false,1.0);
		return dmg;
	else
		local dmg = doElementalNuke(25,1,caster,spell,target,false,1.0);
		return dmg;
	end
end;


EDIT: put in working code and kjLotus' help

Re: Indicating a player is doing action.

Posted: Fri Sep 18, 2015 12:53 am
by kjLotus
caster:isPC()

all functions callable to entities from lua are here: https://github.com/DarkstarProject/dark ... seentity.h

Re: Indicating a player is doing action.

Posted: Fri Sep 18, 2015 2:17 am
by uwill99
My code actually caused the gameserver to crash when npcs casted because I didn't understand how to use "else" statements or how to use "end" properly. It's fixed and everything is working well with your addition. Thanks again, kjLotus. For anyone stuck in the same situation I am (using the old spell luas), I amended the code in the first post for spells using the variable stat "SPELL_POWER" from settings.lua.