zadum4ivii
Official Terrarian
That's pretty easy to do. At least, pretty easy if you know how to program.
That's also the kind of thing where you have to know how to program.
You need to set Main.npcFrameCount[npc.type] to the total number of frames your NPC has. Then ExtraFramesCount needs to be set to the number of frames that are below the walking frames.
24 total frames, 9 frames below walking and 5 attacking frames.
Code:
Main.npcFrameCount[npc.type] = 24;
NPCID.Sets.ExtraFramesCount[npc.type] = 9;
NPCID.Sets.AttackFrameCount[npc.type] = 5;
Charon
Spazmatism
I am trying to spawn a stationary projectile like the electrosphere at the cursor position.Well, given that the method signature is
public static int NewProjectile(float X, float Y, float SpeedX, float SpeedY, int Type, int Damage, float KnockBack, int Owner = 255, float ai0 = 0f, float ai1 = 0f)
I'm not sure why you have most of those, especially Main.npc. What are you trying to do? Are you sure you don't want to override Shoot?
partitionpenguin
Duke Fishron
Will you add linux support as well? 0.5.0.1 changelog says you're 80% done with adding mac support.
360Chadscope
Pixel Pirate
So with 0.5 out, I'll re-ask my question: how to add things to an existing NPC's shop? I looked through the example mod and didn't find it. I also tried to copy the code from the town npc in the example mod to the ItemDrop file in my mod, but that didn't work either.
I didn't count 24 frames in your animation file.24 total frames, 9 frames below walking and 5 attacking frames.
Still getting that problem.Code:Main.npcFrameCount[npc.type] = 24; NPCID.Sets.ExtraFramesCount[npc.type] = 9; NPCID.Sets.AttackFrameCount[npc.type] = 5;
Well, the problem is, I don't have a Linux. So I don't have any way to get the Linux exe unless someone has both the Windows and Linux versions and makes a patch file for me. And even if I do have the Linux exe I have no way to test it (although I still would be able to get it to work eventually).Will you add linux support as well? 0.5.0.1 changelog says you're 80% done with adding mac support.
You'll need to use this hook in GlobalNPC:So with 0.5 out, I'll re-ask my question: how to add things to an existing NPC's shop? I looked through the example mod and didn't find it. I also tried to copy the code from the town npc in the example mod to the ItemDrop file in my mod, but that didn't work either.
https://github.com/bluemagic123/tMo...setupshopint-type-chest-shop-ref-int-nextslot
Charon
Spazmatism
Hey - I have a problem with the banner drops. Type 0 works fine, but the others aren't working. "Kill count unavailable", it says. Here's the coding;
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
namespace Matter.Tiles {
public class MonsterBanner : ModTile
{
public override void SetDefaults()
{
Main.tileFrameImportant[Type] = true;
Main.tileNoAttach[Type] = true;
Main.tileLavaDeath[Type] = true;
TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top);
TileObjectData.newTile.Height = 3;
TileObjectData.newTile.CoordinateHeights = new int[]{16, 16, 16};
TileObjectData.newTile.StyleHorizontal = true;
TileObjectData.newTile.StyleWrapLimit = 111;
TileObjectData.addTile(Type);
dustType = -1;
mapColor = new Color(13, 88, 130);
mapName = "Banner";
}
public override void KillMultiTile(int i, int j, int frameX, int frameY)
{
int style = frameX / 18;
string item;
switch(style)
{
case 0:
item = "StalkerBanner";
break;
case 1:
item = "LivingShadowBanner";
break;
case 2:
item = "PlasmaSpectreBanner";
break;
default:
return;
}
Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType(item));
}
public override void NearbyEffects(int i, int j, bool closer)
{
if(closer)
{
Player player = Main.player[Main.myPlayer];
int style = Main.tile[i, j].frameX / 18;
string type;
switch(style)
{
case 0:
type = "Stalker";
break;
case 1:
type = "LivingShadow";
break;
case 2:
type = "PlasmaSpectre";
break;
default:
return;
}
player.NPCBannerBuff[mod.NPCType(type)] = true;
player.hasBanner = true;
}
}
}}
Charon
Spazmatism
I didn't count 24 frames in your animation file.
Well, the problem is, I don't have a Linux. So I don't have any way to get the Linux exe unless someone has both the Windows and Linux versions and makes a patch file for me. And even if I do have the Linux exe I have no way to test it (although I still would be able to get it to work eventually).
You'll need to use this hook in GlobalNPC:
https://github.com/bluemagic123/tMo...setupshopint-type-chest-shop-ref-int-nextslot
And, the binding a NPC to another NPC has been rough. Do you have the decompiled coding for the Creeper enemy and/or Riders and their mounts?
Passthejampls
Official Terrarian
Do the expert mode zombies use a different AI to the normal ones?
Passthejampls
Official Terrarian
Also is it possible to have an accessory give a buff but make it so the buff icon doesn't show?
Starblaster11
Golem
Currently buffs aren't actually supported so your going to have to wait to ask that question again in 0.5.1.Also is it possible to have an accessory give a buff but make it so the buff icon doesn't show?
Passthejampls
Official Terrarian
I mean vanilla buffsCurrently buffs aren't actually supported so your going to have to wait to ask that question again in 0.5.1.
Starblaster11
Golem
Ah ok I wish I could help you there then. I'm just not incredibly good at coding yet though.I mean vanilla buffs
Alright, GUIDE TO MOUNTED NPCs!!!!And, the binding a NPC to another NPC has been rough. Do you have the decompiled coding for the Creeper enemy and/or Riders and their mounts?
Here is something I made from looking at the Scutlix. Note that these types of NPC seem to consist of 3 NPCs, lets call them Top, Bottom, and TopAlone.
- Top is the only one that is spawned naturally through CanSpawn. When it is spawned, it immediately spawns a Bottom to go with it. The AI code from then on just mimics the Bottoms position, velocity, and spriteDirection. When bottom is dead, the AI code tells it to transform into TopAlone npc.
- Bottom controls how the NPCs move as a unit. When it moves, Top moves with it automatically. Can be programmed in a similar manner to any other NPC.
- TopAlone is the NPC that is created when Bottom dies. Can be programmed in a similar manner to any other NPC.
- Bottom and TopAlone don't spawn naturally (well, you can if you want, doesn't matter either way.)
- Top's AI code must spawn Bottom, mimic it's behavior, and transform into a self moving NPC on Bottoms death.
Here it is in action.

