Does anyone know how to code a automated event like JQ in v117 ?
I've tested using this guide :http://forum.ragezone.com/f427/add-a...-event-741838/
But " cserv.reconnectWorld(); " doesn't work in v117 so I'm not sure what to do to make it work.
Does anyone know how to code a automated event like JQ in v117 ?
I've tested using this guide :http://forum.ragezone.com/f427/add-a...-event-741838/
But " cserv.reconnectWorld(); " doesn't work in v117 so I'm not sure what to do to make it work.
lol are you srs?
here is how i would do it (i load my autojqs and broadcast the message packet world-wide, and don't forloop each channel; you can change it in your source):
Code:public void setEventMap(int id){ World.setEventMap(id); // i set these per channel, edit for your source World.setServerMessage("An event has started! Click on Vicious to participate!"); // i set these per channel, edit for your source World.Broadcast.broadcastMessage(CWvsContext.serverNotice(6, "[EVENT] An event has started! Click on Vicious to participate!")); }
I don't really know why but the Event warps and worldwide notice works now but when I enter , it brings me to OX Quiz map instead of a random JQ map
-EDIT-
Also , can anyone explain to me what's this ? [Those highlighted words]
function scheduleNew() {
var cal = java.util.Calendar.getInstance();
cal.set(java.util.Calendar.HOUR, 0);
cal.set(java.util.Calendar.MINUTE, 0);
cal.set(java.util.Calendar.SECOND, 0);
var nextTime = cal.getTimeInMillis();
while (nextTime <= java.lang.System.currentTimeMillis()) {
nextTime += 1000 * 3600;
}
Last edited by Zaytron; 09-08-14 at 04:32 PM.
Well, there's some progress! You made them work world-wide as well? I like it that way, it's better imo.
Anyways, the red text should be the start time of the JQ afaik (I never edit it, only the nextTime). When the JQ starts, it sets the nextTime variable.
Below the red text, it cheks if the nextTime matches the current time, and if it does, it increases. (pretty much re-schedules in ??? minutes)
the nextTime is in milliseconds, so always multiply your seconds * 1000 like it shows there. In the above, 3600 seconds should be an hour. So, every hour this event script should run.
As for your OX map warp, in your event script, it's setting the map id as the OX. Make sure to edit the mapid's in the list within AutoJQ.js to your liking
In your code, I don't really think cal.set(java.util.Calendar.HOUR, 0) is necessary is it? Wouldn't that just force more iterations, and still produce the same result?PHP Code:function scheduleNew() {
var cal = java.util.Calendar.getInstance();
cal.set(java.util.Calendar.HOUR, 0);
cal.set(java.util.Calendar.MINUTE, 0);
cal.set(java.util.Calendar.SECOND, 0);
var nextTime = cal.getTimeInMillis();
while (nextTime <= java.lang.System.currentTimeMillis()) {
nextTime += 1000 * 3600;
}
It would be cool if it hosted a randomly chosen event every hour out of a bunch of different events. If you wanted to have more automated events, you might have to rethink this.
Like I said, it's just setting the current time to 0:00:00. Then it counts milliseconds until the nextTime interval and starts the event.
It CAN host a randomly chosen event every hour. Something like this (just the thought):
Although, you probably know this already. Just that you said it'd be cool confused me whether or not you know it's possible.Code:var a1 = Randomizer.rand(1,10); // change this as you wish if (a1 <= 3) { startAutoJQ(910000000); // starts the mapid, using fm for example } else if if (a1 >= 4 && a1 <= 7) { startAutoPvP(910000000); // something i was going to make, using fm as example } else { // (a1 > 7) startAutoMobSpawn(); // some exp mobs or something idk }
Also, what do you mean by having more automated events you'd have to re-think this? I'm not sure what you mean o.o
I know haha, but what I'm saying is that this is equivalent
and then you go on to use nextTime to schedule as before. It's done in one operation versus (potentially) 22 I think in the worst case?PHP Code:function scheduleNew() {
var cal = java.util.Calendar.getInstance();
cal.set(java.util.Calendar.MINUTE, 0);
cal.set(java.util.Calendar.SECOND, 0);
var nextTime = cal.getTimeInMillis();
nextTime += 1000 * 3600;
Actually that might be ok if you're ok to have a whole event per function. Some events might be more complicated than that, and it could get very messy very quickly inside that event script. That's all I mean haha
Btw , I'd like to ask. Instead of following the guide on Forums whereby the random map is done in the Event.js can I do it by NPC ? Like when the gates are opened to enter the event , the NPC itself randomize a JQ map from a 'Var' or whatever it's called then warp players to that map.
Meaning , I don't wan to use this "em.setEventMap( maps[Math.floor(Math.random()*12)] );" in the Event.Js , I wan to use it another way in the NPC Script.
wat. why would you do this for?? literally it's the same way, and if you didn't do it the same way, players would be doing multiple different JQs at once. doing multiple different jqs at once can be exploitable. oh and if you're using that release for autojqs, it is VERY exploitable so you better fix it
as for doing it the weird way in the npc.. do something like:
this is just an example, but obviously you'd have to make the functions in your npc handlerCode:if (cm.getEventMap() == 0) { var maps = [1, 2, 3]; cm.setEventMap(maps[Math.floor(Math.random()*maps.length)]); } cm.warp(cm.getEventMap();
Thanks !
- - - Updated - - -
Damn I got another question.
How can I use cm.warp in a way with 'Var(s)'
Like example "var maps = [1, 2, 3];" above & I want the cm.warp to randomly pick 1 map from the 'Var maps'
- - - Updated - - -
Bump >w<