Don't forget to read the rules of the forum. No current release restrictions. | Help Search Members Calendar

Logged in as: The Dreamslayer ( Log Out ) | My Controls · 0 New Messages · View New Posts · My Assistant

Mugen DEV Forum -> Development and Help Forums -> Development Discussion

Pages: (2) [1] 2 ( Go to first unread post ) |

TAG code
Track this topic | Email this topic | Print this topic

| Posted: Oct 23 2002, 10:35 AM
Group: Posts: Member No.: Joined: -- | Last update : 07 Nov A. WHAT'S THIS ? This piece of code aims to transform the "simul" mode of Mugen into a "tag" mode : 2 teams of 2 players battle at the same time but only two chars at a time can fight on the stage ; the other two wait outside the screen. At any moment, the fighter can leave the stage and let his partner fight for him. The partner also enters the screen when his teammate is KO or when the match is won. The round ends when both teammates are KO.
The code is rather simple wich makes it easy to implement. However its functionalities are limited : it only allows partners to switch during the match. If you want to have something more sophisticated, for example combinated attacks, you will have to modify it.
To work properly, the code has to be included into all the chars who are going to use it. In any case, the player will have control of only one char ; the remaining one will be controlled by either the computer or the other player (in the "cooperative" mode).
B. THE CODE
The behaviour of the chars is inspired by those of the Capcom VS series : the char enters the screen doing an aerial attack, lands and taunt his opponent. At the same time, his partner also taunts and leaves the screen. These behaviours require 6 states in the CNS file of the char, a special animation in its AIR and a special command in its CMD.
In the AIR
========
You must at least create 1 animation (n° 4500) for the aerial attack when the character enters the screen, and include it into the AIR file. Standard
animations can be used for the other states.
In the CNS
========
; Enter the stage doing an aerial attack
;-------------------------------------------
[Statedef 4500]
type = A
movetype = A
physics = N
anim = 4500 ;<- You must include this attack in the AIR
sprpriority = 2
ctrl = 0
[State 4500, position]
type = posset
trigger1 = time = 0
x = (partner, pos x) - 360*facing
y = -150
[State 4500, velocity]
type = VelSet
trigger1 = 1
x = 12
y = 5
[State 4500, hit def]
type = HitDef
trigger1 = !movecontact
attr = A, NA
hitflag = MAF
guardflag = HA
animtype = up
ground.type = low
priority = 4, hit
damage = 53, 0
getpower = 52, 0
pausetime = 10,12
sparkno = 2
guard.sparkno = 40
sparkxy = 0, -5
hitsound = s110,3
guardsound = s120,1
ground.velocity = -4,-9
air.velocity = -4,-6
guard.slidetime = 17
guard.hittime = 17
guard.velocity = -12
fall = 1
air.fall = 1
fall.recovery = 0
[State 4500, screen bound] ; Prevents the camera from following the char
type = ScreenBound
trigger1 = 1
value = 0
[State 4500, end state]
type = ChangeState
trigger1 = pos y >= 0
value = 4501
; Land on the stage
;---------------------
[Statedef 4501]
type = S
movetype = I
physics = S
anim = 47 ;<- standard landing animation
sprpriority = 1
ctrl = 0
[State 4501, stop velocity]
type = VelSet
trigger1 = time = 0
x = 0
y = 0
[State 4501, position]
type = PosSet
trigger1 = time = 0
y = 0
[State 4501, end state]
type = ChangeState
trigger1 = AnimTime = 0
value = 4502
; Arriving Taunt - to adapt to each char
;--------------------------------------------
[Statedef 4502]
type = S
movetype = I
physics = S
sprpriority = 1
; <- Put anything here (animations, sounds, etc...)
[State 4502, end state]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
; Leaving Taunt - to adapt to each char
;--------------------------------------------
[Statedef 4510]
type = S
movetype = I
physics = S
sprpriority = 1
velset = 0,0
ctrl = 0
[State 4510, invincibility]
type = NotHitBy
trigger1 = 1
value = SCA
[State 4510, ghost]
type = PlayerPush
trigger1 = 1
value = 0
; <- Put anything here (animations, sounds, etc...)
[State 4510, end state]
type = ChangeState
trigger1 = AnimTime = 0
value = 4511
; Leave the stage
;-------------------
[Statedef 4511]
type = A
movetype = I
physics = N
anim = 43
sprpriority = 2
ctrl = 0
[State 4511, velocity]
type = VelSet
trigger1 = 1
x = -12
y = -5
[State 4511, invincibility]
type = NotHitBy
trigger1 = 1
value = SCA
[State 4511, ghost]
type = PlayerPush
trigger1 = 1
value = 0
[State 4511, screen bound] ; Prevents the camera from following the char
type = ScreenBound
trigger1 = 1
value = 0
[State 4511, end state]
type = ChangeState
trigger1 = backedgedist < -30
value = 4512
; Wait out of the screen
;--------------------------
[Statedef 4512]
type = A
movetype = I
physics = N
anim = 0
velset = 0,0
ctrl = 0
[State 4512, invincibility]
type = NotHitBy
trigger1 = 1
value = SCA
[State 4512, ghost]
type = PlayerPush
trigger1 = 1
value = 0
[State 4512, screen bound] ; Prevents the camera from following the char
type = ScreenBound
trigger1 = 1
value = 0
[State 4512, life add] ; Gains life
type = LifeAdd
trigger1 = (gametime%10) = 0
value = 1
[State 4512, turn] ; allways face the same direction as partner
type = turn
trigger1 = facing != partner,facing
[State 4512, position] ; allways stay behind and at the same distance of the
char on the stage
type = posset
trigger1 = 1
x = (partner, pos x) - 1000*facing
y = -150
In the -3 states
===========
; Tag Code
;------------
[State -3, enter the screen]
type = ChangeState
triggerall = numpartner != 0 ; Partner exists
triggerall = stateno = 4512 ; Player waiting outside the screen
trigger1 = partner, stateno = 4510 ; Partner leaving the screen
trigger2 = partner, life = 0 ; Partner dead
trigger3 = win ; Win
value = 4500
[State -3, wait out of the stage]
type = ChangeState
triggerall = numpartner != 0 ; Partner exists
triggerall = partner, stateno != [4510,4512] ; Partner not waiting outside the screen (thus on stage)
trigger1 = (id = 33 || id = 35) && (roundstate <= 2) && (time = 0) ; If player is the 2nd teammate, waits outside the screen during the begining of the match
value = 4512
In the CMD
=========
; Tag - leaves the screen
;----
[State -1, tag]
type = ChangeState
value = 4510
triggerall = command = "tag"
triggerall = numpartner != 0
triggerall = partner, life > 0
trigger1 = statetype != A && ctrl
trigger2 = stateno = 200 && movecontact
trigger3 = stateno = 210 && movecontact
trigger4 = etc...
C. RESULTS
If you want to see the results, download the version 1.x of Sayuri Kurala, and take her twice on your team. During the fight, you will be able to switch between both Sayuris by pressing the [z] button.

