Standalone [1.3] tModLoader - A Modding API

Im sorry for being a pain in the arse, but it isnt working. Truly sorry.
Code:
    if(!npc.wet)
        return false;
Oh, I didn't notice this. I guess this is an underwater NPC.....right? I should work if it is underwater......where is your canSpawn anyway? Anyway, you can move that code below the other TargetClosest if you want it to shoot above water too.
[DOUBLEPOST=1453514399,1453514069][/DOUBLEPOST]
Here is what I have for the minion
public override void CheckActive()
{
Player player = Main.player[projectile.owner];
EnergyPlayer modPlayer = (EnergyPlayer)player.GetModPlayer(mod, "EnergyPlayer");
if (player.dead)
{
modPlayer.vampireMinion = false;
}
if (modPlayer.vampireMinion)
{
projectile.timeLeft = 2;
public override void Update(Player player, ref int buffIndex)
{
EnergyPlayer modPlayer = (EnergyPlayer)player.GetModPlayer(mod, "EnergyPlayer");
if (player.ownedProjectileCounts[mod.ProjectileType("VampireSlime")] > 0)
{
modPlayer.vampireMinion = true;
}
if (!modPlayer.vampireMinion)
{
player.DelBuff(buffIndex);
buffIndex--;
}
else
{
player.buffTime[buffIndex] = 18000;
}
}
It does kill the minions when I die.
Are you extending the minion.cs from ExampleMod or something?
 
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace EpicnessMod.NPCs
{
    public class BloodySlime : ModNPC
    {
public override void SetDefaults()
        {
            npc.name = "Bloody Slime";
            npc.lifeMax = 55;
            npc.damage = 40;
            npc.defense = 45;
            npc.knockBackResist = 0.1f;
            npc.width = 36;
            npc.height = 24;
            animationType = NPCID.MotherSlime;
            npc.aiStyle = 1;
            npc.npcSlots = 1f;
            npc.noGravity = false;
            npc.soundHit = 1;
            npc.soundKilled = 6;
            Main.npcFrameCount[npc.type] = 2;
            npc.value = Item.buyPrice(0, 0, 30, 5);
            npc.buffImmune[BuffID.Poisoned] = true;
            npc.buffImmune[BuffID.Venom] = true;
            banner = npc.type;
            bannerItem = mod.ItemType("BloodySlimeBanner");
        }
        public override void NPCLoot()
        {
         Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType ("BloodGel"));
        }
        public override float CanSpawn(NPCSpawnInfo spawnInfo)
        if (Main.bloodMoon)
        {
            return 1f;
        }
  
}
}
How do I get a monster to spawn on a blood moon?

When I put (Main.bloodMoon) I get this error
c:\Users\Julian Romero\Documents\My Games\Terraria\ModLoader\Mod Sources\EpicnessMod\NPCs\BloodySlime.cs(38,57) : error CS1002: ; expected

c:\Users\Julian Romero\Documents\My Games\Terraria\ModLoader\Mod Sources\EpicnessMod\NPCs\BloodySlime.cs(39,3) : error CS1519: Invalid token 'if' in class, struct, or interface member declaration

c:\Users\Julian Romero\Documents\My Games\Terraria\ModLoader\Mod Sources\EpicnessMod\NPCs\BloodySlime.cs(39,21) : error CS1519: Invalid token ')' in class, struct, or interface member declaration
Here is the npc's code
 
It's not that tModLoader doesn't work, it's that music doesn't work.

What do you mean? The vanilla music conflicts with tmodloader in some way?

Sorry if I'm coming across as demanding, it just feels like my posts are being lost because this thread is pretty active.
 
Well, methods need { } around them, and you can't have a method that has a chance not to return a value.

When I put that code in I got this error

c:\Users\Julian Romero\Documents\My Games\Terraria\ModLoader\Mod Sources\EpicnessMod\NPCs\BloodySlime.cs(38,56) : error CS1002: ; expected

c:\Users\Julian Romero\Documents\My Games\Terraria\ModLoader\Mod Sources\EpicnessMod\NPCs\BloodySlime.cs(39,1) : error CS1519: Invalid token 'if' in class, struct, or interface member declaration

c:\Users\Julian Romero\Documents\My Games\Terraria\ModLoader\Mod Sources\EpicnessMod\NPCs\BloodySlime.cs(39,19) : error CS1519: Invalid token ')' in class, struct, or interface member declaration
 
What do you mean? The vanilla music conflicts with tmodloader in some way?

Sorry if I'm coming across as demanding, it just feels like my posts are being lost because this thread is pretty active.
It means there is a bug on Mac/Linux when decoding MP3 files. Anyway, Tremor mod has a new version that works since the mp3 files were removed.

When I put that code in I got this error

c:\Users\Julian Romero\Documents\My Games\Terraria\ModLoader\Mod Sources\EpicnessMod\NPCs\BloodySlime.cs(38,56) : error CS1002: ; expected

c:\Users\Julian Romero\Documents\My Games\Terraria\ModLoader\Mod Sources\EpicnessMod\NPCs\BloodySlime.cs(39,1) : error CS1519: Invalid token 'if' in class, struct, or interface member declaration

c:\Users\Julian Romero\Documents\My Games\Terraria\ModLoader\Mod Sources\EpicnessMod\NPCs\BloodySlime.cs(39,19) : error CS1519: Invalid token ')' in class, struct, or interface member declaration
I'm not a mind reader....so I don't know what you changed, but looks like you didn't do it right. You can code in Visual Studio if you can't figure out syntax.

When I equip my pet item, it gives me the buff, but when I just use the item, the buff doesn't show up. Any way to fix this?
Ok, I just noticed this on ExamplePet as well. I'll look into it. I don't know the last time I used a pet from inventory though, so I wouldn't worry too much about it.
[DOUBLEPOST=1453516387,1453516278][/DOUBLEPOST]
I am using the Minion.cs
Are you doing ModPlayer.ResetEffects()?
 
Are you doing ModPlayer.ResetEffects()?
I tried to use this earlier and I got an error.
Error CS1518 Expected class, delegate, enum, interface, or struct
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;

namespace EnergyMod
{
public class EnergyPlayer : ModPlayer
{
public bool vampireMinion = false;
}

public override void ResetEffects()
{
vampireMinion = false;
}
}
 
Anybody know if Glow Mask have been added to tmodloader yet?
What I basically mean is the part of textures that make only specific parts glow like how Lunar Pickaxes only have certain parts glow
 
When I equip my pet item, it gives me the buff, but when I just use the item, the buff doesn't show up. Any way to fix this?
K, figured it out, add this to the item:
Code:
        public override void UseStyle(Player player)
        {
            if (player.whoAmI == Main.myPlayer && player.itemTime == 0)
            {
                player.AddBuff(item.buffType, 3600, true);
            }
        }
I tried to use this earlier and I got an error.
Error CS1518 Expected class, delegate, enum, interface, or struct
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;

namespace EnergyMod
{
public class EnergyPlayer : ModPlayer
{
public bool vampireMinion = false;
}

public override void ResetEffects()
{
vampireMinion = false;
}
}
Move the method into the class. (Move ResetEffects{....} up into the {} of EnergyPlayer)
 
K, figured it out, add this to the item:
Code:
        public override void UseStyle(Player player)
        {
            if (player.whoAmI == Main.myPlayer && player.itemTime == 0)
            {
                player.AddBuff(item.buffType, 3600, true);
            }
        }

Move the method into the class. (Move ResetEffects{....} up into the {} of EnergyPlayer)
Thanks.
 
Anybody know if Glow Mask have been added to tmodloader yet?
What I basically mean is the part of textures that make only specific parts glow like how Lunar Pickaxes only have certain parts glow
K, figured it out, add this to the item:
Code:
        public override void UseStyle(Player player)
        {
            if (player.whoAmI == Main.myPlayer && player.itemTime == 0)
            {
                player.AddBuff(item.buffType, 3600, true);
            }
        }

Move the method into the class. (Move ResetEffects{....} up into the {} of EnergyPlayer)
So are glow mask in tmodloader?
 
K, figured it out, add this to the item:
Code:
        public override void UseStyle(Player player)
        {
            if (player.whoAmI == Main.myPlayer && player.itemTime == 0)
            {
                player.AddBuff(item.buffType, 3600, true);
            }
        }

Move the method into the class. (Move ResetEffects{....} up into the {} of EnergyPlayer)
How do I make a custom sound play when a projectile spawns/despawns?
 
How do I make a custom sound play when a projectile spawns/despawns?
A Projectile? Examplemod has a few examples of using Main.PlaySound. call it when you spawn the projectile and prekill I guess. Check the docs for the specifics.
[DOUBLEPOST=1453523944,1453523831][/DOUBLEPOST]
So are glow mask in tmodloader?
You'll need to do stuff with PlayerLayers and PostDrawInWorld. I don't have an example or experience, sorry.
 
A Projectile? Examplemod has a few examples of using Main.PlaySound. call it when you spawn the projectile and prekill I guess. Check the docs for the specifics.
[DOUBLEPOST=1453523944,1453523831][/DOUBLEPOST]
You'll need to do stuff with PlayerLayers and PostDrawInWorld. I don't have an example or experience, sorry.
I guess I will search into this when I get the chance
I should just be able to compare code with the source anways :p
 
Ugh one last bit of help. With this code, I am trying to spawn 2 mobs with the same item. What I did wa
Code:
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Enderuim.Items
{
    public class DoomWhistle : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Doom Whistle";
            item.width = 60;
            item.height = 48;
            item.maxStack = 99;
            item.value = 100;
            item.rare = 10;
            item.useAnimation = 45;
            item.useTime = 45;
            item.useStyle = 4;
            item.useSound = 44;
            item.consumable = true;
        }
       
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(1006);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
       
                public override bool CanUseItem(Player player)
        {
            return !NPC.AnyNPCs(mod.NPCType("Angelic")) && !NPC.AnyNPCs(mod.NPCType("Demonic"));
        }
                public override bool UseItem(Player player)
        {
            NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Trio"));
            Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 0);
            return true;
        }
    }
}
s i put the NPCs (Angel and Demonic) into a folder called Trio. The game loaded it, but it just says "Has awoken1" and nothing else.
 
I updated to the recent version of tmodloader, but when I open my world the framerate is terrible, but when I revert back to the previous version the framerate is fine. Does anyone know the cause for this?
 
Back
Top Bottom