Fix up the first else with some {}s
Let's see your TaskId(int,int) method?
|
Can someone write the proper way to run this method?
I wrote this, but it didn't work for me.Code:public void AssignTask(int[][] Npc, int Amount) { if(c.TaskId == -1 && c.TaskAmount == -1) { int t = misc.random(Npc.length); int t2 = misc.random(Level1.length); if(Npc[t][1] <= c.playerLevel[18]) { c.DA().npctalking(c, 1597, "Your task is to slay", "Kill: " + c.GetNpcName(Npc[t][0])+"" , "Amount:" + Amount +"", ""); c.TaskId = Npc[t][0]; c.TaskAmount = Amount; } else c.DA().npctalking(c, 1597, "Your task is to slay", "Kill: " + c.GetNpcName(Level1[t2][0])+"" , "Amount:" + Amount +"", ""); c.TaskId = Level1[t2][0]; c.TaskAmount = Amount; } else if(c.TaskId != -1 && c.TaskAmount != -1) c.DA().npctalking(c, 1597, "Your task is to slay", "Kill: " + c.GetNpcName(c.TaskId)+"" , "Amount:" + c.TaskAmount +"", ""); } }
Been up for 2 days and am not thinking clearly, but it looks right to me.Code:if (NPCID == 1596) { Tasks.AssignTask(TaskId(Tasks.AssignTask.t, 0), TaskAmount); }
Fix up the first else with some {}s
Let's see your TaskId(int,int) method?
TaskId is a integer.
Code:public int TaskId = -1;
Just trying to call this method AssignTask(int[][] Npc, int Amount)
I tried calling it with this
TaskId = npc which is what the integer is calling.Code:if (NPCID == 1596) { Tasks.AssignTask(TaskId(Tasks.AssignTask.t, 0), TaskAmount); }
Well, this is what I am trying to use to call that method, which gives 2 errors.
The first error I know why its being thrown, because I am trying to call AssignTask as a variable, but the last error I am getting is a non-static method can not be called.Code:if (NPCID == 1596) { Tasks.AssignTask(TaskId(Tasks.AssignTask.t, 0), TaskAmount); }
Mind is just so cloudy right now and having problems thinking.[root@localhost ServerName]$ ./compiler
./server/players/client.java:8169: cannot find symbol
symbol : variable AssignTask
location: class server.players.Skills.Tasks
Tasks.AssignTask(TaskId(Tasks.AssignTask.t, 0), TaskAmount);
^
./server/players/client.java:8169: non-static method AssignTask(int[][],int) cannot be referenced from a static context
Tasks.AssignTask(TaskId(Tasks.AssignTask.t, 0), TaskAmount);
^
Note: ./server/server.java uses or overrides a deprecated API.
Note: Recompile with -Xlint: deprecation for details.
2 errors
It's not that, I just need this method
wrote into a call, simular to thisCode:public void AssignTask(int[][] Npc, int Amount)
Thats all I need written out.Code:AssignTask(TaskId(t, 0), TaskAmount);
So I can use it such as
Code:if (NPCID == 1596) { AssignTask(TaskId(t, 0), TaskAmount); }
Replace your method with this:
Also, methods should be un-capitalised.Code:public static void AssignTask(int[][] Npc, int Amount) { if(c.TaskId == -1 && c.TaskAmount == -1) { int t = misc.random(Npc.length); int t2 = misc.random(Level1.length); if(Npc[t][1] <= c.playerLevel[18]) { c.DA().npctalking(c, 1597, "Your task is to slay", "Kill: " + c.GetNpcName(Npc[t][0])+"" , "Amount:" + Amount +"", ""); c.TaskId = Npc[t][0]; c.TaskAmount = Amount; } else c.DA().npctalking(c, 1597, "Your task is to slay", "Kill: " + c.GetNpcName(Level1[t2][0])+"" , "Amount:" + Amount +"", ""); c.TaskId = Level1[t2][0]; c.TaskAmount = Amount; } else if(c.TaskId != -1 && c.TaskAmount != -1) c.DA().npctalking(c, 1597, "Your task is to slay", "Kill: " + c.GetNpcName(c.TaskId)+"" , "Amount:" + c.TaskAmount +"", ""); } }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |