Making a tower defense : help with moving entities.

Discussion in 'Plugin Development' started by TorkatoR, Feb 7, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    TorkatoR

    Hi there !

    I'm new with the Bukkit library (and Minecraft plugins), and I tried to make some plugin myself.

    I'd like to make a tower defense plugin in Minecraft to train me of Java code. Here is the plan (ALL PLANNED !) :

    - Making a /setspawn command to place entities spawns on the tower defense map.
    - Creating waves events with a timer and a specific number of entities per wave.
    - Moving entities from one place to another (a right line for the moment).

    The hardest part is the third one. I really don't know how to move an entity in-game. I read the Ivan's topic to make a living entity walk to a specific tile, but i really don't understand any part. :(

    Can someone help me to understand or give me a way to use the PathfinderGoal ?
    Thanks Bukkit Community ! :D
     
  2. Offline

    RawCode

    you can look at standart pathfinder goald on standart mobs...
     
  3. Offline

    ZeusAllMighty11

    I've created a Tower Defense gamemode.. basically I just used the ControllableMobsAPI and the rest was simple. (Use BukkitRunnables, Scoreboards, etc)
     
  4. Offline

    TorkatoR

    Thanks for your replies guys !

    How do i use ControllableMobsAPI ? Should i add it in Eclipse as an external jar ? :)

    ~= UPDATE =~

    Okey, i tried to code a "zombie controller" ! :D Here is the code :


    Code:java
    1. package me.TorkatoR.TowerDefense;
    2.  
    3. import java.util.UUID;
    4.  
    5. import org.bukkit.Location;
    6. import org.bukkit.entity.Zombie;
    7. import org.bukkit.plugin.java.JavaPlugin;
    8.  
    9. import de.ntcomputer.minecraft.controllablemobs.api.ControllableMob;
    10. import de.ntcomputer.minecraft.controllablemobs.api.ControllableMobActions;
    11. import de.ntcomputer.minecraft.controllablemobs.api.ControllableMobAttributes;
    12. import de.ntcomputer.minecraft.controllablemobs.api.ControllableMobs;
    13. import de.ntcomputer.minecraft.controllablemobs.api.ai.AIPart;
    14. import de.ntcomputer.minecraft.controllablemobs.api.ai.behaviors.AIRandomLookaround;
    15. import de.ntcomputer.minecraft.controllablemobs.api.ai.behaviors.AITargetNearest;
    16. import de.ntcomputer.minecraft.controllablemobs.api.attributes.AttributeModifier;
    17. import de.ntcomputer.minecraft.controllablemobs.api.attributes.ModifyOperation;
    18.  
    19. public class TowerDefense extends JavaPlugin {
    20.  
    21. Zombie zombie;
    22. // Location loc = loc;
    23.  
    24. ControllableMob<Zombie> controlledEntity = ControllableMobs.putUnderControl(zombie, true);
    25. controlledEntity = controlledEntity.getAI().clear();
    26. AIRandomLookaround behavior = new AIRandomLookaround();
    27. AIPart<Zombie, AIRandomLookaround> aiPart = controlledEntity.getAI().addBehavior(behavior);
    28. controlledEntity = controlledEntity.getActions().clearActions();
    29. controlledEntity = controlledEntity.getActions().moveTo(/* Put Location here */);
    30. ControllableMobs.releaseControl(controlledEntity);
    31. }



    But I have some errors :
    "Syntax error on token ";", { expected after this token."
    "Syntax error, insert "}" to complete ClassBody."

    Any ideas bros ? :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  5. Offline

    MunchMallow

    That's exactly how you do it, just like when you are adding craftbukkit in Eclipse :)
     
  6. Offline

    TorkatoR

    But i still have those errors, how can i resolve them ?

    UP. c:

    Still no ideas how can i resolve those errors. >.<

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  7. Offline

    Luke_Lax

    Those are just basic misplaced bracket errors, go through your code and position the brackets correctly, don't rely on copy and paste
     
Thread Status:
Not open for further replies.

Share This Page