Jump to content

Need help with teleportation powers


nepetaleijontheoneandonly

Recommended Posts

So, I want my character to be able to "telepoof" (but it won't be called that, it'd be called "glitch") without holding the lazy explorer or even having it in her inventory. It'd just be a thing she'd be able to do on her own, at the cost of 10 sanity, and when her sanity got too low, she'd start occasionally doing it at random, like willow's low sanity fires.

 

Can someone give me some help? (I sure do hope I'm posting this in the right place)

First off, gameplay concerns: Will this override walking, or be a right-click action?

 

Secondly, you need to define the Action and somehow tell the game using a component, that the action can be performed at all times (if playing that character) (don't ask me why the player can't declare that themselves). Or override walking and skip the component stuff. It seems reasonable to copy most of the action data from the blink action. Keep in mind to set the priority low enough, or else it will prevent other things.

 

Here's how to make an action in modmain:

--This action will be remote detonating explosives (I've made this for a character mod)ACTIONS.DETONATE = GLOBAL.Action(2,true) -- "2" is the priority, set this VERY low, "true" is whether the action is instant or requires a stategraph handle (I assume your action doesn't need an animation before firing? Then keep it true), adding another "true" makes it Right-Click, the last argument would be the most distance (4 = a ground tile)(keep in mind you need to have "true" or "false" in the third field when setting the distance)ACTIONS.DETONATE.str = "Detonate" --This is the name displayedACTIONS.DETONATE.id = "DETONATE" --this is odd, but necessary, just repeat the capitalized nameACTIONS.DETONATE.fn = function(act) --this is the function that fires when "acted"	--your stuff here (look up the blink action from actions.lua?)end

First off, gameplay concerns: Will this override walking, or be a right-click action?

 

Secondly, you need to define the Action and somehow tell the game using a component, that the action can be performed at all times (if playing that character) (don't ask me why the player can't declare that themselves). Or override walking and skip the component stuff. It seems reasonable to copy most of the action data from the blink action. Keep in mind to set the priority low enough, or else it will prevent other things.

 

Here's how to make an action in modmain:

--This action will be remote detonating explosives (I've made this for a character mod)ACTIONS.DETONATE = GLOBAL.Action(2,true) -- "2" is the priority, set this VERY low, "true" is whether the action is instant or requires a stategraph handle (I assume your action doesn't need an animation before firing? Then keep it true), adding another "true" makes it Right-Click, the last argument would be the most distance (4 = a ground tile)(keep in mind you need to have "true" or "false" in the third field when setting the distance)ACTIONS.DETONATE.str = "Detonate" --This is the name displayedACTIONS.DETONATE.id = "DETONATE" --this is odd, but necessary, just repeat the capitalized nameACTIONS.DETONATE.fn = function(act) --this is the function that fires when "acted"	--your stuff here (look up the blink action from actions.lua?)end

Thanks for the help! Though the Blink action doesn't seem to work, I'm gonna try some code from the blinkstaff.lua itself -

And yes, it's a right click action -

Wish me luck!

@nepetaleijontheoneandonly

u could also use hotkeys, put this in your modmain:

 

GLOBAL.TheInput:AddKeyDownHandler(GLOBAL.KEY_R, function()local player = GLOBAL.GetPlayer()if player and player.prefab=="yourcharactersprefabname" thenlocal TheInput = GLOBAL.TheInputif not GLOBAL.IsPaused() and not TheInput:IsKeyDown(GLOBAL.KEY_CTRL) and not TheInput:IsKeyDown(GLOBAL.KEY_SHIFT) then--here comes the stuff u want to happen when u press Rend end end end)

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...