YesNoOk
avatar

Projectile (SCTRL) 1.0 + 1.1b (Read 83445 times)

Started by Odb718, October 13, 2015, 09:06:07 pm
Share this topic:
Projectile (SCTRL) 1.0 + 1.1b
#1  October 13, 2015, 09:06:07 pm
  • *****
  • Shame on you!
    • USA
Creates a projectile for the player. The Projectile controller takes all the parameters of the HitDef controller, which control the HitDef for the projectile. In addition, Projectile has the following additional parameters:

Required parameters:
    none

Optional parameters:
    ProjID = id_no (int)        Specifies an ID number to refer to this projectile by. Should be positive, if specified.

    projanim = anim_no (int)        Specifies the animation action number to use for the projectile's animation. Defaults to 0 if omitted.

    projhitanim = anim_no (int)        Specifies the animation action number to play when the projectile hits the opponent. Defaults to -1 (no change in animation) if omitted.

    projremanim = anim_no (int)        Specifies the animation action number to play when the projectile is removed (due to its time expiring or hitting the its removal boundaries, etc.) If omitted, projhitanim is used instead.

    projcancelanim = anim_no (int)        Specifies the animation action number to play when the projectile is cancelled by hitting another projectile. If omitted, projremanim is used instead.

    projscale = x_scale, y_scale (float, float)        Specifies the scale factor of the projectile. The final scale of the projectile is affected by both this parameter and the "proj.doscale" parameter in the [Size] group of p1's constants file. Defaults to 1,1 (normal size) if omitted.

    projremove = remove_flag (boolean)        Set to a non-zero value to have the projectile be removed after it hits, or to 0 to disable this behavior. Defaults to 1.

    projremovetime = remove_time (int)        Specifies the number of ticks after which the projectile should be removed from the screen. If -1, the projectile will not be removed. Defaults to -1.

    velocity = x_vel, y_vel (float, float)        Specifies the initial x and y velocities for the projectile to travel at. Defaults to 0,0 if omitted.

    remvelocity = x_vel, y_vel (float, float)        Specifies the x and y velocities at which the projectile should travel while being removed. Defaults to 0,0 if omitted.

    accel = x_accel, y_accel (float, float)        Specifies the acceleration to apply to the projectile in the x and y directions. Defaults to 0,0 if omitted.

    velmul = x_mul, y_mul (float, float)        Specifies x and y velocity multipliers. The projectile's velocity is multiplied by these multipliers on every tick. The multipliers default to 1 if omitted.

    projhits = num_hits (int)        Specifies the number of hits that the projectile can impart on an opponent before it is removed. Defaults to 1.

    projmisstime = miss_time (int)        If the projectile is configured for multiple hits, miss_time specifies the number of ticks after each hit before the projectile can hit again. Defaults to 0.

    projpriority = proj_priority (int)        Specifies the projectile priority. If the projectile collides with another projectile of equal priority, they will cancel. If it collides with another of lower priority, it will cancel the lower- priority projectile, and the higher-priority one will have its priority decreased by 1. Defaults to 1.

    projsprpriority = priority (int)        Specifies the sprite priority of the projectile. Higher-priority sprites are drawn on top of lower-priority sprites. Defaults to 3.

    projedgebound = value (int)        Specifies the distance off the edge of the screen before the projectile is automatically removed. Units are in pixels. Defaults to 40 in 240p, 80 in 480p, 160 in 720p.

    projstagebound = value (int)        Specifies the greatest distance the projectile can travel off the edge of the stage before being it is automatically removed. Defaults to 40 in 240p, 80 in 480p, 160 in 720p.

    projheightbound = lowbound, highbound (int, int)        Specifies the least and greatest y values the projectile is allowed to reach. If the projectile leaves these boundaries, it is automatically removed. Note: since y values decrease with increasing height on the screen, lowbound actually specifies the greatest height the projectile can attain. lowbound defaults to -240 in 240p, -480 in 480p, -960 in 720p. highbound defaults to 1 in 240p, 2 in 480p, 4 in 720p.

    offset = off_x, off_y (int, int)        Specifies the x and y offsets at which the projectile should be created. Both parameters default to 0 if omitted. Projectiles are always created facing the same direction as the player. off_x is in relation to the direction the projectile is facing. The exact behavior of the offset parameters is dependent on the postype.

    postype = postype_string (string)        postype_string specifies the postype -- how to interpret the pos parameters. In all cases, a positive y offset means a downward displacement. In all cases, off_y is relative to the position of the player. Defaults to P1.

        Valid values for postype_string are the following:

        p1            Interprets offset relative to p1's axis. A positive off_x is toward the front of p1.
        p2            Interprets offset relative to p2's axis. A positive off_x is toward the front of p1. If p2 does not exist, the position is calculated with respect to p1 and a warning is logged.
        front            Interprets off_x relative to the edge of the screen that p1 is facing toward. A positive off_x is toward the front of p1.
        back            Interprets off_x relative to the edge of the screen that p1 is facing away from. A positive off_x is toward the front of p1.
        left            Interprets off_x relative to the left edge of the screen. A positive off_x is toward the front of p1.
        right            Interprets off_x relative to the right edge of the screen. A positive off_x is toward the front of p1.

    projshadow = shad_r, shad_g, shad_b (int, int, int)        Specifies the R, G, and B components of the projectile's shadow. These components should be integers between 0 and 255, inclusive. If shad_r evaluates to -1, then the stage's shadow color will be used. The higher a component value, the less of that color is displayed in the shadow. So a perfectly black shadow is 255,255,255. Defaults to 0,0,0 (no shadow).
    supermovetime = move_time (int)        Specifies the number of ticks that the projectile will be unfrozen during a SuperPause. Defaults to 0.
    pausemovetime = move_time (int)        Specifies the number of ticks that the projectile will be unfrozen during a Pause. Defaults to 0.
    afterimage.time = aftimg_time (int)        See below.
    afterimage.length        See below.
    afterimage....        If included, these parameters add afterimage effects to the projectile. The parameters are the same as in the AfterImage controller, except these are all prepended with "afterimage."

