Prevent an enemy from picking up a wepon using script...

PS_VITA

Active member
Hey guys I normally use this piece of code to change the hostile settings for an enemy in the level.txt

example:
Code:
spawn	badguy
@script void main() {
 changeentityproperty(getlocalvar("self"), "hostile", "TYPE_ENEMY") ;
} @end_script
health 100
map 4
coords  533 490 501
at      3040

But I'm looking for a way to run a script in a similar matter that prevents enemies from picking up weapons,
is it possible with script like my example above?
 
you could have a seperate weapon model that has a modified weapons list and no animations they will copy from the main character.

another note try not to use @script commands instead make a animation script in most cases you will be using the same scripts over and over but with slightly modified variables animation scripts are great for this.

here is a script I like to use to change properties it would need to be tweaked for your script there.
Code:
void changeEP( char prop, int val, char obc )
{// msmalik681 change entity property
	if(obc)
	{
	CEP(self, prop, OBC(obc));
	} else
	{
	CEP(self, prop, val);
	}
}
 
Ah you don't need a script for that - just set a high Stealth value like this:
stealth 300

Read in the manual about stealth
stealth {stealth} {perception}

This command sets stealth ability to entity
{stealth} defines how 'invisible' the entity to hostile entities. Default value is 0
{perception} defines how well entity can see stealth entities. Default value is 0
For instance, entity with {stealth} 2 is only 'visible' to hostile entities with {perception} 2 or higher
This command doesn't affect visual at all IOW entity is still visible to players

I use it on my Avengers game - its how enemies doesn't takes the A item anymore :)
 
O Ilusionista said:
Ah you don't need a script for that - just set a high Stealth value like this:
stealth 300

Read in the manual about stealth
stealth {stealth} {perception}

This command sets stealth ability to entity
{stealth} defines how 'invisible' the entity to hostile entities. Default value is 0
{perception} defines how well entity can see stealth entities. Default value is 0
For instance, entity with {stealth} 2 is only 'visible' to hostile entities with {perception} 2 or higher
This command doesn't affect visual at all IOW entity is still visible to players

I use it on my Avengers game - its how enemies doesn't takes the A item anymore :)

so put the stealth 300 value on the wepon that's being spawned in the level or the enemy?

I will test whenever I get a chance unless you reply first.
 
Tried this and the enemies still picked it up


Code:
Spawn ball
Stealth 300
coords  533 490 
at      3040

If the above is correct,  than could it be a setting on the enemies that's messing things up?
Thanks.
 
O Ilusionista said:
This is not how you use stealth. I remember I told you this before: you need to read the manual first if you want help. Even as a matter of respect to who try to help you.

My original question is specifically on how to find a way to have enemies or should I say just one enemy not pick up a weapon in just one stage that way I don't have to alter the original source material whether it be the enemy or the weapon because I still need that same enemy to act/behave the same across the entire rest of the game.

Hence I posted in the original topic an example of a script that allows me change one parameter for just one enemy during a level.

So I figured to follow your advice and give it a shot.

Since I thought your question was being answered within the context of my question when you mentioned that didn't I require a script and to use stealth.

So my brain immediately connected the dots and using my most educated guess I thought I could use "stealth" the same way I can use health for example

Spawn badguy
Health 100
Weapon knife
...... ect, ect

Sorry about the long reply,  I just wanted to let you know how I approached the whole thing within the context of my original post.


 
good morning I actually hope that there can be a script that can make the enemy more proactively run over and pick up weapons. I wonder if it can be realized?

For example, if the weapon is a horse,
The enemy will run over to ride a horse very actively :) :) :)
 
xyz555 said:
good morning I actually hope that there can be a script that can make the enemy more proactively run over and pick up weapons. I wonder if it can be realized?

For example, if the weapon is a horse,
The enemy will run over to ride a horse very actively :) :) :)

Haha! That would be awesome!

 
PS VITA said:
xyz555 said:
This effect is indeed very good, because I am making a game, but this effect is just missing. I am Very helpless

That .gif you are showing us, is your game?
Looks dope if so.

