How doesn't it work? Could you show your code?I think I found a bug UseItem doesn't work for me. Does anyone else having this problem?
Do any vanilla bosses do that? I think sprite effects will only flip horizontally.Could anyone tell me what to put in public override void BossHeadSpriteEffects(ref SpriteEffects spriteEffects) to make it actually rotate the boss icon? Putting it in visual studio isn't helping me out for once.
Ah that's what I meant, like it mirroring right? That's what I'm looking for anyway...Do any vanilla bosses do that? I think sprite effects will only flip horizontally.
Bummer.Sadly, no. Nobody on the tModLoader team has the GOG version, so they can't make tModLoader work for GOG.
To increase the max health/mana more, you'll have to create some fields in your ModPlayer class, increase player.statLifeMax2 or player.statManaMax2 based on those stats, and save/load those fields in SaveCustomData and LoadCustomData.Thanks for your help since the start of porting my mod. I successfully made my own Ui and it works. Even tho the old ui still draw. I got one last question: How can we surpass max mana and max health in tmodloader. As I saw the max health can go beyond but does save at 500. So when you load again you lost the over health. The mana can't go over 400 as far as I tried. If someone got an answer I would be happy to work with it. Thank you.
And so far the mod is coming great togheter. Had to change a good part of it to port it to tModLoader.
The bug's somewhere in your mod; can you show us the code?I think I found a bug UseItem doesn't work for me. Does anyone else having this problem?
You can make the boss head icon flip by setting spriteEffects to either SpriteEffects.FlipHorizontally or SpriteEffects.FlipVertically. SpriteEffects is in the Microsoft.Xna.Framework.Graphics namespace.Could anyone tell me what to put in public override void BossHeadSpriteEffects(ref SpriteEffects spriteEffects) to make it actually rotate the boss icon? Putting it in visual studio isn't helping me out for once.
if (Main.netMode != 1) //if not a client
{
int proNam = Projectile.NewProjectile(player.Center.X + (player.width + offsetX) * player.direction, (player.Center.Y + offsetY), (float)Math.Cos(player.itemRotation) * 3 * player.direction + (Main.rand.NextFloat() * 1f - 0.2f), (float)Math.Sin(player.itemRotation) * 3 * player.direction + (Main.rand.NextFloat() * 1f - 0.2f), mod.ProjectileType("NamPowerLead"), damage, knockBack, player.whoAmI);
namLeader = Main.projectile[proNam]; //this line needs to happen on a client also
if (Main.netMode == 2) //if a server
{
NetMessage.SendData(27, -1, -1, "", proNam, 0.0f, 0.0f, 0.0f, 0); //Sync clients with server
}
}
Sure here:The bug's somewhere in your mod; can you show us the code?
public override bool UseItem(Item item, Player player)
{
//Main.NewText("USE");
Main.NewText(Main.projectile.Length.ToString());
for(int m = 0; m < Main.projectile.Length; m++)
{
if(Main.projectile[m].type == mod.ProjectileType("CustomProjectile"))
{
CustomProjectile pro = (CustomProjectile)Main.projectile[m].modProjectile;
pro.test();
}
}
return true;
}
Hm, the solution would depend on what exactly you're trying to use proNam for. I would think that you could set it somewhere from the projectile's AI.I've got a bit of a conundrum here. I'm trying to spawn a projectile and store the projectile inside a field, but I'm having trouble getting it synced across a server.
I want namLeader to be set on clients and the server. I can't move it outside of the first if clause because it won't have access to proNam anymore.Code:if (Main.netMode != 1) //if not a client { int proNam = Projectile.NewProjectile(player.Center.X + (player.width + offsetX) * player.direction, (player.Center.Y + offsetY), (float)Math.Cos(player.itemRotation) * 3 * player.direction + (Main.rand.NextFloat() * 1f - 0.2f), (float)Math.Sin(player.itemRotation) * 3 * player.direction + (Main.rand.NextFloat() * 1f - 0.2f), mod.ProjectileType("NamPowerLead"), damage, knockBack, player.whoAmI); namLeader = Main.projectile[proNam]; //this line needs to happen on a client also if (Main.netMode == 2) //if a server { NetMessage.SendData(27, -1, -1, "", proNam, 0.0f, 0.0f, 0.0f, 0); //Sync clients with server } }
The way I see it, I either need to get the server set namLeader on all clients, or send proNam to all clients and have them use that to set namLeader. Any suggestions?
At the moment no. I'll add that to the to-do list.Is there any way to check if item is crafted?Like tAPI's hook OnCraft?
For example, if I craft some item(even vanilla one), there's random chance that it would have "someRandomVar" variable set to 1.
Can you show the rest of the item's code too? It doesn't help when we only have code that we already know isn't being called.Sure here:
the Main.NewText are just for testingCode:public override bool UseItem(Item item, Player player) { //Main.NewText("USE"); Main.NewText(Main.projectile.Length.ToString()); for(int m = 0; m < Main.projectile.Length; m++) { if(Main.projectile[m].type == mod.ProjectileType("CustomProjectile")) { CustomProjectile pro = (CustomProjectile)Main.projectile[m].modProjectile; pro.test(); } } return true; }
There is no more code it is inside a GlobalItemCan you show the rest of the item's code too?
Are you testing it on a ranged weapon (one that shoots)? If so, UseItem is not being called for ranged weapons (in my experience). You'll want to use the Shoot function for that instead.Sure here:
the Main.NewText are just for testingCode:public override bool UseItem(Item item, Player player) { //Main.NewText("USE"); Main.NewText(Main.projectile.Length.ToString()); for(int m = 0; m < Main.projectile.Length; m++) { if(Main.projectile[m].type == mod.ProjectileType("CustomProjectile")) { CustomProjectile pro = (CustomProjectile)Main.projectile[m].modProjectile; pro.test(); } } return true; }
Oh I tried changing UseItem with Shoot and it worked. ThanksAre you testing it on a ranged weapon (one that shoots)? If so, UseItem is not being called for ranged weapons (in my experience). You'll want to use the Shoot function for that instead.
Allrightiyo, no probs.Oh I tried changing UseItem with Shoot and it worked. Thanks![]()
At the moment no. I'll add that to the to-do list.