A PLACE TO HAVE FUN WITH MUGEN - Welcome! - Bienvenidos!
 
PortalHomeFAQMemberlistSearchRegisterComic WIP TrackerDownloadsLog inChat
Website Navigation Help
Translate the Website
Log in
Username:
Password:
Log in automatically: 
:: I forgot my password
Latest topics
» DC COMICS Enchantress Earth Prime New 52 start-up WIP
by crosspotts1.0 Today at 1:58 am

» Hulk by REDHOT (edited by Mr.Giang)
by Do Thi Today at 1:04 am

» Giorno Giovanna by Amarimono (edited by Mr.Giang)
by Do Thi Today at 1:02 am

» Balrog portrait by gartanham
by skhsato123 Today at 12:29 am

» Spector Palettes IV
by tony spector Yesterday at 11:21 pm

» chuchoryu other Mugen stuff in proggres
by CARNAGE777 Yesterday at 11:20 pm

» New Warmachine and Ironman
by yolomate Yesterday at 10:51 pm

» Barry burton from resident evil released.
by crosspotts1.0 Yesterday at 8:38 pm

» Yolomate 3D palettes: my third dimension is terror in the forum
by crosspotts1.0 Yesterday at 8:12 pm

» HUNK Progress
by yolomate Yesterday at 7:32 pm

Special Features at MMV







Chat on MMV w/ Discord


Share | 
 

 Code Snippet Archive

Go down 
Go to page : 1, 2, 3  Next
AuthorMessage
thatguy

avatar

Posts : 508
Join date : 2014-05-28
Location : Canada

PostSubject: Code Snippet Archive   July 12th 2018, 10:50 pm

OK have started posting all the codes from the archive (full download below), and over time will continue to add to this post. They will all have the subject line updated for easy searching of code. This will be done over time with over 2000 code snippets. Please feel free to add any code or tips you have to this archive, just when you add do a reply, and please change the subject for easy searching.

The point of this is to have a searchable database of mugen code here at MMV.

Please do not use this thread as a question and answer forum. Please post any questions on the help forum. Lets keep this thread clean of discussions, and easy to search/read.


Years ago (2009 or so) I started backing up MUGEN code tutorials and tutorials on old forums. I got sick of going back to an old bookmark and finding another mugen site down. Mugen community gone with all that content removed. Some of this content may still be online, but a lot of it was lost years ago.

I compressed 100+ MB of full backups of websites, HTML/PDF/WORD/TXT tutorials, etc. Over 2000 tutorials in total.  

Some may be suspicious of an EXE file, it is just because I compressed it down to  67MB in an auto extracting EXE. I tested the file after creating it as well using virustotal and you can view the results before downloading:
https://www.virustotal.com/#/file/a8bcbe7bb00474324826a1f613aafb6d2aef312e2a928aee33512dcd33256df2/detection


Tutorials Download:
Code:
https://mega.nz/#!AB1BRKII!TMKZ4K76SM_UBOqe42DwV0NbpMXfrVJP_v0nnp3Exxw


I hope some of you will find this of use. It is a massive archive of tutorials and will cover virtually anything you can think of. If you use anything in here the authors name is attached to them, please give credit to the author of the code.



Part 2: OolongV's MUGEN Boomarks (included in tutorials download) - A history of MUGEN Websites

With the internet archive, and OolongV's MUGEN Bookmarks you can browse through the history of MUGEN websites throughout the years.
For those that weren't around, in MUGENs best days there were 100s of different mugen websites, forums, and communities. Thanks to OolongV for his bookmarks. Click on a link you want to see their old site. If the link doesn't work you use the top bar "Internet Archive Wayback Machine" and choose another date or year until you find a link that works. Some websites were never archived, but most of them work. 100s of old mugen sites. Most downloads from an archived site don't work, but try and you may be surprised.

https://web.archive.org/web/20091025114640/http://www.geocities.com/oolongv2004/MUGENbookmarks.htm


