AI Behavior for don't Hurt player1_object

JRS

New member
this is probably easy but can someone put up the AI Behavior script for the following:

AI Behavior for don't hurt player1_object

i would like to have a set animation where the monster cant hurt the player

ie. when zombies or skeletons are breaking through the soil/coffins even before they break out the player will die if he walks past.
 

Logana

Well-known member
Congratulations you have created an seemingly simple thing that for this engine is impossible, my best suggestion is an object that is set to like player weapon or something that wouldn’t hurt the player and have that object spawn the monster, or the other way around for death animations
 

JRS

New member
i'm not understanding, i haven't created anything?... i thought this was the requests section?
 

Logana

Well-known member
Yep, I’m just saying their is no code that can do that, the object sytem only has one way to tell it what collision type to use like if you check player then it checks all objects to see if they over lap with a objects with monster checked, but the issue with this is that their is no way to “un check it” and just leaving an object with no checks makes it act the same as a monster with fricked up collision, so basically the only way to get around this while still having death animations is to have it so when the monster dies it spawns a secondary object containing the death animation with it being check as like and pick up/ power up or something and have the monstwr destroy itself right after spawning it so that it creates the allusion of a death animation while making sure the player can’t get hurt if they walk into the death animation

This is what I mean in the post above, I’m saying it’s possible but hard and the way you are saying you wanna do it is impossible with this engine
 

dale_coop

Moderator
Staff member
Do you mean you want that during an action step fo your monster, that monster has no collision with the player? (means the player can't even touch/kill the monster and the player will not be hurt if it goes through it)?

It should not be too difficult, you could use an action step flag for that. Make a flag for "no object collision", then modify the monster hurt script and the player hurt script to
use that flag to skip the code.


Here's what you could try (for a NO OBJECT COLLISION action step):

1) Add a "No object collision" flag:
Open your "Project Settings > Project Labels", then in Monster Action Step Flags, rename the "flag 1" to "No Object Collision":

2021-04-17 11_08_58-Project Settings.png

2) Now, the monster needs to follow that flag.
In "Project Settings > Script Settings", under "Common", modify the script assigned to the "Handle Monster Hurt":
And just after the line :
Code:
    +dontSkipHurtingThisObject:
Add this piece of code (to skip the script if the "No object collision" flag is set):
Code:
    ;; if the monster's action step is set to "no collision", we skip the script
    LDA Object_vulnerability,x
    AND #%00000010    ;; "no object collision" ?
    BEQ +next
        ;;; if the bit set, skip the collision code:
        JMP +doSkipHurtingThisObject
    +next:

3) Now the same for the player hurt, in "Project Settings > Script Settings", under "Common", modify the script assigned to the "Handle Player Hurt":
And just after the line :
Code:
    +canHurtPlayer
Add this piece of code (to skip the script if the "No object collision" flag is set for the monster):
Code:
    ;; if the monster's action step is set to "no collision", we skip the script
    LDX otherObject
    LDA Object_vulnerability,x
    AND #%00000010    ;; "no player collision" ?
    BEQ +next
        LDX temp
        ;;; if set, skip the collision code:
        JMP +skipHurt
    +next:
    LDX temp

4) Finally, modify your monster object details, on the Action Step you want .... set the flag:

2021-04-17 11_14_59-Monster Animation Info.png


I think it should work
...
 

JRS

New member
Do you mean you want that during an action step fo your monster, that monster has no collision with the player? (means the player can't even touch/kill the monster and the player will not be hurt if it goes through it)?

It should not be too difficult, you could use an action step flag for that. Make a flag for "no object collision", then modify the monster hurt script and the player hurt script to
use that flag to skip the code.


Here's what you could try (for a NO OBJECT COLLISION action step):

1) Add a "No object collision" flag:
Open your "Project Settings > Project Labels", then in Monster Action Step Flags, rename the "flag 1" to "No Object Collision":

View attachment 4810

2) Now, the monster needs to follow that flag.
In "Project Settings > Script Settings", under "Common", modify the script assigned to the "Handle Monster Hurt":
And just after the line :
Code:
    +dontSkipHurtingThisObject:
Add this piece of code (to skip the script if the "No object collision" flag is set):
Code:
    ;; if the monster's action step is set to "no collision", we skip the script
    LDA Object_vulnerability,x
    AND #%00000010    ;; "no object collision" ?
    BEQ +next
        ;;; if the bit set, skip the collision code:
        JMP +doSkipHurtingThisObject
    +next:

3) Now the same for the player hurt, in "Project Settings > Script Settings", under "Common", modify the script assigned to the "Handle Player Hurt":
And just after the line :
Code:
    +canHurtPlayer
Add this piece of code (to skip the script if the "No object collision" flag is set for the monster):
Code:
    ;; if the monster's action step is set to "no collision", we skip the script
    LDX otherObject
    LDA Object_vulnerability,x
    AND #%00000010    ;; "no player collision" ?
    BEQ +next
        LDX temp
        ;;; if set, skip the collision code:
        JMP +skipHurt
    +next:
    LDX temp

4) Finally, modify your monster object details, on the Action Step you want .... set the flag:

View attachment 4811


I think it should work
...

yes, that was what i was after
thank you.
 

Jonny

Well-known member
I did a more primative version a while back but before I learnt about 'otherObject'. I'm going to link to this thread from that because Dale's is a much improved way.

 

JRS

New member
tested earlier on and works fantastic now. Much appreciated. Really am starting to learn things, now on 4.5.9
 
Top Bottom