SOCOM II :: Bots
Code Designer Source
The following code will spawn players on the map. Each player is using the offline AI and will fire at you. I tend to use this code in lan using pcsx2. It can be useful for testing other codes that require people in the room.
Code:
address $200a0000 /* # Will create a specified amount of players aka bots */ __CreateBots: addiu sp, sp, $ffd0 sw ra, $0000(sp) sw s0, $0004(sp) sw s1, $0008(sp) sw s2, $000c(sp) setreg s0, $00440c38 lw s0, $0000(s0) beq s0, zero, :EndCreateBot nop setreg s1, $000b0000 lb s2, $0000(s1) addiu s2, s2, $0001 addiu v0, zero, $000a beq s2, v0, :AfterCreation nop //Create name string addiu a0, s1, $0024 addiu a1, s1, $0014 jal $001988d0 daddu a2, s2, zero, //Get skin pointer jal $0053e170 addiu a0, s1, $0004 //Create Bot daddu a0, v0, zero, addiu a1, s1, $0024 jal $002b3a00 addiu a2, zero, $0001 daddu s3, v0, zero, //Store bot pointer in bot list addiu t0, s1, $002c sll t1, s2, 2 add t0, t0, t1 sw s3, $0000(t0) //update name addiu a1, s1, $0024 jal $00314ee0 lw a0, $0028(s3) addiu a1, s1, $0024 jal $0029ec70 daddu a0, s3, zero, //force clean spawn sw zero, $000c(s3) //set team id setreg t0, $C0020000 sw t0, $00c8(s3) //respawn setreg t0, $66666666 sw t0, $0FCC(s3) sb s2, $0000(s1) beq zero, zero, :EndCreateBot nop AfterCreation: //already run check? addiu t0, s1, $002c lb v0, $0000(t0) bne v0, zero, :EndCreateBot nop addiu v0, zero, $0001 sb v0, $0000(t0) //update team id and respawn StartTeamUpdate: addiu t0, t0, $0004 lw t1, $0000(t0) beq t1, zero, :EndCreateBot nop //set the team id to bot team id addiu t2, zero, $0000 sw t2, $00c8(t1) //respawn setreg t2, $66666666 sw t2, $0FCC(t1) beq zero, zero, :StartTeamUpdate nop EndCreateBot: jal :__RespawnHandler daddu a0, s1, zero, lw ra, $0000(sp) lw s0, $0004(sp) lw s1, $0008(sp) lw s2, $000c(sp) jr ra addiu sp, sp, $0030 /* # Will monitor each bot for when it is time to respawn */ __RespawnHandler: addiu t0, a0, $0100 lw v0, $0000(t0) lw v1, $0004(t0) bne v0, v1, :EndRespawnHandler nop sw zero, $0004(t0) daddu v1, zero, zero, addiu t1, a0, $0030 StartRespawnHandler: lw t2, $0000(t1) beq t2, zero, :EndRespawnHandler nop lw t3, $1044(t2) bne t3, zero, :RespawnHandlerNext nop setreg t3, $66666666 sw t3, $0FCC(t2) RespawnHandlerNext: beq zero, zero, :StartRespawnHandler addiu t1, t1, $0004 EndRespawnHandler: addiu v1, v1, $0001 sw v1, $0004(t0) jr ra nop /* # Will get the UICharType String */ __SkinHandler: /* Bots Pointer ------------------------------- 0000 = Amount of bots created 0004 = Character string 0014 = Format String 0024 = Bot Name 0030 = Bot List 0100 = Respawn Timer Interval 0104 = Respawn Current time */ address $200b0004 print "UiCharType2" nop print "Bot%d" address $200b0100 hexcode $00000250 /* Bot codes ------------------------------- */ //On Joker address $D044F15C hexcode $0000FBFF address $202CED04 j :__CreateBots //Off Joker //address $D044F15C //hexcode $0000FFFF //address $202CED04 //jr ra //Spectator Fix address $202C3038 hexcode $10000006
Comment