Jump to content

How to create a quest that tracks kills and remembers.


Rika

Recommended Posts

I'm bored, so I randomly decided to type this.

Keep in mind you'll need to know qedit a little to understand this.

This is to create a thread that updates the amount of kills you get in real time and save them.

Firstly, you need to decide of a Global flag to use. Now, pretty much all of them are in use, but you can always take the quests that use them away temporarily or remove the global flag from them. Refer to this topic to see which flags do what. http://www.edenserv.net/forum/viewtopic.php?f=21&t=1801

Let's use global flag 8 for example.

Now let's make a thread. The threaded function for this example will be 1325.

So, on every floor we will do thread_stg 1324 when you arrive.

Now for the actual function.

(Keep in mind anything with a // is a comment).

1324: jmpi_= r8, 00000001, 1 //if r8 is set the function will jmp to function 1 and basically "turn off".

1325: sync // 1 frame

addi, r1, 00000001 // this is for a "update" throttle.

jmpi_< r1, 00000258, 1325 //until r1 is not 0x258 or less, it's gonna keep going back to the start of the thread. 0x258 is 600 in decimal. This is to calculate 600 frames have passed. 600 frames if I remember is 20 seconds.

clear r1 Reset's r1, so it starts at 0 for the next pass.

chk_ene_num r2 //This calculates how many monster's have been killed and stores it in r2.

let r3, r2 //this stores the value of r2 into r3. I used r3 to scrolls text to display kills for the quest in a different function using <r3>. This function isn't necessary though.

jmp_!= r4, r2, 1326 //compares r4 and r2. If they aren't equal, go to 1326. Since r4 starts at 0, just getting a kill will make them unequal. If they are still equal it will skip this.

jmp 1324 //goes back to the beginning. Only happens if a kill hasn't happened in the current pass.

1326: read_global_flag 00000008, r5 //read's the value of global flag 8 and stores it in r5. (flag 8 is to be our kill count)

let r6, r2 //put's the amount of monster's we killed since the last pass into r6.

sub r2, r4 //subtracts r4 from r2

let r4, r6 //put's r6 into r4

let r7, r2 //put's r2 into r7

add r5, r7 //put's r7 into r5

write_global_flag 00000008, r5 //stores the new amount of kills into flag 8

jmp 1324 //goes back to function 1324.

Let's say you had 2 kill's in the last pass and got 3 more this pass (thus you have 5 this pass).

Basically, here's what the code does. It counts 600 frames. After it checks how many enemies were killed (which would be 5). It then copies that number to another register for use to display on a scroll screen (which I didn't show the code for). Now it compares the last pass with this pass. 2 different then 5? Yes? Okay let's go to 1326. Now let's read global 8 and put it in r5. Now we put the amount of kills we have on this pass (5) into r6. Now we subtract r4 from r2 (5-2) which is

3 (r2 = 3). Now we put r6 into r4 (both r6 and r4 are now 5). We put r2 (3) and put it in r7 (now 3). Now we add r7 to r5 (3+2 = 5). We now write 5 to global 8. Then we start over.

Sorry if I made any typos with the registers. But with this code, every 20 seconds, the quest will compare the amount of kills you last had, with the ones you have now, and add them to your global flag. Setting r8 will shut the thread off. I'd do that after the quest is pretty much over.

Here's how I did this with Max Attack S. I'm not commenting it and it's slightly different. It multiplies based on difficulty (r83 is the difficulty). Function 95 is the start of the thread. Each map would thread_stg 95. Also, global flag 8 was the currency (which could be spent). Flag 3 was total kills by you (which couldn't be spent). Flag 3 was what was displayed on the event site (Tofu did all that).

91:     muli R11, 00000001
       ret 
92:     muli R11, 00000002
       ret 
93:     muli R11, 00000006
       ret 
94:     muli R11, 00000014
       ret 
95:     sync 
       addi R14, 00000001
       jmpi_< R14, 00000258, 95
       clear R14
       chk_ene_num R19
       let R234, R19
       jmp_!= R15, R19, 96
       jmp 95
96:     read_global_flag 00000008, R12
       read_global_flag 00000003, R13
       let R16, R19
       sub R19, R15
       let R15, R16
       let R11, R19
       switch_call R83, 4:91:92:93:94
       add R13, R19
       add R12, R11
       write_global_flag 00000008, R12
       write_global_flag 00000003, R13
       jmp 95

Questions, comments?

Post is from Eden.

This is basically how you can create a currency of some sort for a event quest.

Edited by Rika
  • Like 2
Link to comment
Share on other sites

  • 5 weeks later...

I'm bored, so I randomly decided to type this.

Keep in mind you'll need to know qedit a little to understand this.

