YesNoOk
avatar

[SOLVED] Division by Zero error and how to make a certain trigger act like.. (Read 1409 times)

Started by Maistral, July 22, 2011, 07:01:23 pm
Share this topic:
[SOLVED] Division by Zero error and how to make a certain trigger act like..
New #1  July 22, 2011, 07:01:23 pm
  • avatar
  • **
  • Whatever.
okay, i have this overly random problem of having a division by zero error. or maybe not, i can't tell, honestly.

i copied this piece of code from somewhere else, since the other "aimed projectile" code wont work when it's used with the floor function thing.

Code:
[State 7101, Null]
type = Null
triggerall = !time
trigger1 = (FVar(3) := (P2Dist X * 20) / (Exp(0.5*ln((P2Dist X * P2Dist X) + (P2Dist Y * P2Dist Y)))))
trigger1 = (FVar(4) := (P2Dist Y * 15) / (Exp(0.5*ln((P2Dist X * P2Dist X) + (P2Dist Y * P2Dist Y)))))

[State 7101, VelSet]
type = VelSet
trigger1 = 1
x = FVar(3)
y = FVar(4)

so yeah, my projectiles ended up "aimed", but for some time i get random "division by zero" errors...

this is my entire code for that attack:

Code:
;---------------------------------------------------------------------------
;SATETSU SHIGURE------------------------------------------------------------
;IRON SAND DRIZZLE----------------------------------------------------------
;---------------------------------------------------------------------------
;Iron Sand Bullets (Satetsu Shigure)
;---------------------------------------------------------------------------

;the bullet
[StateDef 7011]
type = S
movetype= A
physics = S
juggle  = 3
velset = 0,0
ctrl = 0
anim = 7910
poweradd = 0
sprpriority = 1

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(59),var(58)
vel = 0,-5
postype = p1
ontop = 1

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(57),var(56)
vel = 0,-5
postype = p1
ontop = 1

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(55),var(54)
vel = 0,-5
postype = p1
ontop = 1

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(53),var(52)
vel = 0,-5
postype = p1
ontop = 1

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(51),var(50)
vel = 0,-5
postype = p1
ontop = 1

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 59
range = -20,20

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 58
range = 20,-20
;range = -120,-200

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 57
range = -20,20

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 56
range = 20,-20
;range = -120,-200

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 55
range = -20,20

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 54
range = 20,-20
;range = -120,-200

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 53
range = -20,20

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 52
range = 20,-20
;range = -120,-200

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 51
range = -20,20

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 50
range = 20,-20
;range = -120,-200

[State 7011, 1]
type = ChangeState
trigger1 = animelem = 6 && parent,p2dist x > -1 && facing = -1 || animelem = 3 && parent,p2dist x > -1 && facing = 1
value = 7101

[State 7011, 2]
type = ChangeState
trigger1 = animtime = 8
value = 71010

;if enemy reaches the back of sandaime, then bullet will fall rapidly,

[StateDef 71010]
type = S
movetype= A
physics = S
juggle  = 3
velset = 0,0
ctrl = 0
anim = 7216
poweradd = 0
sprpriority = 2

[State 7101, VelSet]
type = VelSet
trigger1 = 1
x = ifelse(random < 500 , -2,ifelse(random < 500 , 2,ifelse(random < 500 , -1,1)))
y = 11

[State 7101, blah]
type = AngleSet
trigger1 = 1
value = (atan(Vel Y/Vel X) + (pi)) *(-180/Pi)
;value = (atan(Vel Y/Vel X) + (3*pi/2)) *(-180/Pi)

[State 7101, blah]
type = AngleDraw
trigger1 = 1

[State 0, AfterImage]
type = AfterImage
trigger1 = animelem = 1
time = 15
length = 20
palcontrast = 40,0,88
paladd = 20,20,20
palmul = .65,.65,.75
timegap = 2
framegap = 1
trans = add1