Last edited by thatguy on July 25th 2018, 8:33 pm; edited 5 times in total (Reason for editing : Added part 2 OolongV's MUGEN Bookmarks)
Back to top Go down
View user profile
Mazemerald

avatar

Posts : 3447
Join date : 2012-12-10
Age : 28
Location : Retro Games World

PostSubject: Re: Code Snippet Archive   July 12th 2018, 10:54 pm

thanks thatguy! your work are amazing!

very helpful to all.
Back to top Go down
View user profile https://www.youtube.com/channel/UCm84avxm6aQ8_RBve3bLQUg/videos
thatguy

avatar

Posts : 508
Join date : 2014-05-28
Location : Canada

PostSubject: My Next post begins the tutorials   July 13th 2018, 10:05 pm

Thanks for the support.


Part 3: The tutorials. I will begin posting all the tutorials here. Some can't be pasted as they are just too large, so I will be offering smaller files of those (so you don't have to download the whole 100mb archive) to download as I get through all the content.


How to use:
1. ALWAYS BACKUP YOUR FILES BEFORE MODIFYING
2. Find the code you want.
3. Read the code
4. Check if your character uses the same state number
   - If using the same state numbers as the code snippet, change state number to an unused one before using
5. Test the character.
6. You may have to make a couple tweaks to get the desired effect.


Last edited by thatguy on July 28th 2018, 1:20 pm; edited 2 times in total (Reason for editing : Cleaning up thread > On to the tutorials)
Back to top Go down
View user profile
Shining

avatar

Posts : 1237
Join date : 2013-03-26
Age : 38
Location : Italy

PostSubject: Re: Code Snippet Archive   July 14th 2018, 4:55 am

Interesting...thanks a lot
Back to top Go down
View user profile
yolomate

avatar

Posts : 4920
Join date : 2013-06-17
Age : 41

PostSubject: Re: Code Snippet Archive   July 14th 2018, 9:10 am

uh uh old times!!!Shocked Shocked Shocked hahahahahahahahahaha
Back to top Go down
View user profile
thatguy

avatar

Posts : 508
Join date : 2014-05-28
Location : Canada

PostSubject: Timed Life regeneration code   July 24th 2018, 8:27 pm

Due to a couple requests in both the help section and private requests I have built this code off a code by Cybaster on the guild. Alternately you can use this time effect code for virtually any effect.

Timed life regeneration code
Created by thatguy

Use a varset when you enter the mode/move you want the effect to happen
Code:
[State 90000, VarSet]
type = VarSet
trigger1 = (!Time)
v = 0   ; <---- change this number to the Variable you want to use
value = 300  ; <---- change this number for the amount of time the effect lasts
Var(0) is here set to 300 ticks when you perform the move. It's 60 ticks per second.  300/60 is 5 seconds


Then, in state -3 part, use a varadd
Code:
[State -3, VarAdd]
type = VarAdd
trigger1 = (Var(0) > 0)  ; <---- change this number to the Variable you want to use
v = 0 ; <---- change this number to the Variable you want to use
value = -1
ignorehitpause = 1
Each tick, var(0) will be decreased by 1, as long as it is a positive number.


And in state -3 once again, trigger your lifeadd on var(0)
Code:
[State -3, LifeAdd]  
type = LifeAdd  
trigger1 = (Var(0) > 0) ; <---- change this number to the Variable you want to use
value = 2 ; <---Here is where you set your Lifeadd


In this case, your Life will be increased by 2, and I believe it is every tick. Test it and change to suit your characters needs.


Last edited by thatguy on August 12th 2018, 2:02 am; edited 3 times in total
Back to top Go down
View user profile
thatguy

avatar

Posts : 508
Join date : 2014-05-28
Location : Canada

PostSubject: Armour Effect   July 24th 2018, 8:33 pm

=====
Armor
=====
Created by SorrowEdge