Byakko | Posted: Oct 23 2002, 02:25 PM
Junior Member Group: Members Posts: 106 Member No.: 21 Joined: 14-September 02
Iron made something like that for his TGT game... (he posted the code on a French forum) I didn't compare the 2, but your is not bad...
Edit : Damn, Sunny, I didn't recognize you... I could have check the url...
--------------------
Fear my Wrath. Trust my Love.

Dr4ch1R | Posted: Oct 25 2002, 07:44 AM
Newbie Group: Members Posts: 4 Member No.: 348 Joined: 16-September 02
In single player simul, does it allow you to take control of the other character once it's tagged in, or is the CPU still in control?

| Posted: Oct 25 2002, 09:16 AM
Group: Posts: Member No.: Joined: -- | At the moment, there's no way to play two chars at the same time in Mugen, so you have to partner with the cpu or the 2nd player if you play in the coop mode. Fortunatelly, the AI of my chars aren't too bad (well at least against the ones who don't have one).

fantoboy | Posted: Oct 25 2002, 12:26 PM
Junior Member Group: Members Posts: 117 Member No.: 159 Joined: 14-September 02
I notice the end animations take a long time to come out whenever there's a character with the AI bug that makes them fall through the floor too. Maybe it's for the same reason? Because one of the characters isn't on the same axis as the floor? Maybe if you have the tag partner come back when the timer hits zero or right at the end of the match when all enemies are KO'd it'll fix it.

Maximilian Jenus | Posted: Oct 25 2002, 03:41 PM
[E] Group: Members Posts: 243 Member No.: 215 Joined: 15-September 02
There are several ways to control 2 players in mugen; but not a single way to access it in cns code.
--------------------
It is your selection of relevant facts that will create interest.A sweeping conception carries with vitality ,purpose and conviction. The more detailed and involved we get,the less forceful and powerful is our message.We can take a compass and draw a circle perfectly ,but we have left no trace of ou

Robnius | Posted: Oct 28 2002, 01:51 PM
Member Group: Members Posts: 79 Member No.: 384 Joined: 16-September 02
The links are not working. Anybody knows how to get them?
--------------------
Just fight me if you can beat me, I hate wasting time!!

| Posted: Nov 1 2002, 12:10 PM
Group: Posts: Member No.: Joined: -- | Edit : I updated the code at the begining of the post. I corrected the previous bugs but there may be some unnoticed. I also updated my page (sunnyworld.fr.st) for those who want to test the code with my chars.

Kazmer | Posted: Feb 16 2003, 11:51 PM
Newbie Group: Members Posts: 7 Member No.: 2324 Joined: 16-February 03
Im finding this very useful, however, my AI seems to loop the "jump in" state quite a bit, particularly if there teamate is dead. I'm not sure why:
;TAG
[State -1, tag]
type = ChangeState
value = 2003
triggerall = var(50) = 0
triggerall = command = "tag"
triggerall = numpartner != 0
triggerall = partner, life > 0
trigger1 = statetype != A && ctrl
[Statedef 2000]
type = A
movetype = A
physics = N
juggle = 5
anim = 4009
sprpriority = 9
ctrl = 0
[State 2000, position]
type = posset
trigger1 = time = 0
x = -150*facing ;HERE
y = 0
[State 2000, Facing]
type = turn
trigger1 = facing = -1
[State 2000, Play]
type = PlaySnd
trigger1 = AnimElem = 10
value = F0, 8
[State 2000, Play2]
type = PlaySnd
trigger1 = AnimElem = 19
value = F0, 42
[State 2000, Play3]
type = PlaySnd
trigger1 = AnimElem = 27
value = F0, 43
[State 2000, Forward]
type = VelSet
trigger1 = AnimElem = 6
trigger2 = AnimElem = 7
trigger3 = AnimElem = 8
trigger4 = AnimElem = 9
trigger5 = AnimElem = 10
trigger6 = AnimElem = 11
trigger7 = AnimElem = 12
trigger8 = AnimElem = 13
trigger9 = AnimElem = 14
trigger10 = AnimElem = 15
trigger11 = AnimElem = 16
trigger12 = AnimElem = 17
trigger13 = AnimElem = 18
trigger14 = AnimElem = 19
trigger15 = AnimElem = 20
trigger16 = AnimElem = 21
trigger17 = AnimElem = 22
trigger18 = AnimElem = 23
trigger19 = AnimElem = 24
trigger20 = AnimElem = 25
x = 4
[State 2000, Up]
type = VelSet
trigger1 = AnimElem = 6
trigger2 = AnimElem = 7
trigger3 = AnimElem = 8
trigger4 = AnimElem = 9
trigger5 = AnimElem = 10
trigger6 = AnimElem = 11
trigger7 = AnimElem = 12
trigger8 = AnimElem = 13
trigger9 = AnimElem = 14
trigger10 = AnimElem = 15
trigger11 = AnimElem = 16
trigger12 = AnimElem = 17
trigger13 = AnimElem = 18
trigger14 = AnimElem = 19
trigger15 = AnimElem = 20
y = -.9
[State 2000, Down]
type = Gravity
trigger1 = AnimElem = 21
trigger2 = AnimElem = 22
trigger3 = AnimElem = 23
trigger4 = AnimElem = 24
trigger5 = AnimElem = 25
trigger6 = AnimElem = 26
trigger7 = AnimElem = 27
trigger8 = AnimElem = 28
trigger9 = AnimElem = 29
trigger10 = AnimElem = 30
trigger11 = AnimElem = 31
value = 1
[State 2000, 1]
type = HitDef
trigger1 = AnimElem = 14
trigger2 = AnimElem = 15
trigger3 = AnimElem = 16
attr = S, NA
damage = 40, 10
guardflag = HA
hitflag = MAF
animtype = Hard
air.animtype = DiagUp
priority = 7
sparkno = -1
guard.sparkno = -1
pausetime = 5, 7
guard.pausetime = 11, 0
hitsound = F0,3
gardsound = F0,10
ground.type = High
ground.slidetime = 15
ground.hittime = 20
ground.velocity = -2.6, 0
fall = 0
air.fall = 0
fall.recover = 0
air.recover = 0
kill = 0
[State 2000, 2]
type = HitDef
trigger1 = AnimElem = 20
trigger2 = AnimElem = 21
trigger3 = AnimElem = 27
trigger4 = AnimElem = 28
trigger5 = AnimElem = 29
attr = S, NA
damage = 40, 10
guardflag = HA
hitflag = MAF
animtype = Hard
air.animtype = DiagUp
priority = 7
sparkno = -1
guard.sparkno = -1
pausetime = 5, 7
guard.pausetime = 11, 0
hitsound = F0,39
gardsound = F0,10
ground.type = High
ground.slidetime = 15
ground.hittime = 20
ground.velocity = -2.6, 0
fall = 0
air.fall = 0
fall.recover = 0
air.recover = 0
kill = 0
[State 2000, Blood Falls]
type = Explod
triggerall = movehit = 1
trigger1 = AnimElem = 20
trigger2 = AnimElem = 21
trigger3 = AnimElem = 27
trigger4 = AnimElem = 28
trigger5 = AnimElem = 29
anim = F18
id = 227
facing = -1
postype = p1
pos = 35, -80
scale = .6,.9
removetime = -2
bindtime = 1
helpertype = normal
sprpriority = 9
ontop = 0
ownpal = 1
[State 2000, Air Kick]
type = ChangeState
triggerall = var(50) = 0
triggerall = pos y != 0
trigger1 = time > 45
trigger1 = command = "airkick"
value = 4007
ctrl = 1
[State 2000, screen bound] ; Prevents the camera from following the char
type = ScreenBound
trigger1 = 1
value = 0
;[State 2000, turn] ; allways face the same direction as partner
;type = turn
;trigger1 = facing != partner,facing
;[State 2000, Facing]
;type = turn
;trigger1 = time = 0
[State 2000, End]
type = Changestate
trigger1 = AnimTime = 0
value = 52
ctrl = 1
[State 2000, End2]
type = Changestate
triggerall = var(50) = 1
trigger1 = AnimTime = 0
value = 52
ctrl = 1
; Leaving Taunt - to adapt to each char
;--------------------------------------------
[Statedef 2003]
type = S
movetype = I
physics = S
sprpriority = 1
velset = 0,0
;anim = 0
ctrl = 0
[State 2003, invincibility]
type = NotHitBy
trigger1 = 1
value = SCA
[State 2003, ghost]
type = PlayerPush
trigger1 = 1
value = 0
[State 2003, end state]
type = ChangeState
trigger1 = time = 5
value = 2004
[State 2000, End2]
type = Changestate
triggerall = var(50) = 1
trigger1 = time = 5
value = 2004
ctrl = 1
; Leave the stage
;-------------------
[Statedef 2004]
type = S
movetype = I
physics = N
anim = 105
sprpriority = 1
ctrl = 0
[State 2004, velocity]
type = VelSet
trigger1 = 1
x = const(velocity.run.back.x)
[State 2004, invincibility]
type = NotHitBy
trigger1 = 1
value = SCA
[State 2004, ghost]
type = PlayerPush
trigger1 = 1
value = 0
[State 2004, screen bound] ; Prevents the camera from following the char
type = ScreenBound
trigger1 = 1
value = 0
[State 2004, end state]
type = ChangeState
trigger1 = backedgedist < -30
value = 2005
[State 2004, End2]
type = Changestate
triggerall = var(50) = 1
trigger1 = backedgedist < -30
value = 2005
ctrl = 1
; Wait out of the screen
[Statedef 2005]
type = S
movetype = I
physics = N
anim = 2000
velset = 0,0
ctrl = 0
[State 2005, invincibility]
type = NotHitBy
trigger1 = 1
value = SCA
[State 2005, ghost]
type = PlayerPush
trigger1 = 1
value = 0
[State 2005, screen bound] ; Prevents the camera from following the char
type = ScreenBound
trigger1 = 1
value = 0
[State 2005, life add] ; Gains life
type = LifeAdd
trigger1 = (gametime%10) = 0
value = 1
[State 2005, turn] ; allways face the same direction as partner
type = turn
trigger1 = facing != partner,facing
[State 2005, position] ; allways stay behind and at the same distance of the char on the stage
type = posset
trigger1 = 1
x = -1000*facing ;(partner, pos x) - 1000*facing
y = 0
; Tag Code
;------------
[State -3, enter the screen]
type = ChangeState
;triggerall = numpartner != 0 ; Partner exists
triggerall = stateno = 2005 ; Player waiting outside the screen
trigger1 = partner, stateno = 2003 ; Partner leaving the screen
trigger2 = partner, life = 0 ; Partner dead
trigger3 = win ; Win
value = 2000
[State -3, wait out of the stage]
type = ChangeState
triggerall = numpartner != 0 ; Partner exists
triggerall = partner, stateno != [2003,2005] ; Partner not waiting outside the screen (thus on stage)
trigger1 = (id = 33 || id = 35) && (roundstate <= 2) && (time = 0) ;2nd teammate waits outside the screen during intro
value = 2005

Maximilian Jenus | Posted: Feb 17 2003, 02:19 AM
[E] Group: Members Posts: 243 Member No.: 215 Joined: 15-September 02
actually, i was wrong in my last post, you can redirect the partner input in your cmd, so your partner can control you.;i have not worked around it, and i don't know if i ever will, though
--------------------
It is your selection of relevant facts that will create interest.A sweeping conception carries with vitality ,purpose and conviction. The more detailed and involved we get,the less forceful and powerful is our message.We can take a compass and draw a circle perfectly ,but we have left no trace of ou

Inverse | Posted: Feb 21 2003, 02:31 AM
Member Group: Members Posts: 14 Member No.: 875 Joined: 8-October 02
Kazmer: The problem is in the "[State -3, wait out of the stage]" state, it's a bit too permissive causes the character to loop back to the "jump in" state. I added these triggers to Elias and it worked fine:
trigger1 = Partner, Life > 0
trigger1 = Life > 0
trigger1 = StateNo != [4510, 4512]
As a side note, which other characters besides Lynn and Elias use or are planing to use this code?
--------------------
Greetings from Inverse
mr_santana@hotmail.com
http://inverse.mgbr.net

Kazmer | Posted: Feb 21 2003, 04:01 AM
Newbie Group: Members Posts: 7 Member No.: 2324 Joined: 16-February 03
Hmmm, it didn't seem to work on mine. I think the problem lies elsewhere

sunny | Posted: Feb 21 2003, 09:19 AM
Newbie Group: Members Posts: 8 Member No.: 416 Joined: 17-September 02
?_? That's a strange pb. Like Inverse pointed out, it should come from a -2 state, a -3 state or maybe the state 2000 itself.
Well, I'll check your code this WE to see where the pb is coming from. I you wish to send me a sample of your char, it could also be more helpfull.
I'm planning to put the code on Nakoruru when I'll have some free time to work on her, and on Akari as well. With Sayuri, Lynn and Elias, that will make at least 5 chars using it !

Inverse | Posted: Feb 23 2003, 06:54 PM
Member Group: Members Posts: 14 Member No.: 875 Joined: 8-October 02
Alright. I'm already adding it to Oni, and maybe I do the same with other chars. Let' hope this expand fast
--------------------
Greetings from Inverse
mr_santana@hotmail.com
http://inverse.mgbr.net

sunny | Posted: Feb 24 2003, 01:58 PM
Newbie Group: Members Posts: 8 Member No.: 416 Joined: 17-September 02
kazmer : I checked the code but I couldn't find : when I put
triggerall = partner, life > 0
in the "wait out of the stage" state, everything works fine with me. Otherwise I don't know where the pb could come from.
BTW inverse, shouldn't ROTD chars be invincible while entering the screen until they attack ? In that case I made a mistake. The state :
[State 4500, invincibility]
type = NotHitBy
trigger1 = BackEdgeBodyDist <= 0
value = SCA
time = 2
should be replaced by :
[State 4500, invincibility]
type = NotHitBy
trigger1 = 1
value = SCA

« Next Oldest | Development Discussion | Next Newest »

Pages: (2) [1] 2 |

Close Topic Options
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
- M.U.G.E.N Development Forum - Contact an admin - ELECBYTE - Shin Mugen -
Powered by Invision Power Board(U) v1.2 © 2003 IPS, Inc.