This game is in production, but still has not been able to achieve this effect
( For example,  the weapon is a horse, then
The enemy will run over and ride horses very actively )



 
xyz555 said:
PS VITA said:
xyz555 said:
This effect is indeed very good, because I am making a game, but this effect is just missing. I am Very helpless

That .gif you are showing us, is your game?
Looks dope if so.

This game is in production, but still has not been able to achieve this effect
( For example,  the weapon is a horse, then
The enemy will run over and ride horses very actively )


I recently succeeded using the following script...

Code:
      void main()
{
  SuperArmorOnAnim (openborconstant("ANI_FOLLOW81"), openborconstant("ANI_FREESPECIAL35"));
}

void SuperArmorOnAnim (int PAnim1, int PAnim2){
	void ent = getlocalvar("self");
	int animation = getentityproperty(ent, "animationid");

	if(animation == PAnim1 || animation == PAnim2){
           changeentityproperty(ent, "nopain", 1);
           changeentityproperty(ent, "nodrop", 1);
	} else {
           changeentityproperty(ent, "nopain", 0);
           changeentityproperty(ent, "nodrop", 0);
	}
}

Now you might be wondering why I'm showing this and it's  because there might be a script event that exists whenever an enemy is about to pick up a weapon or item get if you will.

So if that exists,  then you  could use a similar script to alter the running speed of the guy that's trying to get on the horse.

Normally you create a .txt file and name it something like in_itemget.c place it in the scripts folder and on your character who will be getting on the horse .txt file you call the script item get data/scripts/in_itemget.c

Anyhow this just me brainstorming, if you want to see the post I'm referring to look up "super armor" and check that thread.

But yeah, I'm not sure if what I'm suggesting exists.

Edit: Here's the thread
https://www.chronocrash.com/forum/index.php?topic=5190.msg74163#msg74163

Oh and what worked for me was takedamage script

"The takedamage event runs when you take a hit, but right before the engine processes hit reaction."

So perhaps there might be a similar script function to when an enemy is ordered to pick up an item or weapon.

 
PS VITA said:
xyz555 said:
PS VITA said:
xyz555 said:
This effect is indeed very good, because I am making a game, but this effect is just missing. I am Very helpless
Thank you very much, Mr., for your help. Your method is very good. I will investigate. thank you ;)

That .gif you are showing us, is your game?
Looks dope if so.

This game is in production, but still has not been able to achieve this effect
( For example,  the weapon is a horse, then
The enemy will run over and ride horses very actively )


I recently succeeded using the following script...

Code:
      void main()
{
  SuperArmorOnAnim (openborconstant("ANI_FOLLOW81"), openborconstant("ANI_FREESPECIAL35"));
}

void SuperArmorOnAnim (int PAnim1, int PAnim2){
	void ent = getlocalvar("self");
	int animation = getentityproperty(ent, "animationid");

	if(animation == PAnim1 || animation == PAnim2){
           changeentityproperty(ent, "nopain", 1);
           changeentityproperty(ent, "nodrop", 1);
	} else {
           changeentityproperty(ent, "nopain", 0);
           changeentityproperty(ent, "nodrop", 0);
	}
}

Now you might be wondering why I'm showing this and it's  because there might be a script event that exists whenever an enemy is about to pick up a weapon or item get if you will.

So if that exists,  then you  could use a similar script to alter the running speed of the guy that's trying to get on the horse.

Normally you create a .txt file and name it something like in_itemget.c place it in the scripts folder and on your character who will be getting on the horse .txt file you call the script item get data/scripts/in_itemget.c

Anyhow this just me brainstorming, if you want to see the post I'm referring to look up "super armor" and check that thread.

But yeah, I'm not sure if what I'm suggesting exists.

Edit: Here's the thread
https://www.chronocrash.com/forum/index.php?topic=5190.msg74163#msg74163

Oh and what worked for me was takedamage script

"The takedamage event runs when you take a hit, but right before the engine processes hit reaction."

So perhaps there might be a similar script function to when an enemy is ordered to pick up an item or weapon.
 
Back
Top Bottom