Notes:
    All projectiles created by helpers immediately become owned by the root.

    The behavior of a projectile's HitDef is undefined when executed from a [Statedef -2] block while the player has another player's state and animation data.

Example:
Code:
[State 0, Projectile]
type = Projectile
trigger1 = time = 5
ProjID = 718
projanim = 4187
projhitanim = 4188
projremanim = 4186
projcancelanim = 86
projscale = 1,1
projremove = 1
projremovetime = -1
velocity = 0,0
remvelocity = 0,0
accel = 0,0
velmul = 1
projhits = 1
;projmiss
projpriority = 1
projsprpriority = 3
projedgebound = 40
projstagebound = 40
projheightbound = -240
offset = 0,0
postype = p1         ;p2,front,back,left,right
projshadow = 0,0,0
supermovetime = 0
pausemovetime = 0
;supermove = 0
;pausemove = 0
;(afterimage winmugen only)
;afterimage.time =
;afterimage.length =
;afterimage.palcolor =
;afterimage.palinvertall =
;afterimage.palbright = 0,0,0
;afterimage.palcontrast = 0,0,0
;afterimage.palpostbright =0,0,0
;afterimage.paladd =  0,0,0
;afterimage.palmul = 0,0,0
;afterimage.timegap =
;afterimage.framegap =
;afterimage.trans = ;none,add,add1,addalpha,sub
;ignorehitpause =
;persistent =

Related Triggers:
NumProj (Triggers)
NumProjID (Triggers)
ProjCancelTime (Triggers)
ProjContact(*,***) (Triggers)
ProjContactTime (Triggers)
ProjGuarded(*,***) (Triggers)
ProjGuardedTime (Triggers)
ProjHit(*,***) (Triggers)
ProjHitTime (Triggers)

1.1b Exclusive

Optional Parameters:
ownpal = ownpal_flag (boolean)
If ownpal_flag is 0, the projectile will be affected by subsequent execution of its owner's PalFX and RemapPal controllers. This is the default.

If ownpal_flag is 1, the projectile will not be affected by its owner's PalFX and RemapPal controllers.

remappal = dst_pal_grp, dst_pal_item (int, int)
Forces a palette remap of the projectile's indexed-color sprites to the specified palette. This parameter is used only if ownpal_flag is non-zero. If dst_pal_grp is -1, this parameter will be ignored. Defaults to -1, 0.
vVv Ryuko718 Updated 10/31/22 vVv
Last Edit: August 18, 2016, 10:04:41 pm by Just No Point
Re: Projectile (SCTRL)
#2  October 14, 2015, 01:15:58 pm
  • *****
  • Hug Pikachus!
    • USA
One question that I would like to ask is what are the advantages and disadvantages of using this SCTRL over using an appropriate helper-based coding for creating projectile attacks? I ask this since I know people who prefer one method over the other.
Hug the Pikachus!

Hug A Pikachu Today!
Re: Projectile (SCTRL)
#3  October 14, 2015, 04:18:28 pm
  • *****
  • Shame on you!
    • USA
I believe the most obvious one is Projectiles cant be turned into clones. Or it's extremely hard to do. I dont believe I've ever seen it happen.
Helpers can be turned into clones if they dont have the proper set up by ReversalDef and I think a couple more ways.
I think Projectiles will kill themselves a lot easier once they hit the edge of the screen, and the user has to define the ways to kill the helper.
Helpers take a lot more set up, but can do far more.
Having everything in one list is convenient and simple.
vVv Ryuko718 Updated 10/31/22 vVv
Re: Projectile (SCTRL)
#4  October 14, 2015, 11:44:59 pm
  • ******
  • Hedgehog Whisperer
  • Red Bull addict
    • Spain
    • xgargoyle.mgbr.net