Passthejampls
Official Terrarian
This looks useful, and erm... lovely spritesSNIP SNAP!
Haha, I try.This looks useful, and erm... lovely sprites
They still use aistyle 3, but seem to have some some extra coding. It's not immediately clear to me what the code does though, but it probably is for the Expert only "claw attack"Do the expert mode zombies use a different AI to the normal ones?
Not really, all buffs should show up. Are you trying to actually give a buff? or just give the effects of the buff? I think if you wanted to give the effects of a buff it might be possible.Also is it possible to have an accessory give a buff but make it so the buff icon doesn't show?
Passthejampls
Official Terrarian
I want to give it the effects of the fire imbue potionNot really, all buffs should show up. Are you trying to actually give a buff? or just give the effects of the buff? I think if you wanted to give the effects of a buff it might be possible.
mrr00s
Terrarian
I like that items shows up if the mod is disabled.
But when you disable a mod, load the game, get an disabled item, update the mod to a new version, load the game again, the disabled items wont be upgraded/linked to the new version of the mod and is lost forever.
But when you disable a mod, load the game, get an disabled item, update the mod to a new version, load the game again, the disabled items wont be upgraded/linked to the new version of the mod and is lost forever.
Are you sure that neither the mod's internal name nor the item's internal name has changed in updating the mod?I like that items shows up if the mod is disabled.
But when you disable a mod, load the game, get an disabled item, update the mod to a new version, load the game again, the disabled items wont be upgraded/linked to the new version of the mod and is lost forever.
zadum4ivii
Official Terrarian
God, it's 26... I'm too stupid.I didn't count 24 frames in your animation file.
Passthejampls
Official Terrarian
We've all been thereGod, it's 26... I'm too stupid.
Similar threads
- Replies
- 40
- Views
- 23K
- Replies
- 5
- Views
- 1K
- Replies
- 893
- Views
- 891K
- Sticky
- Replies
- 270
- Views
- 264K
- Locked
- Replies
- 234
- Views
- 48K
-
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.