;---------------------------------------------------------------------------
Armor -- The increase of a character's resistance. This particular code also
gives the character a special trait: He/She will not be able to be knocked down
as easily, giving some sort of a "brick wall" feel.
;---------------------------------------------------------------------------
This will require several things:

1.) In the StateDef of all of your character's states, (excluding getting hit states)
add in:

velset = (prevstateno = 9000)* X,(prevstateno = 9000)* Y

X is the character's horizontal velocity, and Y is the character's Y velocity.

facep2 = !(prevstateno = 9000)

facep2 causes your character to face the opponent at the beginning of the state.

ctrl = 1

The ctrl parameter is only required in state 0, (standing state) and in state 11,
(crouching state) as you want to retain control when getting hit.

2.) Next, the required animation parameter:

[State ***, ChangeAnim]
type = ChangeAnim
trigger1 = Time = 0 && Anim != ***
value = ***

3.) The required -2/-3 states:

;The armor effect only occurs when your character not in his/her basic states.
(standing, walking, etc...)
[State -3, VarSet]
type = VarSet
trigger1= (StateNo >= 200) && (MoveType != H)
var(0) = StateNo

[State -3, Armor2]
type = HitOverride
trigger1= (StateNo >= 200) && (MoveType != H)
time = 1
slot = 2
attr = SCA, AA
stateno = 9000

4.) Lastly, the armor state!
[Statedef 9000]
MoveType = H  

[State 9000, PosFreeze]
type = PosFreeze
trigger1 = 1
value = 1

[State 9000, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA, AA, AP
time = 1

[State 9000, LifeAdd]
type = LifeAdd
trigger1 = Time = 0
value = - floor(gethitvar(damage) / 2)

[State 9000, ChangeAnim]
type = ChangeAnim
trigger1 = Time < floor(gethitvar(hittime) * 0.Cool
value = Anim
elem  = AnimElemNo(0)

[State 9000, End]
type = ChangeState
trigger1 = Time >= floor(gethitvar(hittime) * 0.Cool
value = Var(0)
Back to top Go down
View user profile
thatguy

avatar

Posts : 508
Join date : 2014-05-28
Location : Canada

PostSubject: AI - Artificial Intelligence   July 24th 2018, 8:35 pm

========================================================
AI Implementation Code (With bonus auto-taunt technique)
========================================================
Created by K3nShiN
Based on VK and Deuce's AI coding technique

AI = Stands for Artificial Intelligence; Historically implemented on every game ever created!
An AI code basically guides the CPU on what to do on certain events/situations giving gameplay
a much more challenging factor.

There are 2 basic methods of triggering this AI code, one is the use of Variables and the other is
through pallette tracking through specific pallette numbers in the .Def file of the character.

Let's go through triggering AI with the use of variables first...

1.) Open your character's CMD file with any text editor of your preference.
2.) Next, create a list of humanly impossible commands right ABOVE the [Statedef -1] state definition.
It should look a lot like this:

; -| CPU Commands |-------------------------------------------------------------

[Command]
name = "CPU1"
command = D, D, U, U, D, U
time = 1

[Command]
name = "CPU2"
command = D, U, U, D, D, U
time = 1

[Command]
name = "CPU3"
command = D, D, D, U, U, U
time = 1

and so on....

Tip: The more CPU commands you make, the better. As the CPU always picks out a random command inside
the CMD file and execute it instantly. The CPU will only need to pick one of these commands and the AI
will be triggered. Explained more later.

let's continue...

3.) Set the variable that will be used to detect CPU control and create a list of triggers that would correspond
to each CPU command that you set up earlier. Place it UNDERNEATH the [Statedef -1] state definition.
It should look like this:

[Statedef -1]

[State -1, Activate AI]
type = VarSet
trigger1 = command = "CPU1"
trigger2 = command = "CPU2"
trigger3 = command = "CPU3"
v = 20 ;You can change this to any number provided that it doesn't collide with other variables you've already set.
value = 1

