Indicating a player is doing action.

Post Reply
uwill99
Posts: 61
Joined: Tue Aug 12, 2014 11:28 pm

Indicating a player is doing action.

Post by uwill99 » Thu Sep 17, 2015 10:53 pm

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
Last edited by uwill99 on Fri Sep 18, 2015 2:19 am, edited 2 times in total.

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Indicating a player is doing action.

Post by kjLotus » Fri Sep 18, 2015 12:53 am

caster:isPC()

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

uwill99
Posts: 61
Joined: Tue Aug 12, 2014 11:28 pm

Re: Indicating a player is doing action.

Post by uwill99 » Fri Sep 18, 2015 2:17 am

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.

Post Reply