[State 7101, 1]
type = HitDef
trigger1 = time = 0
attr = S, NP
damage = 3,2
animtype = medium
guardflag = MA
hitflag = MAFDP
priority = 3, Hit
pausetime = 0, 0
sparkno = 1
sparkxy = 0, 0
hitsound = 5, 0
guardsound = 6, 0
ground.type = High
ground.slidetime = 5
ground.hittime  = 12
ground.velocity = -0.8
airguard.velocity = -0.3,-.8
air.type = High
air.velocity = -0.8,-0.3
air.hittime = 12
envshake.time = 10
envshake.freq = 90
envshake.ampl = -4
envshake.phase = 90

[State 7101, end]
type = VelSet
trigger1 = pos y > 1
x = 0
y = 0

[State 405, explod]
type = explod
trigger1 = pos y > 1
anim = 7084
pos = 0,0
postype = p1
removetime = 15
ontop = 1
scale = 0.6,0.6
persistent = no

[State 0, PlaySnd]
type = PlaySnd
trigger1 = pos y > 1
value = 8,1
volume = 0
channel = -1
freqmul = 1.0
loop = 0
pan = 0
persistent = no

[State 0, PlaySnd]
type = PlaySnd
trigger1 = pos y > 1
value = 9,10
volume = 0
channel = -1
freqmul = 1.0
loop = 0
pan = 0
persistent = no

[State 0, PlaySnd]
type = PlaySnd
trigger1 = pos y > 1
value = 60,3
volume = 0
channel = -1
freqmul = 1.0
loop = 0
pan = 0
persistent = no

[State 0, EnvShake]
type = EnvShake
trigger1 = pos y > 1
time = 10
freq = 90
ampl = -4
phase = 90
;ignorehitpause =
persistent = no


[State 7101, DestroySelf]
type = DestroySelf
trigger1 = time >= 25

;if stays at front, it will home at target,

[StateDef 7101]
type = S
movetype= A
physics = S
juggle  = 3
velset = 0,0
ctrl = 0
anim = 7216
poweradd = 0
sprpriority = 2

[State 7101, Null]
type = Null
triggerall = !time
trigger1 = (FVar(3) := (P2Dist X * 20) / (Exp(0.5*ln((P2Dist X * P2Dist X) + (P2Dist Y * P2Dist Y)))))
trigger1 = (FVar(4) := (P2Dist Y * 15) / (Exp(0.5*ln((P2Dist X * P2Dist X) + (P2Dist Y * P2Dist Y)))))

[State 7101, VelSet]
type = VelSet
trigger1 = 1
x = FVar(3)
y = FVar(4)

[State 7101, VelSet]
type = VelSet
trigger1 = p2dist y < parentdist y
x = ifelse(random < 500 , -2,ifelse(random < 500 , 2,ifelse(random < 500 , -1,1)))
y = 11

[State 7101, blah]
type = AngleSet
trigger1 = 1
value = (atan(Vel Y/Vel X) + (pi)) *(-180/Pi)
;value = (atan(Vel Y/Vel X) + (3*pi/2)) *(-180/Pi)

[State 7101, blah]
type = AngleDraw
trigger1 = 1

[State 0, AfterImage]
type = AfterImage
trigger1 = animelem = 1
time = 15
length = 5
palcontrast = 40,0,88
paladd = 20,20,20
palmul = .65,.65,.75
timegap = 1
framegap = 1
trans = add1

[State 7101, 1]
type = HitDef
trigger1 = time = 0
attr = S, NP
damage = 3,2
animtype = medium
guardflag = MA
hitflag = MAFDP
priority = 3, Hit
pausetime = 0, 0
sparkno = 1
sparkxy = 0, 0
hitsound = 5, 0
guardsound = 6, 0
ground.type = High
ground.slidetime = 5
ground.hittime  = 12
ground.velocity = -0.8
airguard.velocity = -0.3,-.8
air.type = High
air.velocity = -0.8,-0.3
air.hittime = 12
envshake.time = 10
envshake.freq = 90
envshake.ampl = -4
envshake.phase = 90

[State 7101, end]
type = VelSet
trigger1 = pos y > 1
x = 0
y = 0