The previous code basically means "set variable 20's value to 1 if either of the previous commands were executed."
This value will reset back to "0" before and after each round, that's why you need to make more commands. The sooner it gets executed, the better.

Now let's implement what we've learned so far and try to get your character to do a simple AI command shall we? ^_^x
I'm gonna use mvsc type Guy as a reference...

; ============================
; AI Auto taunt
; ============================
[State -1,AutoTaunt]
type = ChangeState
value = 195 ;Guy's taunt stateno (state number). You can change this to your character's taunt stateno.
triggerall = var(20) = 1 ;It executes if it detects CPU control. In plain terms, "If Variable 20 is equal to 1".
triggerall = statetype != A ;This prevents the mistake of the CPU taunting in mid-air! O_o
triggerall = movetype != H ;This prevents the mistake of the CPU taunting while currently being hit! O_o
triggerall = statetype != L ;This prevents the mistake of the CPU taunting while currently lying down! O_o
triggerall = P2life != 0 ;This prevents the mistake of the CPU taunting when the enemy is already dead! O_o
trigger1 = (P2statetype = L) && (ctrl = 1) && (random <= 500)
persistent = 0

The chunk of code above basically means "Automatically execute the taunt when the enemy is down and character is able to move at 50% probability, but not when Player 1 is in the air, being hit, lying down or enemy is out of commission."
For a much more optimized version of the code, look below... it does exactly the same but with a much more
cleaner layout...

; ============================
; AI Auto taunt
; ============================
[State -1,AutoTaunt]
type = ChangeState
value = 195
triggerall = (var(20) = 1) && (statetype != A) && (movetype != H) && (statetype != L) && (P2life != 0)
trigger1 = (P2statetype = L) && (ctrl = 1) && (random <= 500)
persistent = 0

Reminder: All of the previous codes are to be placed inside the CMD file only!!!!

That concludes our Basic AI Implementation tutorial. Watch out for more tutorial and tips at Zero Gravity Studios.
http://www.zgstudios.net
Back to top Go down
View user profile
thatguy

avatar

Posts : 508
Join date : 2014-05-28
Location : Canada

PostSubject: AI - Guard   July 24th 2018, 8:36 pm

========
AI Guard
========
Created by The Necromancer

;---------------------------------------------------------------------------
AI Guard -- A simple method to increase an AI's fighting difficulty. This can
only work when the AI has been triggered. In this case, it is with a VarSet.
;---------------------------------------------------------------------------
Please refer to Kenshin's "AI Activation" codes before using this.

"Var(0) = 1" is used as the AI Activation trigger.

Alternatively, you can use the CMD file to insert the codes.
(With some format change.)

[State -3, StandGuard]
type = ChangeState
triggerall = (Var(0) = 1) && (StateType = S) && (Pos Y >= 0) && (P2BodyDist Y <= 0)
triggerall = (P2BodyDist Y >= -120) && (P2StateType != C) && (P2MoveType = A)
trigger1 = (P2BodyDist X <= 120) && (Random <= 799) && (Ctr1)
trigger2 = (StateNo = [140, 155]) || (StateNo = [100, 105])
value = 130

[State -3, CrouchGuard]
type = ChangeState
triggerall = (Var(0) = 1) && (StateType != A) && (Pos Y >= 0) && (P2BodyDist Y <= 0)
triggerall = (P2BodyDist Y >= -50) && (P2StateType = C) && (P2MoveType = A)
trigger1 = (P2BodyDist X <= 120) && (Random <= 799) && (Ctrl)
trigger2 = (StateNo = [140, 155]) || (StateNo = [100, 105])
value = 131

[State -3, AirGuard]
type = ChangeState
triggerall = (Var(0) = 1) && (StateType = A) && (Pos Y < 0) && (P2BodyDist Y >= -120)
triggerall = (StateType = A) && (P2MoveType = A)
trigger1 = ((P2BodyDist X <= 120) && (Ctrl)) || (StateNo = [140, 155])
value = 132
Back to top Go down
View user profile
Mazemerald

