YesNoOk
avatar

AI Detect Enemy's (Helper) Projectile System (Read 3583 times)

Started by ink, May 17, 2017, 08:30:27 pm
Share this topic:

ink

AI Detect Enemy's (Helper) Projectile System
New #1  May 17, 2017, 08:30:27 pm
  • ****
  • inktrebuchet
    • USA
    • s236.photobucket.com/albums/ff271/inktrebuchet/?
NOTE: This code replaces the one that I have found people are currently using: trigger? = (enemy, numhelper) . That code may seem to works for some characters but it actually detects any helper being used, not just projectiles! So an enemy with a helper on screen at all times, such as Megaman and his dog Rush will always trigger that code or any enemy that uses a helper for an effect will also trigger that code.

This is a helper that stays bound to the character to detect if an enemy spawns a (Helper) Projectile. That PlayerId can then be used to find out a lot more about the projectile. Including velocity, distance, position on screen etc.

This system does use one root variable (var(48)) and IntPersistIndex in the constants part of the cns has to be set different than most characters defaults. (see notes in code.)

There are plenty of notes included. If anyone thinks of a way to improve this let me know!
 
This goes in state -2
Code:
[state -2, AI Detect Projectile System]
type = helper
trigger1 = ailevel && !numhelper(33333333)
name = "AI Detect Projectile System"
ID = 33333333
stateno = 33333333
postype = p1
ownpal = 1
keyctrl = 0
size.xscale = 1.0
size.yscale = 1.0
supermovetime = 2147483647
pausemovetime = 2147483647
ignorehitpause = 1


This goes in CNS

Spoiler: New Condensed Version (click to see content)

Spoiler: Old Long Version (click to see content)

Examples of use:
Code:
trigger1 = PlayerIDExist(helper(33333333),var(3))
trigger1 = PlayerID(helper(33333333),var(3)),p2bodydist X ; Distance between character and enemy's projectile






Last Edit: October 30, 2017, 06:32:53 pm by ink

ink

Re: AI Detect Enemy's (Helper) Projectile System
#2  May 23, 2017, 08:17:15 pm
  • ****
  • inktrebuchet
    • USA
    • s236.photobucket.com/albums/ff271/inktrebuchet/?
I experimented with AI being able to slide safely under an enemy's projectile helper today and realized a limitation of this system!

I made a ChangeState something like this:
Code:
;slide under enemy's projectile. 
[State -1, AI slide]
type = ChangeState
value = 1100
triggerall = ailevel 
triggerall = statetype = S || statetype = C
trigger1 = PlayerIdExist(helper(33333333),var(3)) ;projectile exists
trigger1 = (PlayerId(helper(33333333),var(3)), p2bodydist x) / (PlayerId(helper(33333333),var(3)), vel x) > 9 ; 9 = lowest point of moves hitbox .
trigger1 = (PlayerId(helper(33333333),var(3)), p2bodydist x) / (PlayerId(helper(33333333),var(3)), vel x) < 35 ; 35 = when hitboxs lowest point changes to a higher point.
trigger1 = PlayerId(helper(33333333),var(3)), pos y > -69 ; enemy's projectile is higher than the height of character during slide.<<<<<<<<<<<<<<<<<<< NOT accurate because projectiles axis are usually in the middle not the bottom...

Because projectile helper's axis are not at the bottom of the helper the last trigger of this code is not correct. As far as I can tell there is no way to know the size (height) of an enemy's projectile making this AI logic impossible...


Last Edit: May 24, 2017, 07:56:17 pm by ink
Re: AI Detect Enemy's (Helper) Projectile System
#3  May 31, 2017, 08:13:15 pm
  • avatar
  • ****
  • Sr. Black Person
  • Mess with the chuchu you get the pewpew
    • USA
    • network.mugenguild.com/kamekaze/
Yeah the main issue is clsns. I never bothered with in depth projectile detection because outside of full games there's too many variables involved. Solid idea though.
Want to feel useful for a useless show? click here
118/150 Chars, I'm not dead yet....the true surprise is in my thread.
Hahahah fuck you photobucket.

ink

Re: AI Detect Enemy's (Helper) Projectile System
New #4  June 01, 2017, 09:41:39 pm
  • ****
  • inktrebuchet
    • USA
    • s236.photobucket.com/albums/ff271/inktrebuchet/?
Yeah, pretty much. I was building a projectile reflector system based off this code, now that all of that helpers data is easily accessed but then realized how broken it would actually be. The only realistic application this one has outside of a full game is knowing when a projectile is coming at the AI and what its speed and distance from the AI is.



Last Edit: June 15, 2017, 04:31:27 pm by ink

ink

Re: AI Detect Enemy's (Helper) Projectile System
#5  June 12, 2017, 04:23:24 pm
  • ****
  • inktrebuchet
    • USA
    • s236.photobucket.com/albums/ff271/inktrebuchet/?
Updated this today, fixed a small bug that would break everything for some characters when a intro was skipped.
Please let me know if you find anything weird or have questions.

     Posted: June 15, 2017, 04:32:46 pm
Updated again with a condensed version of the code.