This is to create a thread that updates the amount of kills you get in real time and save them.

Firstly, you need to decide of a Global flag to use. Now, pretty much all of them are in use, but you can always take the quests that use them away temporarily or remove the global flag from them. Refer to this topic to see which flags do what. http://www.edenserv....php?f=21&t=1801

Let's use global flag 8 for example.

Now let's make a thread. The threaded function for this example will be 1325.

So, on every floor we will do thread_stg 1324 when you arrive.

Now for the actual function.

(Keep in mind anything with a // is a comment).

1324: jmpi_= r8, 00000001, 1 //if r8 is set the function will jmp to function 1 and basically "turn off".

1325: sync // 1 frame

addi, r1, 00000001 // this is for a "update" throttle.

jmpi_< r1, 00000258, 1325 //until r1 is not 0x258 or less, it's gonna keep going back to the start of the thread. 0x258 is 600 in decimal. This is to calculate 600 frames have passed. 600 frames if I remember is 20 seconds.

clear r1 Reset's r1, so it starts at 0 for the next pass.

chk_ene_num r2 //This calculates how many monster's have been killed and stores it in r2.

let r3, r2 //this stores the value of r2 into r3. I used r3 to scrolls text to display kills for the quest in a different function using <r3>. This function isn't necessary though.

jmp_!= r4, r2, 1326 //compares r4 and r2. If they aren't equal, go to 1326. Since r4 starts at 0, just getting a kill will make them unequal. If they are still equal it will skip this.

jmp 1324 //goes back to the beginning. Only happens if a kill hasn't happened in the current pass.

1326: read_global_flag 00000008, r5 //read's the value of global flag 8 and stores it in r5. (flag 8 is to be our kill count)

let r6, r2 //put's the amount of monster's we killed since the last pass into r6.

sub r2, r4 //subtracts r4 from r2

let r4, r6 //put's r6 into r4

let r7, r2 //put's r2 into r7

add r5, r7 //put's r7 into r5

write_global_flag 00000008, r5 //stores the new amount of kills into flag 8

jmp 1324 //goes back to function 1324.

Let's say you had 2 kill's in the last pass and got 3 more this pass (thus you have 5 this pass).

Basically, here's what the code does. It counts 600 frames. After it checks how many enemies were killed (which would be 5). It then copies that number to another register for use to display on a scroll screen (which I didn't show the code for). Now it compares the last pass with this pass. 2 different then 5? Yes? Okay let's go to 1326. Now let's read global 8 and put it in r5. Now we put the amount of kills we have on this pass (5) into r6. Now we subtract r4 from r2 (5-2) which is

3 (r2 = 3). Now we put r6 into r4 (both r6 and r4 are now 5). We put r2 (3) and put it in r7 (now 3). Now we add r7 to r5 (3+2 = 5). We now write 5 to global 8. Then we start over.

Sorry if I made any typos with the registers. But with this code, every 20 seconds, the quest will compare the amount of kills you last had, with the ones you have now, and add them to your global flag. Setting r8 will shut the thread off. I'd do that after the quest is pretty much over.

Here's how I did this with Max Attack S. I'm not commenting it and it's slightly different. It multiplies based on difficulty (r83 is the difficulty). Function 95 is the start of the thread. Each map would thread_stg 95. Also, global flag 8 was the currency (which could be spent). Flag 3 was total kills by you (which couldn't be spent). Flag 3 was what was displayed on the event site (Tofu did all that).

91: muli R11, 00000001
ret
92: muli R11, 00000002
ret
93: muli R11, 00000006
ret
94: muli R11, 00000014
ret
95: sync
addi R14, 00000001
jmpi_< R14, 00000258, 95
clear R14
chk_ene_num R19
let R234, R19
jmp_!= R15, R19, 96
jmp 95
96: read_global_flag 00000008, R12
read_global_flag 00000003, R13
let R16, R19
sub R19, R15
let R15, R16
let R11, R19
switch_call R83, 4:91:92:93:94
add R13, R19
add R12, R11
write_global_flag 00000008, R12
write_global_flag 00000003, R13
jmp 95

Questions, comments?

Post is from Eden.

This is basically how you can create a currency of some sort for a event quest.

That's what you did with Max Attack S episode 4 , so users could get prices with the scores they get through the quest right?

Link to comment
Share on other sites

That's what you did with Max Attack S episode 4 , so users could get prices with the scores they get through the quest right?

With max attack S episodes 1,2, and 4 yup. The script in the code box is from the actual quests.

Global flag 8 was used to store a currency that you could buy things with. Global flag 3 was used to track how many kills you got total.

The code not in the box is a example, but should work if you threw it into a quest. The example only uses 1 global flag and doesn't multiply it based on difficulty though.

Edited by Rika
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...