avatar

Posts : 3447
Join date : 2012-12-10
Age : 28
Location : Retro Games World

PostSubject: Re: Code Snippet Archive   July 24th 2018, 9:21 pm

congrats friend for sharing your mugen knowledges with other.

like that other members can to learn more about how codes work.
Back to top Go down
View user profile https://www.youtube.com/channel/UCm84avxm6aQ8_RBve3bLQUg/videos
thatguy

avatar

Posts : 508
Join date : 2014-05-28
Location : Canada

PostSubject: Vs Style High Jump Method 1   July 24th 2018, 11:08 pm

====================
High Jump (VS Style)
====================
Created by The Necromancer

;---------------------------------------------------------------------------
High Jump -- (Self Explanatory)

There are basically 2 types of high jumps: The VS style of Capcom, where the
characters jump more vertical rather than horizontal, and the SNK style, which
is somewhat the opposite.

This code will show how the VS Style high jump is done.
;---------------------------------------------------------------------------
1.) The "VS" style jump.

[Statedef 9000]
type = A
physics = N
velset = 0,-11
ctrl = 0

[State 9000, ChangeAnim]
type = ChangeAnim
trigger1 = Time = 0
value = ifelse((vel x)=0, 41, ifelse((vel x)>0, 42, 43))

[State 9000, PlaySnd]
type = PlaySnd
trigger1 = Time = 0
value = *,*

[state 9000, CtrlSet]
type = CtrlSet
trigger1 = Time >= 1
value = 1

[state 9000, VelSetFwd]
type = VelSet
trigger1 = command = "holdfwd"
x = 3

[state 9000, VelSetBack]
type = VelSet
trigger1 = command = "holdback"
x = -3

[state 9000, VelAdd]
type = VelAdd
trigger1 = Time > 10
x = 0
y = .40

[state 9000, End]
type = ChangeState
trigger1 = Pos Y >= 1
value = 52
ctrl
Back to top Go down
View user profile
thatguy

avatar

Posts : 508
Join date : 2014-05-28
Location : Canada

PostSubject: Vs Style High Jump Method 2   July 24th 2018, 11:09 pm

====================
High Jump (VS Style)
====================
Created by Sunboy

;---------------------------------------------------------------------------
High Jump -- (Self Explanatory)

Method 2 of creating Versus super jumps:

-Requires a variable
-Is a bit easier and it makes for more "versus-true"
velocities when you hold back or forward.

Also, I found a yaccel of .39 to be more fitting for versus
characters.

;---------------------------------------------------------------------------

1.) In the super jump move:

; Super Jump
[Statedef 9000]
type = A
physics = S
ctrl = 0
anim = 40

[State 9000, VarSet]
type = VarSet
trigger1 = Time = 0
var(10) = 1

[State 9000, VelSet]
type = VelSet
trigger1 = AnimTime = 0
x = 0
y = -11

[State 9000, PlaySnd]
type = PlaySnd
trigger1 = AnimTime = 0
value = *,*

[State 9000, ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

2.) Overridden states:

; Jump Up
[Statedef 50]
type = A
physics = A

[State 50, 1]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 50, VelAdd]
type = VelAdd
trigger1 = (Vel X < 3.25) && (Var(0) = 1) && (Command = "holdfwd") && (Command != "holdback")
x = .45

[State 50, VelAdd]
type = VelAdd
trigger1 = (Vel X > -3.25) && (Var(0) = 1) && (Command != "holdfwd") && (Command = "holdback")
x = -.45

;Notice var(0) * 10000. Anims 41-43 are normal jump rise anims. Anims 10041-10043 are super jump rise anims.

[State 50, 2]
type = ChangeAnim
trigger1 = Time = 0
value = ifelse((vel x)=0, ((var(0) * 10000) + 41), ifelse((vel x)>0, ((var(0) * 10000) + 42), ((var(0) * 10000) + 43)))

