- 10
- Posts
- 8
- Years
- Seen Apr 23, 2018
You want a routine which will end/restart a mission if your given time is over?
Not sure if this will help you but you can try this routine.
Timer in FR
Spoiler:
Code:.text .align 2 .thumb .thumb_func .global timer main: push {r0-r5} mov r0, #0x92 lsl r0, r0, #0x2 ldr r2, checkflag bl linker cmp r0, #0x0 beq over ldr r0, playerData ldr r0, [r0] add r0, r0, #0xE ldrh r1, [r0] mov r3, #0x3c mul r1, r1 , r3 add r0, r0, #0x2 ldrb r2, [r0] add r1, r1, r2 mov r2, r1 mov r0, #0x93 lsl r0, r0, #0x2 ldr r1, checkflag bl linker1 cmp r0, #0x1 beq checkTimer ldr r0, =0x4011 mov r1, r2 ldr r3, setvar bl linker3 mov r0, #0x93 lsl r0, r0, #0x2 ldr r1, setflag bl linker1 checkTimer: ldr r0, playerData ldr r0, [r0] add r0, r0, #0xE ldrh r1, [r0] mov r3, #0x3c mul r1, r1 , r3 add r0, r0, #0x2 ldrb r2, [r0] add r1, r1, r2 mov r5, r1 ldr r0, =0x4011 ldr r1, loadvar bl linker1 sub r4, r5, r0 ldr r3, var_8002 ldrh r3, [r3] cmp r4, r3 bne over ldr r0, =0x4012 ldr r1, loadvar bl linker1 ldr r2, setflag bl linker mov r0, #0x92 lsl r0, r0, #0x2 ldr r2, clearflag bl linker b over .ltorg over: pop {r0-r5} ldr r1, [r2] ldrb r0, [r1,#0x11] cmp r0, #0x59 bls end ldr r0, =(0x0805489C + 1 ) bx r0 linker: bx r2 linker1: bx r1 linker3: bx r3 end: pop {r0} bx r0 .align 2 loadvar: .word 0x0806E569 setvar: .word 0x0806E585 var_8002: .word 0x020370BC setflag: .word 0x0806E681 checkflag: .word 0x0806e6d1 playerData: .word 0x0300500C clearflag: .word 0x0806E6A1
info:
1.This routine uses safe var 4011, 4012,8002 and flag 248 and 24c
2. Flag 248 is used to start the timer
3. 8002 is used to know how many minutes mission will continue
How to use:
1.insert this hook at 0x054894
00480047 xx+1 yy zz (xx yy zz is where u inserted the routine)
2.In The script which will start the timer based event you have to write this three line
setvar 0x8002 0xXX (XX = the minutes you want event to run )
setvar 0x4012 0xYY {YY = flag you want to set be if event is not finished in time )
setflag 0x248 (start the timer)
-------------------------------------
Now that you have started the timer this routine will run every second and when your given time in var 8002 is over it will set a flag (which is also given in var 4012). Depending on that flag in var 4012 you can determine mission is over / restart the mission / time over can't redo the mission etc.
Note: If player finishes the task in the mission you will obviously wouldn't want the timer to continue.So, clearflag 248 and 24C in that script
.
incredible!thankyou so much!