Okay, I'm looking for a script that detects when an enemy is in tall grass/shallow water, and puts the appropriate tile over the enemy so it actually looks like they are in tall grass/shallow water!
I think I've seen a script around here somewhere like this (using FFCs, I believe), but I can't for the life of me find it.
Any help would be most appreciated.
Tall Grass/shallow water and enemies
Started by
symbiote01
, Feb 03 2011 08:26 PM
3 replies to this topic
#1
Posted 03 February 2011 - 08:26 PM
#2
Posted 03 February 2011 - 08:51 PM
Untested but I have this:
One thing that might not work perfectly well is the position where the splash is drawn. It will work fine on 1 tile enemies and splash combo but it will have an offset if it's applied to bigger enemies...
This script will be applied in the whole quest.
CODE
import "std.zh"
//Set it to your water splash combo id
const WATERSPLASH_COMBO = 0;
//Set it to your water splash cset
const WATERSPLASH_CSET = 0;
global script activeScript
{
void run()
{
while(true)
{
for(int i = 1; i <= Screen->NumNPCs(); i++)
{
npc enemy = Screen->LoadNPC(i);
if(IsWater(ComboAt(CenterX(enemy),CenterY(enemy)))
Screen->FastCombo(1,enemy->X,enemy->Y,WATERSPLASH_COMBO,WATERSPLASH_CSET,128);
}
Waitframe();
}
}
}
//Set it to your water splash combo id
const WATERSPLASH_COMBO = 0;
//Set it to your water splash cset
const WATERSPLASH_CSET = 0;
global script activeScript
{
void run()
{
while(true)
{
for(int i = 1; i <= Screen->NumNPCs(); i++)
{
npc enemy = Screen->LoadNPC(i);
if(IsWater(ComboAt(CenterX(enemy),CenterY(enemy)))
Screen->FastCombo(1,enemy->X,enemy->Y,WATERSPLASH_COMBO,WATERSPLASH_CSET,128);
}
Waitframe();
}
}
}
One thing that might not work perfectly well is the position where the splash is drawn. It will work fine on 1 tile enemies and splash combo but it will have an offset if it's applied to bigger enemies...
This script will be applied in the whole quest.
#3
Posted 03 February 2011 - 10:16 PM
IsWater() only detects deep water. You'd want Screen->ComboT[ComboAt(CenterX(enemy), CenterY(enemy))]==CT_SHALLOWWATER.
#4
Posted 05 February 2011 - 03:24 PM
Awesome. The FastCombos should be on an upper layer, so it appears over the enemies, but that's an easy fix. I used this as a template to make it work for tall grass, too- it works (reasonably) well, meaning it USUALLY shows up.
I also added '&& enemy->Z == 0' to the if statement, so jumping enemies like Tektites don't show it unless they are one the ground. Next, I'll refine it so certain enemies use a different set of graphics, or don't trigger the effect- like DigKids; I always thought they they flew, but realize now that wouldn't work for collision detection, etc.
Anyway, thank you for your help!
I also added '&& enemy->Z == 0' to the if statement, so jumping enemies like Tektites don't show it unless they are one the ground. Next, I'll refine it so certain enemies use a different set of graphics, or don't trigger the effect- like DigKids; I always thought they they flew, but realize now that wouldn't work for collision detection, etc.
Anyway, thank you for your help!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users