[State 405, explod]
type = explod
trigger1 = pos y > 1
anim = 7084
pos = 0,0
postype = p1
removetime = 15
ontop = 1
scale = 0.6,0.6
persistent = no

[State 0, PlaySnd]
type = PlaySnd
trigger1 = pos y > 1
value = 9,15
volume = 0
channel = -1
freqmul = 1.0
loop = 0
pan = 0
persistent = no

[State 0, PlaySnd]
type = PlaySnd
trigger1 = pos y > 1
value = 9,10
volume = 0
channel = -1
freqmul = 1.0
loop = 0
pan = 0
persistent = no

[State 0, PlaySnd]
type = PlaySnd
trigger1 = pos y > 1
value = 60,3
volume = 0
channel = -1
freqmul = 1.0
loop = 0
pan = 0
persistent = no

[State 0, EnvShake]
type = EnvShake
trigger1 = pos y > 1
time = 10
freq = 90
ampl = -4
phase = 90
;ignorehitpause =
persistent = no


[State 7101, DestroySelf]
type = DestroySelf
trigger1 = time >= 25

;---------------------------------------------------------------------------
;Satetsu Shigure Puppet Prepare
[Statedef 2030]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 0
ctrl = 0
velset = 0,0
anim = 4003
sprpriority = 1

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(59),var(58)
vel = 0,-5
postype = p1
ontop = 1

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(57),var(56)
vel = 0,-5
postype = p1
ontop = 1

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(55),var(54)
vel = 0,-5
postype = p1
ontop = 1

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(53),var(52)
vel = 0,-5
postype = p1
ontop = 1

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(51),var(50)
vel = 0,-5
postype = p1
ontop = 1

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 59
range = -20,70

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 58
range = 20,-90
;range = -120,-200

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 57
range = -20,70

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 56
range = 20,-90
;range = -120,-200

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 55
range = -20,70

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 54
range = 20,-90
;range = -120,-200

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 53
range = -20,70

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 52
range = 20,-90
;range = -120,-200

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 51
range = -20,70

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 50
range = 20,-90
;range = -120,-200

[State 2303, HitOverride]
type = hitoverride
trigger1 = 1
attr = SCA, NT, ST, HT, NA, SA, HA,NP,SP,HP
stateno = 2020
time = 1

[State 2030, parentvarset]
type = parentvarset
trigger1 = animelem = 1
v = 31
value = 1

[State 0, PowerAdd]
type = PowerAdd
trigger1 = animelem = 1
value = -500
;ignorehitpause =
;persistent =

[State 1000, PlaySnd]
type = PlaySnd
trigger1 = animelem = 1
value = 9,3
volume = 1600
channel = 0

[State 2303, 2]
type = ChangeState
trigger1 = animtime = 0
value = 2303

;---------------------------------------------------------------------------
;Satetsu Shigure Puppet Release
[Statedef 2303]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 0
ctrl = 0
velset = 0,0
anim = 4030
sprpriority = 1

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(59),var(58)
vel = 0,-5
postype = p1
ontop = 1

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(57),var(56)
vel = 0,-5
postype = p1
ontop = 1

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(55),var(54)
vel = 0,-5
postype = p1
ontop = 1

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(53),var(52)
vel = 0,-5
postype = p1
ontop = 1

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(51),var(50)
vel = 0,-5
postype = p1
ontop = 1

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 59
range = -20,70

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 58
range = 20,-90
;range = -120,-200

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 57
range = -20,70

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 56
range = 20,-90
;range = -120,-200

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 55
range = -20,70

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 54
range = 20,-90
;range = -120,-200

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 53
range = -20,70

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 52
range = 20,-90
;range = -120,-200

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 51
range = -20,70

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 50
range = 20,-90
;range = -120,-200

[State 2030, HitOverride]
type = hitoverride
trigger1 = 1
attr = SCA, NT, ST, HT, NA, SA, HA,NP,SP,HP
stateno = 2020
time = 1

[State 2030, parentvarset]
type = parentvarset
trigger1 = animtime = 0
v = 31
value = 0

