I have a question. (I am using r11)
I want to have double Loot for every monster (including Vanilla)
But when I use the PostNPCLoot() hook, I do not have the monster object.
Am I correctly using PostNPCLoot() ? Or should I use other hook?
[GlobalMod]
public class GlobalNPC : ModNPC
{
//How much more loot we should get, implemented so we don't get an infinite loop of NPCLoot() calling PostNPCLoot(), which calls NPCLoot() again
int xmoreLoot = 1;
public override void PostNPCLoot()
{
if (xmoreLoot > 0)
{
xmoreLoot--;
npc.NPCLoot();
}
}
}
Thanks a lot, I just don't know the reference.
no... just no... don't do this. Do not call either of these hooks from within the other one, you will cause a circular reference issue and break things.Thanks a lot, I just don't know the reference.
Apart from this, I just wonder how to find those variables name. Also, if I call PreNPCLoot() inside PostNPCLoot(), will it call all the PreNPCLoot() from the other mod, or just call the one in my mod? If I want to call PreNPCLoot() from all other loaded mod, how can I do? Call base.PreNPCLoot()??
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Terraria;
using TAPI;
namespace ATest
{
public class GlobalNPC : TAPI.ModNPC
{
public override void PostNPCLoot()
{
Main.NewText("A1", 255, 25, 25, false);
}
}
}
You forgot your [GlobalMod] attribute, put it right above your class declaration like this-I just found that my PostNPCLoot() doesn't get called.
Code:using System; using System.Diagnostics; using System.Collections.Generic; using System.Text; using Microsoft.Xna.Framework; using Terraria; using TAPI; namespace ATest { public class GlobalNPC : TAPI.ModNPC { public override void PostNPCLoot() { Main.NewText("A1", 255, 25, 25, false); } } }
[GlobalMod]
public class GlobalNPC : ModNPC
{
//Code here
}
Thanks, but then I wonder why my overrided MidUpdate() in ModPlayer will still work without [GlobalMod] attribute.
His tutorials aren't outdated-snip-
Use the ModWorld.ModifyWorldGenTasks (or something like that) hook to add a task to the task list.I've worked a bit with the release now and it's great. The new hooks are so useful.
I only have one problem: How would I generate a fixed structure? Let's say, I want to create my own underground houses when creating a new world, how would I code that? Also, where would I put it? Is there a global world file?
Alright, got it. Though I still don't know how I'd do the generation itself. Has anyone done this yet?Use the ModWorld.ModifyWorldGenTasks (or something like that) hook to add a task to the task list.
DO NOT do the generation stuff there, but create a custom WorldGen task.
That completely depends on what you want to do.Alright, got it. Though I still don't know how I'd do the generation itself. Has anyone done this yet?
Main.tile[X, Y].active = true | false;
Main.tile[X, Y].type = TileDef.tile[<tile name>];
Main.tile[X, Y].wall = TileDef.wall[<wall name>];
Thanks! I'll play around with that.That completely depends on what you want to do.
General rule:
1. get the X and Y position of the tile you want to modify
2. use:
or a combination of them.Code:Main.tile[X, Y].active = true | false; Main.tile[X, Y].type = TileDef.tile[<tile name>]; Main.tile[X, Y].wall = TileDef.wall[<wall name>];
After testing these issues, I am unable to reproduce either in base tAPI. Try disabling all mods and attempting these things again and they are not an issue. Perhaps there is a mod interacting with them somehow?Some bugs for R11:
1. clicking loot all from piggy bank will sometimes crash the game
2. When I right click on the Old Man on the surface, the Dungeon Guardian appear...
You must rename Item into ItemsCould somebody help me, I've got a problem. I followed TheHuckleberryWill's basic item tutorial, and already something's gone wrong. A screenshot of the error and my code will be provided with this post. Please ignore the titles of the screenshot files and the caps in the title of the files as well. Thanks.
Just checked, the file is called Items.You must rename Item into Items