Starbound

Starbound

Not enough ratings
[modding resource] Weapon Status Effect Script
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
2.068 KB
13 Mar, 2017 @ 6:51pm
1 Change Note ( view )

Subscribe to download
[modding resource] Weapon Status Effect Script

Description
this is a modding resource; it doesn't add any content by itself

Adds a script that, when in an activeitem context, will add the status effects mentionned in the item's config's statusEffects array.
The idea was to have weapons act like armors regarding status effects.

I see two ways of using it:

- When making a custom weapon, in the item's config, add the script in the scripts array and a statusEffects array, such as, for example in a gun
"statusEffects" : ["mudslow"], "scripts" : ["/items/active/weapons/ranged/gun.lua", "/scripts/weaponstateffect.lua"],
this would add the "mudslow" status effect whenever the gun's held.

- When spawning a custom item. For example, this command
/spawnitem broom 1 '{"scripts": ["/items/active/unsorted/broom/broom.lua", "/scripts/weaponstatuseffect.lua"], "statusEffects": ["mudslow"]}'
will spawn a broom that'll apply the mudslow status effect. As activeitem scripts are client-side, items spawned with this script, such as above, should work when used on servers / next to people who aren't running this mod.
But!! if you give someone who doesn't have this mod an item with the script referenced, they'll crash whenever they're going to hold it. This means they won't even be able to take it from their inventory into the bin. Subscribbing to this mod then deleting the item then unsubscribbing, or an inventory editor will be required to fix it. Same goes for uninstalling this mod.

tl;dr don't give an item you've made with the above command to someone who doesn't have this mod

Giving a non-existant status effect will probably not do anything except fill your log file with warnings, but still better to avoid.


This should be, otherwise, compatible with everything.
14 Comments
꧁ღⳆ⧹EvelithⳆ⧹ღ꧂ 12 Jul, 2018 @ 7:46am 
Thank you! :hearts:
🐱  [author] 12 Jul, 2018 @ 6:53am 
Heck, it seems I got the name wrong in my example and you're the first to try it; the script's path should be "asset/scripts/weaponstateffect.lua", instead of "weaponstateffecttest".
Sorry! :sadcat:
꧁ღⳆ⧹EvelithⳆ⧹ღ꧂ 12 Jul, 2018 @ 6:21am 
Hi there! I'm having a small problem, as soon as I add the script:["/items/active/weapons/melee/meleeweapon.lua", "/scripts/weaponstateffecttest.lua"],
to a melee weapon, I get an error:
Exception caught in client main-loop (AssetException) Error loading asset/scripts/weaponstateffecttest.lua
Any ideas?

... I just noticed, this was posted 2017 T_T
I still hope someone can help me!
🐱  [author] 29 May, 2017 @ 3:23am 
v (*along with your starbound.log file
🐱  [author] 29 May, 2017 @ 3:23am 
Seems like a typical Lua error; Your log file should contain additional infos, but if you need help, it'd probably be easier to get some if you made a thread to post your files along with your http://community.playstarbound.com/threads/how-to-report-mod-errors-fixing-most-problems-yourself-v1-1.69198/ on the Starbound's modding forums: http://community.playstarbound.com/forums/starbound-modding.111/
Bellum 28 May, 2017 @ 4:41pm 
It's me again, back with another question lol. I made a custom weapon and I think I did everything properly, but instead of giving a status effect when I hold the weapon, it just loses its animation and can't attack anymore. Do you know what might be going on? (I can post the whole .activeitem script if that helps)
🐱  [author] 25 May, 2017 @ 9:55am 
(woops, seems like I messed up my bold tag :CatWish:
Bellum 25 May, 2017 @ 9:54am 
Neat. Thanks.
🐱  [author] 25 May, 2017 @ 9:47am 
Yep, as said in the bold " But![/but]" part, and as implied by the "[modding resource]" thingy. Steam provides a "required mods" feature, but if you don't want to have your users do this, you could unpack this mod and include it in your own :Neko:
Bellum 25 May, 2017 @ 9:05am 
Quick question, if I were to use this script on an item in a mod, would people who installed that mod have to install this resource as well?