Am I forgetting something?

Place to get help with not working mods / modding interface.
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Am I forgetting something?

Post by ficolas »

Im making a new mod to test some stuff ("player animations")
But the mod doesnt seem to work (seems to be ignored by the game)

http://www.mediafire.com/download/lk61j ... wimmod.zip
The download.
Im sure im forgetting something really basic but that I have only done once so I dont remember...
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Am I forgetting something?

Post by FreeER »

ficolas wrote:Im sure im forgetting something really basic
The folder is called 'swimmod' the "name" field in the info is 'Swim mod', you've switched the name and title info. also Factorio complains about a character-clothes-run-mask.png and from looking at the code the player might 'glitch' back and forth from player to player-swimming when in water (though I couldn't test). This will also lead to the player losing their inventory...
I used this function to swap inventory with the illness prototype mod I did recently

Code: Select all

function transferPlayerItems(old, new)
  if new==nil then game.player.print("new is nil!") return end
  local inv = {}
    inv[1] = old.getinventory(defines.inventory.playerquickbar).getcontents()
    inv[2] = old.getinventory(defines.inventory.playermain).getcontents()
    inv[3] = old.getinventory(defines.inventory.playerguns).getcontents()
    inv[4] = old.getinventory(defines.inventory.playertools).getcontents()
    inv[5] = old.getinventory(defines.inventory.playerammo).getcontents()
    inv[6] = old.getinventory(defines.inventory.playerarmor).getcontents()
  for _,table in ipairs (inv) do
    for name, count in pairs(table) do
      new.insert{name=name,count=count}        
    end
  end
  game.player.character=new
  old.destroy()
end
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Am I forgetting something?

Post by ficolas »

Just remembered, second time I post the same question... but the first time was months ago... or maybe almost a year ago.
Yea I know the player looses his inventory and health, I was just testing with this code
Also water is still "solid" and why would character switch between one and the other when in water?
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Am I forgetting something?

Post by FreeER »

It's an easy thing to forget...hm I believe I entirely forgot about player health when doing that illness mod, shame on me :lol: I also just realized it'd be quite easy to tweak that function to loop from 1 to 10 (arbitrary number) and get all possible inventories so it could be used with more than just the player (and if the player got additional inventories in the future).
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Am I forgetting something?

Post by ficolas »

Also does that function work with the toolbar?
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Am I forgetting something?

Post by FreeER »

ficolas wrote:Also does that function work with the toolbar?
The toolbar is defines.inventory.playerquickbar, so yes.

edit: ah, hm, not sure if that works with the secondary quickbar due to how it's coded in C++ (simply switching secondary quickbar to be the primary). Would have to test to find out but if it doesn't you'd have to talk to the devs about changing how the source implements it.
edit: Also water is still "solid" and why would character switch between one and the other when in water?, hm took another look at the code and it seems I read it wrong there :) ignore that comment lol
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Am I forgetting something?

Post by ficolas »

The mod works really derpy xD
sometimes the player walks on water (jesus! D:), biters can also walk on water (quite ob) and when the player goes in water, biters stop following him, and will never ever moar follow him.
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Am I forgetting something?

Post by FreeER »

Well, now just give me the power to throw fireballs and cause earthquakes by clicking and I'll be a happy player :lol:
Post Reply

Return to “Modding help”