;Iron Sand Rain Spammer
[State 0, VarRandom]
type = VarRandom
trigger1 = 1
v = 43
range = -5,floor(p2dist X) + 60
;ignorehitpause =
;persistent =

[State 0, varrandom]
type = varrandom
trigger1 = 1
v = 42
range = -40,-70
;ignorehitpause =
;persistent =

[State 7010, varrandom]
type = varrandom
trigger1 = p2dist x < 0 && facing = -1 || p2dist x < 0 && facing = 1
v = 42
range = 0,-70

[State 7010, varrandom]
type = varrandom
trigger1 = p2dist x < 0 && facing = -1 || p2dist x < 0 && facing = 1
v = 43
range = 20,45

;Iron Sand Bullet Spam starts here
[State 8060, 2]
type = helper
trigger1 = animelem = 4
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 5
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 6
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 7
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 8
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 9
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 10
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 11
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 12
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 13
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 14
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 15
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 16
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 17
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 18
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 19
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 20
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 21
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 22
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 23
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 24
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 25
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 26
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 27
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 28
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 29
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 30
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 31
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 32
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 33
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 34
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 35
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 36
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 37
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 38
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 39
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 40
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 41
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 42
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 43
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 44
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 8060, 2]
type = helper
trigger1 = animelem = 45
helpertype = normal
stateno = 7011
pos = var(43),var(42)
postype = p1
ontop = 1

[State 2030, parentvarset]
type = parentvarset
trigger1 = parent, command = "s"
v = 20
value = 5

