Jump to content

Help with projectile mod


Recommended Posts


I used some code to give my character the ability to shoot fireballs without needing to equip a weapon. However, now I'm unable to plant things, since I'm using "right-click" to shoot the fireball. I'm hoping someone can possibly see where I screwed up and can help me fix my problem. Any help would be greatly appreciate fellow starvers!

 

 CODE IN QUESTION:

(Note that I put this in my character's modmain folder.)

local CASTFIRE = AddAction("CASTFIRE", "Blast into Oblivion!", function(act)    
local projectile = GLOBAL.SpawnPrefab("fire_projectile")    
projectile:AddComponent("weapon")    
projectile.Transform:SetPosition(act.doer.Transform:GetWorldPosition())    
projectile.components.projectile:Throw(act.doer, act.target)    
return true
end)
CASTFIRE.rmb = true
CASTFIRE.distance = 10
AddStategraphActionHandler("wilson", GLOBAL.ActionHandler(GLOBAL.ACTIONS.CASTFIRE, "throw"))
AddPrefabPostInit("vegeta", function(inst)    
inst:DoTaskInTime(2, function()        
local self = inst.components.playeractionpicker        
self.rightclickoverride = function(inst, target, position)            
local actions = {}            
if target and target.replica.health and not (inst == target) then                
table.insert(actions, GLOBAL.ACTIONS.CASTFIRE)            
end            
return self:SortActionList(actions, target)        
end    
end)
end)

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...