Jump to content

Photo

Enemy "eats" Arrows/Bombs

NPC Script Thieve Counter Arrows/Bombs

  • Please log in to reply
8 replies to this topic

#1 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 28 December 2019 - 04:18 PM

I don't wanna flood this forum with new Topics (pretty sure I'm already doing it - sorry)
...but I have so many new Ideas every Day.

I made two thieves that hide near Castle Hyrule.
One should steal (eat) Rupees, what works very well.
The other one should steal Items, like arrows and/or Bombs.
But if I change the Item settings of arrows and bombs to "can be eaten by enemies", the touch effect removes the items from inventory (instead of decreasing the counter).
That's not a big suprise of course, but I don't know another way to handle it.

So, I guess I need a script.

 

Perhaps it could change the counter, so you can use "eat Ruppes" as touch effect, but another counter is used.

 

Thanks

 

Bagu


Edited by Bagu, 28 December 2019 - 04:21 PM.


#2 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 30 December 2019 - 12:04 PM

Hmmm.... try this.
 
 
npc script stealitems
{
	void run(int min, int max, int counterA, int counterB, int counterC, int counterD)
	{
		min = ( min > -1 ) ? min : 0;
		max = ( max > 0 ) ? max : 1;
		int num = Rand(min,max);
		int counters[4] = { counterA, counterB, counterC, counterD };
		int sel = counters[Rand(4)];
		while(1)
		{
			if ( sel ) //don't affect counter 0 (life)
			{
				if ( Collision(this) && (Hero->HitDir > -1) )
				{
					//Don't roll over.
					if ( (Game->Counter[sel] - num) >= 0 ) Game->Counter[sel] -= num;
					else 
					{
						Game->Counter[sel] = ( num > 0 ) ? 0 : Game->Counter[sel];
					}
					while(Hero->HitDir > -1) { Waitframe(); } //Don't steal again unless Link is hit again.
				}
			}
			num = Rand(min,max);
			sel = counters[Rand(4)];
			Waitframe();
		}
	}
}
 
D0: The minimum number to take. Defaults to 0.
D1: The maximum number to take. Defaults to 1.
D2 to D5: Four counters to affect. Randomly selected between them. You may use multiple instances of the same counter, or 0 for a 'nothing' chance.
  • Bagu likes this

#3 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 30 December 2019 - 12:06 PM

I'll try it right now  :love:  :love:  :love:



#4 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 30 December 2019 - 12:15 PM

I'll try it right now  :love:  :love:  :love:


I made a few sanity patches. Be sure to use the latest version that I posted.

#5 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 30 December 2019 - 12:18 PM

Works great...
My thieves are pure fun now (no beatable, all defenses = stun/ignore, E.A 4Frame 4 Direct. tracking, waling style rope, one steals your rupees the other one takes you bombs and arrows.

:thumbsup: 



#6 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 30 December 2019 - 12:30 PM

Works great...
My thieves are pure fun now (no beatable, all defenses = stun/ignore, E.A 4Frame 4 Direct. tracking, waling style rope, one steals your rupees the other one takes you bombs and arrows.

:thumbsup:


I neglected to give it a sound effect:

npc script stealitems
{
	void run(int min, int max, int counterA, int counterB, int counterC, int counterD, int sfx)
	{
		min = ( min > -1 ) ? min : 0;
		max = ( max > 0 ) ? max : 1;
		int num = Rand(min,max);
		int counters[4] = { counterA, counterB, counterC, counterD };
		int sel = counters[Rand(4)];
		while(1)
		{
			if ( sel ) //don't affect counter 0 (life)
			{
				if ( Collision(this) && (Hero->HitDir > -1) )
				{
					Audio->PlaySound(sfx);
					//Don't roll over.
					if ( (Game->Counter[sel] - num) >= 0 ) Game->Counter[sel] -= num;
					else 
					{
						Game->Counter[sel] = ( num > 0 ) ? 0 : Game->Counter[sel];
					}
					while(Hero->HitDir > -1) { Waitframe(); } //Don't steal again unless Link is hit again.
				}
			}
			num = Rand(min,max);
			sel = counters[Rand(4)];
			Waitframe();
		}
	}
}
D6: The sound to play, when stealing.
  • Bagu likes this

#7 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 30 December 2019 - 02:15 PM

That's great...
Gonna check it out.
...one sad thing. I have to do it in Alpha 39.

The current version of 47 is not accepting my whole script.

"ItemBundle" didn't work and wolie had some problems...
So I tried to compile again (the same script that I just added your former version of the "StealItem")

In 39 Compiling is succesful in 47 it fails.

How can I load up a whole script, so you can  look for the error (if you would do it for me)?
Cause when I try, the post gets too long



#8 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 30 December 2019 - 07:20 PM

There's an issue if you merge the recent alphas into an older alpha folder. Be sure to delete `std.zh` from ZC's root folder. In the new alphas, it is NOT there, but elsewhere; but if you put one there, when you compile, it tries to use the OLD std.zh instead of the NEW one.


  • ShadowTiger likes this

#9 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 30 December 2019 - 08:48 PM

I guess that's been the prblem.
Now compiling was succesful (no matter. ...I'm still a stupid dumbass in scripting. hope that someone will help me to organize my current script correctly)





Also tagged with one or more of these keywords: NPC Script, Thieve Counter Arrows/Bombs

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users