[State 50, 3]
type = ChangeAnim
trigger1 = Anim = [41,43]
trigger1 = AnimTime = 0
;trigger1 = Vel y > -2
trigger1 = SelfAnimExist(anim + 3)
persistent = 0
value = Anim + 3

So that you don't retain super jump movement capabilities:

;---------------------------------------------------------------------------
; -[ Super Jump Control ]-
[State -2]
type = VarSet
trigger1 = StateType != A
var(0) = 0

Smile Enjoy.
Back to top Go down
View user profile
thatguy

avatar

Posts : 508
Join date : 2014-05-28
Location : Canada

PostSubject: SNK High Jump   July 24th 2018, 11:10 pm

=====================
High Jump (SNK Style)
=====================
Created by The Necromancer

;---------------------------------------------------------------------------
High Jump -- (Self Explanatory)

There are basically 2 types of high jumps: The VS style of Capcom, where the
characters jump more vertical rather than horizontal, and the SNK style, which
is somewhat the opposite.

This code will show how the SNK Style high jump is done.
;---------------------------------------------------------------------------
In state 40, add this code in:

[State 40, ChangeState]
type = ChangeState
trigger1 = (Command = "High Jump") && (AnimTime = 0)
value = 9000

State 9000 will be your character's high jump state:
[Statedef 9000]
type = A
movetype = I
physics = A

[State 9000, VelSet]
type = VelSet
trigger1 = Time = 0
x = * ;Length of high jump (Must be greater than Y)
y = * height of high jump (Must be lesser than X)

[State 9000, ChangeAnim]
type = ChangeAnim
trigger1 = Time = 0
value = IfElse((Vel x) = 0, 41, IfElse((Vel X) > 0, 42, 43))

[State 9000: ChangeAnim]
type = ChangeAnim
trigger1 = Vel Y > -2 && SelfAnimExist(Anim + 3)
persistent = 0
value = Anim + 3

[State 9000, ChangeState]
type = ChangeState
trigger1 = Pos Y >= 1
value = 52
Back to top Go down
View user profile
thatguy

avatar

Posts : 508
Join date : 2014-05-28
Location : Canada

PostSubject: Wall Jump   July 24th 2018, 11:15 pm

=========
Wall Jump
=========
Created by The Necromancer

;---------------------------------------------------------------------------
Wall Jump - (Self-explanatory)
;---------------------------------------------------------------------------
This is all you need. In the CMD file, add:

;Wall Jump
[State -1, WallJump]
type = ChangeState
value = 40
triggerall = (statetype = A) && (ctrl)
trigger1 = ((command = "Long_Jump") && (command = "holdfwd") && (backedgebodydist <= 10) && (backedgebodydist > -10))
trigger2 = ((command = "Long_Jump") && (command = "holdback") && (frontedgebodydist <= 10) && (frontedgebodydist > -10))

Back to top Go down
View user profile
Sommbrero666

avatar

Posts : 61
Join date : 2013-09-17

PostSubject: Re: Code Snippet Archive   July 24th 2018, 11:19 pm

@thatguy wrote:
=====
Armor
=====
Created by SorrowEdge

;---------------------------------------------------------------------------
Armor -- The increase of a character's resistance. This particular code also
gives the character a special trait: He/She will not be able to be knocked down
as easily, giving some sort of a "brick wall" feel.

Holy mother, is that what i'm trying do for my own, but with any good result, god bless you man (ps: I didn't wanted look in other char)

;
------------------------
Back to top Go down
View user profile
Sponsored content




PostSubject: Re: Code Snippet Archive   

Back to top Go down
 
Code Snippet Archive
Back to top 
Page 1 of 3Go to page : 1, 2, 3  Next

Permissions in this forum:You cannot reply to topics in this forum
The Mugen Multiverse :: Mugen :: Mugen Resources-
Jump to: