Human Controllable AI Switch/ja
From M.U.G.E.N Wiki
4-16-2010 - Hello viewers. The Great1 is back with a present for those who still use WinMugen. With an idea by Seravy I was able to produce this WinMugen code that makes the player be able to turn the ai off and on via the ctrl+1/ctrl+2 keyboard debug keys. This has the AI activation code Created by K3nShiN based on VK and Deuce's AI coding technique in mind.:
- ------------------------------------------------------------------
Command File: :<----this portion goes in the cmd file
;A.I. [State -1, Activate_AI] ;<----AI Activation: Refer to K3nShiN, VK, and Deuce's AI Activation Coding for more insight type = VarSet triggerall = !var(51) && !numhelper(800000) ;<----New edition to K3nShiN, VK, and Deuce's AI Activation Coding: Activates AI variable when it is not present and when the AI Helper is not present trigger1 = command = "CPU1" || command = "CPU2" || command = "CPU3" || command = "CPU4" || command = "CPU5" || command = "CPU6" trigger2 = command = "CPU7" || command = "CPU8" || command = "CPU9" || command = "CPU10" || command = "CPU11" || command = "CPU12" trigger3 = command = "CPU12" || command = "CPU14" || command = "CPU15" || command = "CPU16" || command = "CPU17" || command = "CPU18" trigger4 = command = "CPU19" || command = "CPU20" || command = "CPU21" || command = "CPU22" || command = "CPU23" || command = "CPU24" trigger5 = command = "CPU25" || command = "CPU26" || command = "CPU27" || command = "CPU28" || command = "CPU29" || command = "CPU30" trigger6 = command = "CPU31" || command = "CPU32" || command = "CPU33" || command = "CPU34" || command = "CPU35" || command = "CPU36" trigger7 = command = "CPU37" || command = "CPU38" || command = "CPU39" || command = "CPU40" || command = "CPU41" || command = "CPU42" trigger8 = command = "CPU43" || command = "CPU44" || command = "CPU45" || command = "CPU46" || command = "CPU47" || command = "CPU48" trigger9 = command = "CPU49" || command = "CPU50" || command = "CPU51" || command = "CPU52" || command = "CPU53" || command = "CPU54" trigger10 = command = "CPU55" || command = "CPU56" || command = "CPU57" || command = "CPU58" || command = "CPU59" || command = "CPU60" var(51) = 1 [State -1, Deactivate_AI] ;<----Shuts off the AI variable when AI helper is active and when AI has not pressed any keys within 6 seconds. type = VarSet trigger1 = var(51) && numhelper(800000) trigger1 = helper(800000),sysvar(1) && helper(800000),sysvar(0)>=600 ;<----*When AI Debug key is pressed, you must wait approx. 6 secs or less before AI fully deactivate var(51) = 0 [State -1, AI_Helper] ;<----AI Helper that assists in the Human being able to turn back off the AI at will type = helper trigger1 = var(51) && !numhelper(800000) helpertype = normal name = "AI_Helper" ID = 800000 pos = 99999,99999 postype = p1 stateno = 800000 keyctrl = 0 ownpal = 1 persistent = 1 ignorehitpause = 1 supermovetime = 0 pausemovetime = 0 [State -1, AI_Debug] ;<----Debug Info type = null;displaytoclipboard trigger1 = numhelper(800000) text = "var(51) = %d: A.I. | helper(800000),sysvar(0) = %d: A.I. Command Time Active Tracker" params = var(51), helper(800000),sysvar(0) ;------------------------------------------------------------------
- ------------------------------------------------------------------
- Positive States
- <----this portion of the code goes in any positive state area (non- -1,-2,-3 area)
;---------------------------------------------------------------------- ;A.I. Helper Definitions ;---------------------------------------------------------------------- [Statedef 800000] type = A movetype = I physics = N anim = 01 ;<----Blank Animation so that this helper wont have clsns ctrl = 0 velset = 0,0 ignorehitpause = 1 [State 800000, AssertSpecial] ;<----Used to make helper not be seen type = AssertSpecial trigger1 = 1 flag = noshadow flag2 = invisible [State 800000, PlayerPush] ;<----Helper's position cannot be manipulated by the player(s) type = PlayerPush trigger1 = 1 value = 0 [State 800000, NotHitBy] ;<----Helper cant be hit type = NotHitBy trigger1 = 1 value = SCA [State 800000, AI_Helper_Sound_Tracker] ;<----Used to make noise so that you know that this helper is active. One needs their full attention on the root's debug info type = null;PlaySnd trigger1 = 1 value = S19,12 channel = -1 [State 800000, AI_Helper_Timer_Tracker_Reset] ;<----uses the root's artificial intellegence semi-constant input to reset the AI Helper Timer Tracker type = VarSet trigger1 = time = 0 ;<----variable timer starts a 0 when the helper first appears trigger2 = root,command = "CPU1" || root,command = "CPU2" || root,command = "CPU3" || root,command = "CPU4" || root,command = "CPU5" || root,command = "CPU6" trigger3 = root,command = "CPU7" || root,command = "CPU8" || root,command = "CPU9" || root,command = "CPU10" || root,command = "CPU11" || root,command = "CPU12" trigger4 = root,command = "CPU12" || root,command = "CPU14" || root,command = "CPU15" || root,command = "CPU16" || root,command = "CPU17" || root,command = "CPU18" trigger5 = root,command = "CPU19" || root,command = "CPU20" || root,command = "CPU21" || root,command = "CPU22" || root,command = "CPU23" || root,command = "CPU24" trigger6 = root,command = "CPU25" || root,command = "CPU26" || root,command = "CPU27" || root,command = "CPU28" || root,command = "CPU29" || root,command = "CPU30" trigger7 = root,command = "CPU31" || root,command = "CPU32" || root,command = "CPU33" || root,command = "CPU34" || root,command = "CPU35" || root,command = "CPU36" trigger8 = root,command = "CPU37" || root,command = "CPU38" || root,command = "CPU39" || root,command = "CPU40" || root,command = "CPU41" || root,command = "CPU42" trigger9 = root,command = "CPU43" || root,command = "CPU44" || root,command = "CPU45" || root,command = "CPU46" || root,command = "CPU47" || root,command = "CPU48" trigger10 = root,command = "CPU49" || root,command = "CPU50" || root,command = "CPU51" || root,command = "CPU52" || root,command = "CPU53" || root,command = "CPU54" trigger11 = root,command = "CPU55" || root,command = "CPU56" || root,command = "CPU57" || root,command = "CPU58" || root,command = "CPU59" || root,command = "CPU60" sysvar(0) = 0 [State 800000, AI_Helper_Timer_Tracker_CountDown] ;<----counts the ticks that the AI is "pressing the buttons" type = VarAdd trigger1 = time>0 && RoundState = 2 sysvar(0) = 1 [State 800000, AI_Helper_Idle_Action_Tracker_Reset] ;<----uses the root's artificial intellegence semi-constant non-idle time to reset the AI Helper Idle Action Tracker type = VarSet trigger1 = time = 0 || sysvar(0) sysvar(1) = 0 [State 800000, AI_Helper_Idle_Action_Tracker] ;<----activates variable that indicates that the player's AI is not "pressing buttons" type = VarSet trigger1 = root,var(51) && !sysvar(1) trigger1 = !(root,command = "CPU1" && root,command = "CPU2" && root,command = "CPU3" && root,command = "CPU4" && root,command = "CPU5" && root,command = "CPU6") trigger1 = !(root,command = "CPU7" && root,command = "CPU8" && root,command = "CPU9" && root,command = "CPU10" && root,command = "CPU11" && root,command = "CPU12") trigger1 = !(root,command = "CPU12" && root,command = "CPU14" && root,command = "CPU15" && root,command = "CPU16" && root,command = "CPU17" && root,command = "CPU18") trigger1 = !(root,command = "CPU19" && root,command = "CPU20" && root,command = "CPU21" && root,command = "CPU22" && root,command = "CPU23" && root,command = "CPU24") trigger1 = !(root,command = "CPU25" && root,command = "CPU26" && root,command = "CPU27" && root,command = "CPU28" && root,command = "CPU29" && root,command = "CPU30") trigger1 = !(root,command = "CPU31" && root,command = "CPU32" && root,command = "CPU33" && root,command = "CPU34" && root,command = "CPU35" && root,command = "CPU36") trigger1 = !(root,command = "CPU37" && root,command = "CPU38" && root,command = "CPU39" && root,command = "CPU40" && root,command = "CPU41" && root,command = "CPU42") trigger1 = !(root,command = "CPU43" && root,command = "CPU44" && root,command = "CPU45" && root,command = "CPU46" && root,command = "CPU47" && root,command = "CPU48") trigger1 = !(root,command = "CPU49" && root,command = "CPU50" && root,command = "CPU51" && root,command = "CPU52" && root,command = "CPU53" && root,command = "CPU54") trigger1 = !(root,command = "CPU55" && root,command = "CPU56" && root,command = "CPU57" && root,command = "CPU58" && root,command = "CPU59" && root,command = "CPU60") sysvar(1) = 1 [State 800000, DestroySelf] ;<----AI Helper deactivates when the player's AI is switched off type = DestroySelf trigger1 = root,var(51)<=0
Now, you will be able to turn back off the ai with the press of the ai debug keys. Note that, if you turn the ai off during a walk, duck, or a jump, when the variable fully deactivates, the character will continue to jump,duck, or walk only. You must time ur press when the char is standing still for it to do completely nothing again for you to control. Enjoy!
-Sh1nRa358