[SOLVED] Script_ entity grabbable in specific animations only

Glitch

Member
Hi guys, what is the flag for entity being able to be grabbed?
I want to switch off the ''cantgrab 1'' header only in a certain pain animation, because entity has ''cantgrab 1'' in header all other pain animations will not cause entity to be grabbable.

I require it to work as follows:
Only when player attacks with ''attack  7'' will enemy then be grabbable in ''pain 7''.

An in file script in ''pain 7'' will do it, but what should the script line be?

Something like this perhaps?:
@cmd changeentityproperty getlocalvar("self") "aiflag" "cantgrab" 0

Tried that line but it does not work, even tried ''nograb'' instead, still does not work, any assistance would be greatly appreciated
 
I managed to solve it with this in file script:
in entity pain7 animation- grabbable on
@cmd changeentityproperty getlocalvar("self") "nograb" 0

in entity idle animation- grabbable off
@cmd changeentityproperty getlocalvar("self") "nograb" 1

With this the entity can only be grabbed when in a specific animation of your choosing. Entity will not be grabbed automatically whenever you are near it  or when it is in pain (unless you want it to), it will now only be grabbed upon your choosing. Useful for a grab button scenario or other grab needs.

In my mod the player has a interact/use button that  interacts with environment (switches, obstacles etc.). If interact/use button is pressed  while walking or moving towards any entity it plays a lunge forward and force grab animation that will grab entity.

I will post a video soon with this and other stuff I am trying to implement in my mod :)

 
Be careful with this sort of logic - it's not entirely stable. The entity does not necessarily go from Pain7 or any other animation directly to idle, meaning your flag will not always get reset.

I would suggest putting this in the model's onthinkscript instead. Here's an example of the code.

DC
 
O Ilusionista said:
Nice thanks for the tip

It is a pleasure to share what little I learn :) @O'Illusionista. Because you guys are making the Openbor community grow with a friendly and helpful environment, many modders are bringing awesome ideas and games forward ;D


NB: I forgot to say that in order for the entity to be grabbable in specific animation only, there should be no ''cantgrab'' or ''paingrab'' headers in entity's header data.
 
Damon Caskey said:
Be careful with this sort of logic - it's not entirely stable. The entity does not necessarily go from Pain7 or any other animation directly to idle, meaning your flag will not always get reset.

I would suggest putting this in the model's onthinkscript instead. Here's an example of the code.

DC

Yes,  I was going to turn off the grabbability in all the entity's animations, but this is much easier. Thank you @DC, I will use that script and make all the enemies have the relevant ''pain 7''

 
Bloodbane said:
Hmmm... I never play with nograb property but I have played with antigrab property. This could be a good alternative

Bloodbane , I was going through all the flags in the Openbor manual and found it, it was just what I needed. It works well for custom button grabbing and other move specific grab scenarios.

Using the in file scripts and other examples that you and others showed me before has now opened up a world of possibilities in regards to my understanding of scripts. I can now try using scripts to implement the many ideas I had for so long :D
 
O Ilusionista said:
Scripts do open a plethora of possibilities.

Just remember of Uncle Ben quote, from Spider-Man: with great power, comes great responsibility.

Lol ;D understood perfectly, that is a quote I always use @O'I lusionista , that and Xavier's ''It's a mutation, a very groovy mutation''  8)
 
Back
Top Bottom