Jump to content

Function of prohibit targets


Recommended Posts

Hello.
I need your help with the function.
I want to prohibit the use "firestaff" and "staff_tornado" if the target has a tag (ownershiptag).

if target:HasTag(ownershiptag) and target:HasTag("structure")  then

end

 

Edited by Tezumoto
Link to comment
Share on other sites

I already ended work with the "firestaff".
I was also able to prohibit the use "staff_tornado" on buildings.
But if you use "staff_tornado" on a living creature near to a building, it destroed.
Is it possible to completely remove the impact on buildings for "staff_tornado"?

Link to comment
Share on other sites

16 hours ago, Ultroman said:

See this topic.

 

Oh, thanks, but I'm not good at it all.
I decided to use this:

function remove_staff_tornado(prefab)
	local rec = GLOBAL.AllRecipes[prefab]
	rec.level = GLOBAL.TECH.LOST
	rec.nounlock = true
end
remove_staff_tornado("staff_tornado")

 

Link to comment
Share on other sites

8 hours ago, Ultroman said:

So you just removed the tornado staff from the game?

Yes, I could only that.
I can prohibit using as a target what can be destroyed with a hammer (spellcaster.lua) (line: 141-146):

local function IsWorkAction(action)
    return action == ACTIONS.CHOP
        --or action == ACTIONS.DIG
        --or action == ACTIONS.HAMMER
        or action == ACTIONS.MINE
end

I just add "--" for ACTION.DIG and ACTION.HAMMER.
It is working and people can't use tornado staff on structures and plants.
But this is only a prohibition of the target, but the impact itself remains.
If you use the tornado staff on a living creatures, then the buildings and plants are destroyed nearby.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...