Projectiles are automatically removed when they reach yhe edge of screen. If the offset parameter is set other than 0,0 it could happen that the projectile will never appear if it's launched on the edge of screen.
XGargoyle: Battle posing since 1979
http://xgargoyle.mgbr.net
http://www.pandorabots.com/pandora/talk?botid=e71c0d43fe35093a  <-- Please click that link
http://paypal.me/XGargoyle  <-- Donations welcome!
Re: Projectile (SCTRL) 1.0 + 1.1b
#5  October 28, 2015, 03:14:02 pm
  • ******
    • www.justnopoint.com/
Added 1.1b documentation
Re: Projectile (SCTRL) 1.0 + 1.1b
#6  August 18, 2016, 10:06:25 pm
  • ******
    • www.justnopoint.com/

2OS

Re: Projectile (SCTRL) 1.0 + 1.1b
#7  October 29, 2016, 05:21:01 am
  • ****
  • 608 Wannabe
  • Ich schicke dich zur HOELLE!! STIRB DU FEIGLING!!
    • Egypt
somewhat notorious note: unlike hitdef, projectile with p2stateno will hit a character with hitoverride.

highly obscure note: projectile is playermax, not systemmax like explod and helper.


abnormal usage of projectile due to the nature of only being owned by player roots include

-rootvarset
-rootvaradd
-rootchangestate (this is how Omega Tom Hanks and the character F1 is killed)
Last Edit: October 29, 2016, 05:24:59 am by 2OS
Re: Projectile (SCTRL) 1.0 + 1.1b
#8  April 16, 2017, 02:33:49 pm
  • **
    • France
Don't forget to use hitflag = P from the hitdef if you want the projectile to be able to hit other projectile

See hitdef for more details:
http://mugenguild.com/forum/topics/hitdef-sctrls-169450.0.html

I've just been trying some stuff with projectiles, and I'd like to add some more info about this point. Some elements may seem obvious, but you never know :P

1 - In order to have a projectile being able to be hit (or collide), it's anim's must have a Clsn1 (hitbox) INSIDE a Clsn2 (hurtbox)
2 - For a projectile to collide with another projectile, you don't need to have "hitflag = P"  if #1 is valid .
3 - With #1 being valid, the projectile will be hit by any other projectile  -> "projpriority" comes in with "projhits" calculations
4 - Any hitdef which includes  "hitflag = P" , not necessarily a projectile , will collide with the projectile and reduce his hit numbers by 1 ("projhits" parameter), whatever "ProjPriority" value was.

I hope it helps  :)
- samurais, swords & stuff ? → Another Blade
Last Edit: April 16, 2017, 04:56:12 pm by mr_bourrepalestick
Re: Projectile (SCTRL) 1.0 + 1.1b
#9  April 16, 2017, 07:39:40 pm
  • **
    • France
After some more experimentations with Projectile sctrl, I'd like to add a focus on how "ProjPriority" and "ProjHits" are calculated.

Before we get into it, make sure your projectile has a Clsn1 (hitbox) INSIDE its CLSN2 (hurtbox).
Spoiler: collision boxes for projectile animation (click to see content)


Important aspects to keep in mind :
  • "ProjPriority" value never gets below (1)
  • When its "ProjHits" value reaches (0), the projectile is removed


All the scenarios lead to 3 main cases

------------------------------------------------------------------------------------------------------------------------

1st case : same ProjPriority & ProjHits

Char 1vsChar 2
ProjPriority1vs1
ProjHits1vs1

The result is that both projectile destroy each other (ProjHits reaches 0) ->no harm for both Char1 and Char2 :P

------------------------------------------------------------------------------------------------------------------------

2nd case : same ProjPriority, different ProjHits

Char 1vsChar 2
ProjPriority1vs1
ProjHitsNvs1

The results :
  • Char2  projectile is destroyed (Char2 projHits = 1-1 = 0)
  • Char1 projectile has it's ProjHits reduced by (1) --> (N-1) hits still available, with a ProjPriority value of (1)

------------------------------------------------------------------------------------------------------------------------

3rd case : different ProjPriority, same ProjHits

Char 1vsChar 2
ProjPriorityMvs1
ProjHits1vs1

The results :
  • Char2  projectile is destroyed (Char2 projHits = 1-1 = 0 )
  • Char1 projectile has it's ProjPriority reduced by (1) --> 1 hit still available, with a ProjPriority value of (M-1)


------------------------------------------------------------------------------------------------------------------------
Some examples with intermediate calculations, with different ProjPriority & ProjHits values


Spoiler: Example A (click to see content)

Spoiler: Example B (click to see content)

Spoiler: Example C (click to see content)

I hope you like the examples storytelling  ;)
- samurais, swords & stuff ? → Another Blade
Re: Projectile (SCTRL) 1.0 + 1.1b
#10  April 20, 2022, 05:35:52 pm
  • ***
The Projectile controller takes all the parameters of the HitDef controller
Based on my tests on mugen 1.0 and 1.1 Projectile sctrl does not support ChainID and NochainID parameters at all.