[State 2030, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 2000
ctrl = 1

[State 2030, 4]
type = changestate
trigger1 = parent, command = "s"
trigger2 = parent, life = 0
value = 2099

;---------------------------------------------------------------------------
;SATETSU SHIGURE END
;---------------------------------------------------------------------------


I tried to look at when the errors usually appear, and apparently they appear when one of the bullets don't move at all (they get stuck instead when spammed). I initially wanted them that the moment they appear, they immediately go towards the enemy. But yeah, for some reason, some one, or two bullets in a whole round of attack won't move, and when those wont move, I get a division by zero error:


***notice the horizontal bullet at middle right side there. when one of the needles stop, one "division by zero" error line appears.






also, just wanna ask, if there is a way for you to code a trigger this way:

"first, they have to trigger pos y > 1.
then they have to trigger time > 25.
after that, the state would trigger"

(trigger pos y first, then count 25 ticks, then state would activate)

thanks guys, more power  :sugoi:



MUGEN CHARACTERS
Sabaku no Temari [100%] = RELEASED!
Akasuna no Sasori [100%] = RELEASED!
Namikaze Minato [5%] = ON HOLD
Uzumaki Naruto [5%] = Coding basic attacks

Last Edit: July 26, 2011, 10:42:29 am by temaridaikamaitachi
Re: Division by Zero error and how to make a certain trigger act like..
#2  July 23, 2011, 05:53:34 am
  • *****
  • Shame on you!
    • USA
I'd think  / (Exp(0.5*ln((P2Dist X * P2Dist X) + (P2Dist Y * P2Dist Y)))))
would be the problem if it's a divided by 0.
Just set up a check to see if it's 0 or not, if it is, make it something else.
vVv Gouken718 vVv
Re: Division by Zero error and how to make a certain trigger act like..
#3  July 23, 2011, 10:12:05 am
  • avatar
  • **
  • Whatever.
i played a little bit with my coding again, and found out that if i rid the angleset and angledraw states, i get no error at all.

Code:
[State 7101, Null]
type = Null
triggerall = !time
trigger1 = (FVar(3) := (P2Dist X * 20) / (Exp(0.5*ln((P2Dist X * P2Dist X) + (P2Dist Y * P2Dist Y)))))
trigger1 = (FVar(4) := (P2Dist Y * 15) / (Exp(0.5*ln((P2Dist X * P2Dist X) + (P2Dist Y * P2Dist Y)))))

[State 7101, VelSet]
type = VelSet
trigger1 = 1
x = FVar(3)
y = FVar(4)
;persistent = yes

[b][State 7101, blah]
type = AngleSet
trigger1 = 1
value = (atan(Vel Y/Vel X) + (pi)) *(-180/Pi)
;value = (atan(Vel Y/Vel X) + (3*pi/2)) *(-180/Pi)

[State 7101, blah]
type = AngleDraw
trigger1 = 1[/b]

i just can't tell what's wrong.. someone help? :(


also, i get some errors if for example, i used the attack when the enemy is "dead": the bullets don't move and instead just sit around and be spawned, not moving at all, and i get a flood of division by zero errors.

i'd also like to ask again about this:
Quote
also, just wanna ask, if there is a way for you to code a trigger this way:

"first, they have to trigger pos y > 1.
then they have to trigger time > 25.
after that, the state would trigger"

(trigger pos y first, then count 25 ticks, then state would activate)


MUGEN CHARACTERS
Sabaku no Temari [100%] = RELEASED!
Akasuna no Sasori [100%] = RELEASED!
Namikaze Minato [5%] = ON HOLD
Uzumaki Naruto [5%] = Coding basic attacks

Re: Division by Zero error and how to make a certain trigger act like..
#4  July 23, 2011, 10:21:11 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
The code is designed to take effect while the things are moving. You're getting div by 0 because vel X or vel Y are 0. I forget which way round it is cos i'm no math buff. Just make sure one or the other is > 0 before you activate the angleset.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
Re: Division by Zero error and how to make a certain trigger act like..
#5  July 23, 2011, 01:55:48 pm
  • avatar
  • **
  • Whatever.
double-post dam lag  >:D


MUGEN CHARACTERS
Sabaku no Temari [100%] = RELEASED!
Akasuna no Sasori [100%] = RELEASED!
Namikaze Minato [5%] = ON HOLD
Uzumaki Naruto [5%] = Coding basic attacks

Re: Division by Zero error and how to make a certain trigger act like..
#6  July 23, 2011, 01:57:19 pm
  • avatar
  • **
  • Whatever.
The code is designed to take effect while the things are moving. You're getting div by 0 because vel X or vel Y are 0. I forget which way round it is cos i'm no math buff. Just make sure one or the other is > 0 before you activate the angleset.

i changed the angleset trigger to:

Code:
trigger1 = animelem = 1

and yeah, i got even lesser errors, lesser than before. but then again, there are still errors... :(


MUGEN CHARACTERS
Sabaku no Temari [100%] = RELEASED!
Akasuna no Sasori [100%] = RELEASED!
Namikaze Minato [5%] = ON HOLD
Uzumaki Naruto [5%] = Coding basic attacks

Re: Division by Zero error and how to make a certain trigger act like..
#7  July 24, 2011, 01:51:17 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
trigger1 = vel X!= 0 for example. Of course that should possibly be vel Y!= 0, i don't remember which way round it breaks.

Really, you should be trying this stuff. Animelem is NOT the only trigger ever.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
Re: Division by Zero error and how to make a certain trigger act like..
#8  July 24, 2011, 09:33:32 am
  • avatar
  • **
  • Whatever.
yeah, thanks. vel X and vel Y did the trick. sorry for the trouble.

it's because i'm trying to figure out two things, before i have finally perfected this super-attack. -.-!

this is how the character is doing now:
http://www.youtube.com/watch?v=DqoV8DgZvvk







anyway, the problems. i had to deal with these for three days now, causing some sleepless nights, which is definitely annoying. (and still currently dealing with it :S )

1) my varset won't be "activated". variable 37 checks if enemy is "DEAD" or not. variable 37 becomes equal to 1 if p2 has no more life, and the iron sand drizzle sequence is over (animtime = 0). if target is not dead (or there is another acquired target), var37 becomes 0.

the purpose of this var37 is to change the "way" the bullets would hit thru changestate. if var 37 = 1, i wanted the bullet spawned to be changed to [71010], but even how hard i try, the code STILL ends up spawning [7101], which is incredibly annoying. i don't understand why.  >:( any insights?



Code:
;the bullet
[StateDef 7011]
type = S
movetype= A
physics = S
juggle  = 3
velset = 0,0
ctrl = 0
anim = 7215
poweradd = 0
sprpriority = 1

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(59),var(58)
vel = 0,-5
postype = p1
ontop = 1

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(57),var(56)
vel = 0,-5
postype = p1
ontop = 1

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 59
range = -30,30

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 58
range = 30,-30
;range = -120,-200

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 57
range = -30,30

[State 7010, varrandom]
type = varrandom
trigger1 = 1
v = 56
range = 30,-30
;range = -120,-200

[State 7011, 1]
type = ChangeState
trigger1 = animelem = 6 && parent,p2dist x > -1 && (p2dist y + 70) < parentdist y && facing = -1 && var(37) != 1 || animelem = 6 && parent,p2dist x > -1 && (p2dist y + 70) < parentdist y && facing = 1 && var(37) != 1
value = 7110

[State 7011, 2]
type = ChangeState
trigger1 = animelem = 6 && parent,p2dist x > -1 && facing = -1 && var(37) != 1 || animelem = 6 && parent,p2dist x > -1 && facing = 1 && var(37) != 1
value = 7101

[State 7011, 3]
type = ChangeState
trigger1 = animtime = 0 && var(37) = 1
value = 71010




;-------

;Satetsu Shigure Puppet Prepare
[Statedef 2030]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 0
ctrl = 0
velset = 0,0
anim = 4003
sprpriority = 1

[State 2030, VarSet]
type = VarSet
trigger1 = animelem = 1 && p2life != 0
v = 37    ;fv = 10
value = 0
;ignorehitpause =
;persistent =

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(59),var(58)
vel = 0,-5
postype = p1
ontop = 1




;Satetsu Shigure Puppet Release
[Statedef 2303]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 0
ctrl = 0
velset = 0,0
anim = 4030
sprpriority = 1

[State 2030, VarSet]
type = VarSet
trigger1 = animtime = 0 && p2life = 0
v = 37    ;fv = 10
value = 1
;ignorehitpause =
;persistent =

[State 8060, 2]
type = explod
trigger1 = time = 0
trigger2 = time + 1
helpertype = normal
anim = 7910
pos = var(59),var(58)
vel = 0,-5
postype = p1
ontop = 1


and lastly, 2) i'm trying to figure out how to code this as a trigger:

"first, they have to trigger pos y > 1.
then they have to trigger time > 25.
after that, the helper would be destroyed"

i know, the simplest way is to have a changestate when the projectile triggers pos y > 1, then have the new state to be destroyed after 25 ticks. however, i end up messing with the "animation" and the "look", the bullets are supposed to land "realistically" (you know, sharp end stuck at ground), but if i use changestates, when the bullets land, the state would be changed into an ugly horizontal bullet.

with research, i found out about omitting the anim line in the new state, but strangely when the bullet lands, it spawns multiple copies of sasori (the character instead).

this is such a big headache.. -.-!

cheers


MUGEN CHARACTERS
Sabaku no Temari [100%] = RELEASED!
Akasuna no Sasori [100%] = RELEASED!
Namikaze Minato [5%] = ON HOLD
Uzumaki Naruto [5%] = Coding basic attacks

Last Edit: July 25, 2011, 05:50:47 am by temaridaikamaitachi
Re: Division by Zero error and how to make a certain trigger act like..
#9  July 25, 2011, 08:32:57 am
  • avatar
  • **
  • Whatever.
bump :(


MUGEN CHARACTERS
Sabaku no Temari [100%] = RELEASED!
Akasuna no Sasori [100%] = RELEASED!
Namikaze Minato [5%] = ON HOLD
Uzumaki Naruto [5%] = Coding basic attacks

Re: Division by Zero error and how to make a certain trigger act like..
#10  July 25, 2011, 08:38:43 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
I don't understand where you get to 2303 from, it's the only state where you set 37 to 1. And nothing happens in that state anyway.

As for the angle stuff. It's a helper. You know what it's angle IS because you have the code. Save the code into a variable. Then reference the variable in the next state.

fvar(5) = large equation giving result of 112 or whatever
next state
angledraw
value = fvar(5)

Lastly, and to make things easy for you. Explods take a random parameter. You don't need a variable for them to define a random position. Alternatively

pos = -30+random%60, -30+random%60

Varrandom still has a tendency to pick numbers at the lower end of the spectrum. The above will actually give a better random effect.

Oh, and as i was posting when i saw that. You're still on the first page. Your topic is still in the first 3-4 posts. DO NOT BUMP IT AGAIN EVER. You are not more important than anyone else. This is not a JOB. Someone will answer when they know it. Would you prefer to just have people coming in saying "i don't know?" Bloody well have patience.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
Re: Division by Zero error and how to make a certain trigger act like..
#11  July 25, 2011, 09:02:07 am
  • avatar
  • **
  • Whatever.
oh, sorry.

guess no one knows how to deal with the second problem.. i used a different solution on the first problem tho, so it's solved. -.-


MUGEN CHARACTERS
Sabaku no Temari [100%] = RELEASED!
Akasuna no Sasori [100%] = RELEASED!
Namikaze Minato [5%] = ON HOLD
Uzumaki Naruto [5%] = Coding basic attacks

Last Edit: July 25, 2011, 09:18:03 am by temaridaikamaitachi
Re: Division by Zero error and how to make a certain trigger act like..
#12  July 25, 2011, 09:16:07 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
Gave you the answer to the 2nd problem as well. Please read my post again.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
Re: Division by Zero error and how to make a certain trigger act like..
#13  July 25, 2011, 09:21:06 am
  • avatar
  • **
  • Whatever.
it's just that i spam multiple helper-type projectiles. they would wind up angled in one same direction which is ugly (or i could not understand what you were saying, i'm not a really technically-savvy guy here, i just want to learn). that's why i was asking if this was possible to be coded:

"first, they have to trigger pos y > 1.
after that triggers, they have to trigger time > 25.
after that, the helper would be destroyed"

i will still try tho.

that, and this last question (the character is almost done XD)

i spawned an immobile (vel x & y are zero) helper. This helper increases in size; I plan that if this helper increases in size and hits the floor, explods would be spawned at the floor. I don't know what tag to place here. I'm still searching for answers tho  :'(


MUGEN CHARACTERS
Sabaku no Temari [100%] = RELEASED!
Akasuna no Sasori [100%] = RELEASED!
Namikaze Minato [5%] = ON HOLD
Uzumaki Naruto [5%] = Coding basic attacks

Re: Division by Zero error and how to make a certain trigger act like..
#14  July 25, 2011, 09:44:04 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
Each helper has it's own set of variables. The helper obviously sets angle at some point. Simply save the value of your equation as a variable and refer to it for the angleset/angledraw in all states.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.
Re: Division by Zero error and how to make a certain trigger act like..
#15  July 25, 2011, 10:41:47 am
  • avatar
  • **
  • Whatever.
will try.  ;D

anyway, is this really "uncodable"?

"first, they have to trigger pos y > 1.
after that triggers, they have to trigger time > 25.
after that, the helper would be destroyed"

no matter how hard i try, i can't make it work, maybe because && and || are the only operators i know  --;


edit:

i did this

Code:
;code in satetsu cloud
[State 7011, VarSet]
type = VarSet
trigger1 = 1
fv = 22    ;fv = 10
value = (atan(Vel Y/Vel X) + (pi)) *(-180/Pi) ;112 for test
;ignorehitpause =
;persistent =

[State 7011, 1]
type = ChangeState
trigger1 = animelem = 8 && parent,p2dist x > -1 && (p2dist y + 70) < parentdist y && facing = -1 || animelem = 6 && parent,p2dist x > -1 && (p2dist y + 70) < parentdist y && facing = 1
value = 7110

[State 7011, 2]
type = ChangeState
trigger1 = animelem = 8 && parent,p2dist x > -1 && facing = -1 || animelem = 6 && parent,p2dist x > -1 && facing = 1
value = 7101

[State 7011, 3]
type = ChangeState
trigger1 = animelem = 8 && parent,p2dist x < -1 && facing = -1 || animelem = 6 && parent,p2dist x < -1 && facing = 1 || animtime = 0
value = 71010


; code in bullet 1
[State 71010, blah]
type = AngleSet
trigger1 = vel X != 0 || vel Y != 0;time = 0
value = fvar(22)
;value = (atan(Vel Y/Vel X) + (3*pi/2)) *(-180/Pi)

; code in bullet 2
[State 7110, blah]
type = AngleSet
trigger1 = vel X != 0 || vel Y != 0;time = 0
value = fvar(22)
;value = (atan(Vel Y/Vel X) + (3*pi/2)) *(-180/Pi)

; code in bullet 3
[State 7101, blah]
type = AngleSet
trigger1 = vel X != 0 || vel Y != 0;time = 0
value = fvar(22)
;value = (atan(Vel Y/Vel X) + (3*pi/2)) *(-180/Pi)

where should i place the equation? i don't know where - if i place it on one of the bullets, they don't turn at all. if i place it on the satetsu clouds, i get div/0 error (clouds are not moving)








MUGEN CHARACTERS
Sabaku no Temari [100%] = RELEASED!
Akasuna no Sasori [100%] = RELEASED!
Namikaze Minato [5%] = ON HOLD
Uzumaki Naruto [5%] = Coding basic attacks

Last Edit: July 25, 2011, 11:04:12 am by temaridaikamaitachi
Re: Division by Zero error and how to make a certain trigger act like..
#16  July 25, 2011, 10:52:00 am
  • avatar
  • ******
    • USA
Quote
will try.  ;D

anyway, is this really "uncodable"?

"first, they have to trigger pos y > 1.
after that triggers, they have to trigger time > 25.
after that, the helper would be destroyed"

no matter how hard i try, i can't make it work, maybe because && and || are the only operators i know  --;

Use a variable for that.

"Var(x)" will be the trigger that will start the count that will destroy the helper. I assume you actually want to start counting up to 25 ticks when the helper is in pos y > 1 (Because I dont know if you're changing states after that so using time > 25 without changestate would be silly. This will fix that up but also works on both cases).

just paste this.
Code:
[state bla whatever]
type = varset
trigger1 = !var(x) && pos y > 1
var(x) = 1
persistent = 0

[state bla whatever]
type = varadd
trigger1 = var(x) && var(x) < 25
var(x) = 1

[state bla whatever]
type = destroyself
trigger1 = var(x) > 24

(Of course, replace var(x) with a valid variable number &gt;_&gt;).
Re: Division by Zero error and how to make a certain trigger act like..
#17  July 25, 2011, 11:19:39 am
  • avatar
  • **
  • Whatever.
oh! thank goodness, you're a lifesaver. @_@ i also adjusted it with certain things to suit my needs. XD

1 less thing to worry about now; i don't have to deal with anglesets anymore XD now, there's just one.  --;



i spawned an immobile (vel x & y are zero) helper. This helper increases in size; I plan that if this helper increases in size and hits the floor, explods would be spawned at the floor. I don't know what trigger to place here (there's nothing in the documentations.. -.-!)


MUGEN CHARACTERS
Sabaku no Temari [100%] = RELEASED!
Akasuna no Sasori [100%] = RELEASED!
Namikaze Minato [5%] = ON HOLD
Uzumaki Naruto [5%] = Coding basic attacks

Last Edit: July 25, 2011, 11:26:23 am by temaridaikamaitachi
Re: Division by Zero error and how to make a certain trigger act like..
#18  July 26, 2011, 10:38:58 am
  • avatar
  • **
  • Whatever.
solving this thread since the title problems are solved anyway.



MUGEN CHARACTERS
Sabaku no Temari [100%] = RELEASED!
Akasuna no Sasori [100%] = RELEASED!
Namikaze Minato [5%] = ON HOLD
Uzumaki Naruto [5%] = Coding basic attacks