Jump to content

Photo

Another request...


  • Please log in to reply
36 replies to this topic

#16 XMSB

XMSB

    Furry Friends Furever

  • Members
  • Real Name:Joseph Watson
  • Location:San Antonio, Texas

Posted 18 August 2010 - 08:01 PM

I tried removing the const part, but nothing happened. Plus, I already tried editing the number in the constant value. It didn't do anything either. Why don't we wait until Joe figures out what the problem is? There are two things he's taking a look at in regards to my script requests.

Edited by XMuppetSB, 18 August 2010 - 08:08 PM.


#17 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 18 August 2010 - 08:09 PM

The problem is that you're not using Keese as the enemy. You're using a Gleeok Head. Unless the head is a "Keese" enemy type. Try using this on an actual Keese and see if it helps.

#18 XMSB

XMSB

    Furry Friends Furever

  • Members
  • Real Name:Joseph Watson
  • Location:San Antonio, Texas

Posted 18 August 2010 - 08:11 PM

The Gleeok head is in the Keese class, but I set it to use the Bat Type movement. Besides, I'm thinking Misc 11 should have been used to define the shot type... or something...

Edited by XMuppetSB, 18 August 2010 - 08:14 PM.


#19 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 18 August 2010 - 08:18 PM

Correct. 11 is the weapon type. Misc. 12 is the delay in frames between each shot.


#20 XMSB

XMSB

    Furry Friends Furever

  • Members
  • Real Name:Joseph Watson
  • Location:San Antonio, Texas

Posted 18 August 2010 - 08:20 PM

I already tried setting Misc 11 to 129 (which is fireball in std.zh), but no matter what I set Misc 12 to, it's just not working.

#21 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 18 August 2010 - 08:40 PM

I don't see why it shouldn't work. I've looked through it a few times... I'll test it.

Mmm. Found the problem. In my allegro log, mounds of this:

Invalid value (12) passed to 'npc->Attributes'


One sec and I'll fix it for you icon_wink.gif

Alright so. What happened was... NPC->Attributes does in fact have 12 values. But it's read as NPC->Attributes[0] being attribute 1. So on and so forth.

I simply added a variable to edit in the top of the file.

CODE
import "std.zh"

int delayframes = 30;

global script Slot2
{
    void run()
    {
        while(true)
        {
            NPCs();
            Waitframe();
        }
    }
    void NPCs()
    {
        npc n;
        for(int i = Screen->NumNPCs(); i > 0; i--)
        {
            n = Screen->LoadNPC(i);
            
            if(n->Type == NPCT_KEESE)
                NPC_Keese(n);
        }
    }
}

//Might need to change this if it's interefering with other scripts
//Also make sure its not set to 1
const int NPCM_KEESESHOOTCLK    = 0;

void NPC_Keese(npc Keese)
{
    int ShootDelay = delayframes;
    if(ShootDelay <= 0)
        return;
    
    Keese->Misc[NPCM_KEESESHOOTCLK]++;
    if(Keese->Misc[NPCM_KEESESHOOTCLK] >= ShootDelay)
    {
        CreateEWeaponAt(Keese->Attributes[11], Keese->X, Keese->Y);
        Keese->Misc[NPCM_KEESESHOOTCLK] = 0;
    }
}


Misc value 12 is your eweapon type.

Although, the only thing this script does is shoot the weapon upwards. Not sure how to shoot it at Link, since it doesn't automatically do it. And the weapons by default deal no damage.

If we had something like Eweapon->Vx and Eweapon->Vy, I could make it work the way you want. Unfortunately, we don't. =(

Joe, if you want to look at this and make it shoot at Link, that would be great. I may just have to steal it for my quest icon_razz.gif

Also, a funny. Check it out. This is when I was debugging the script:

IPB Image

Edited by Master Maniac, 18 August 2010 - 09:04 PM.


#22 XMSB

XMSB

    Furry Friends Furever

  • Members
  • Real Name:Joseph Watson
  • Location:San Antonio, Texas

Posted 18 August 2010 - 09:37 PM

I also noticed that the fireball doesn't do any damage at all.

#23 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 18 August 2010 - 09:41 PM

I said that already icon_razz.gif

#24 XMSB

XMSB

    Furry Friends Furever

  • Members
  • Real Name:Joseph Watson
  • Location:San Antonio, Texas

Posted 18 August 2010 - 09:47 PM

Oh right. Either way, I didn't see that funny effect you saw... Does it only happen when enemies cast shadows? But yeah, I've been seeing both of those weapon issues myself.

Edited by XMuppetSB, 18 August 2010 - 09:48 PM.


#25 Joe123

Joe123

    Retired

  • Members

Posted 19 August 2010 - 04:40 AM

Oh! Well that was idiocy on my part, right! Glad to see I'm not just wasting my time with all the error tracing too. Nice catch.
What's happening in the picture exactly? Do you just have misc12 set to 0 or something?

OK, Weapon Damage in the first screen does the damage. I will handle shooting in the right direction soon(ish).

CODE
global script Active
{
    void run()
    {
        while(true)
        {
            NPCs();
            Waitframe();
        }
    }
    void NPCs()
    {
        npc n;
        for(int i = Screen->NumNPCs(); i > 0; i--)
        {
            n = Screen->LoadNPC(i);
            
            if(n->Type == NPCT_KEESE)
                NPC_Keese(n);
        }
    }
}

//Might need to change this if it's interfering with other scripts
const int NPCM_KEESESHOOTCLK    = 0;

void NPC_Keese(npc Keese)
{
    int ShootDelay = Keese->Attributes[11];
    int WeaponType = Keese->Attributes[10];
    if(ShootDelay <= 0 || WeaponType <= 0)
        return;
    
    Keese->Misc[NPCM_KEESESHOOTCLK]++;
    if(Keese->Misc[NPCM_KEESESHOOTCLK] >= ShootDelay)
    {
        eweapon e  = CreateEWeaponAt(WeaponType, Keese->X, Keese->Y);
        e->Damage = Keese->WeaponDamage;
        Keese->Misc[NPCM_KEESESHOOTCLK] = 0;
    }
}


#26 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 19 August 2010 - 05:26 AM

No, in the screenshot the delay wasn't working properly, and the enemy just loosed a stream of fireballs in one direction. If you leave it like that and say eweapon->Dir = Rand(7), it makes for a very fun enemy.

#27 Joe123

Joe123

    Retired

  • Members

Posted 19 August 2010 - 05:45 AM

Ahhh I get you =P
You're supposed to be able to get that effect by setting the Misc12 to 1 ;-)

CODE
global script Active
{
    void run()
    {
        while(true)
        {
            NPCs();
            Waitframe();
        }
    }
    void NPCs()
    {
        npc n;
        for(int i = Screen->NumNPCs(); i > 0; i--)
        {
            n = Screen->LoadNPC(i);
            
            if(n->Type == NPCT_KEESE)
                NPC_Keese(n);
        }
    }
}

//Might need to change this if it's interfering with other scripts
const int NPCM_KEESESHOOTCLK    = 0;

void NPC_Keese(npc Keese)
{
    int AimType    = Keese->Attributes[10];
    int ShootDelay = Keese->Attributes[11];
    if(ShootDelay <= 0 || Keese->Weapon <= 0)
        return;
    
    Keese->Misc[NPCM_KEESESHOOTCLK]++;
    if(Keese->Misc[NPCM_KEESESHOOTCLK] >= ShootDelay)
    {
        eweapon e  = CreateEWeaponAt(WeaponTypeToID(Keese->Weapon), Keese->X, Keese->Y);
        AimEWeapon(e, AimType);
        e->Damage = Keese->WeaponDamage;
        Keese->Misc[NPCM_KEESESHOOTCLK] = 0;
    }
}

const int AT_NONE            = 0;
const int AT_4DIR            = 1;
const int AT_8DIR            = 2;
const int AT_ANGULAR        = 3;
const int AT_RAND4DIR        = 4;
const int AT_RAND8DIR        = 5;
const int AT_RANDANGULAR    = 6;

void AimEWeapon(eweapon e, int aimtype)
{
    int angle = RadianAngle(e->X, e->Y, Link->X, Link->Y);
    if(aimtype == AT_4DIR)
    {
        e->Dir = RadianAngleDir4(angle);
    }
    else if(aimtype == AT_8DIR)
    {
        e->Dir = RadianAngleDir8(angle);
    }
    else if(aimtype == AT_ANGULAR)
    {
        e->Angular = true;
        e->Angle = angle;
    }
    else if(aimtype == AT_RAND4DIR)
    {
        e->Dir = AngleDir4(Rand(360));
    }
    else if(aimtype == AT_RAND8DIR)
    {
        e->Dir = AngleDir8(Rand(360));
    }
    else if(aimtype == AT_RANDANGULAR)
    {
        e->Angular = true;
        e->Angle = Randf(PI2);
    }
}

int WeaponTypeToID(int wpnt)
{
    if(wpnt == WPN_NONE)                return -1; //Can't create this
    else if(wpnt == WPN_ENEMYFLAME)     return EW_FIRE:
    else if(wpnt == WPN_ENEMYWIND)        return EW_WIND;
    else if(wpnt == WPN_ENEMYFIREBALL)    return EW_FIREBALL;
    else if(wpnt == WPN_ENEMYARROW)        return EW_ARROW;
    else if(wpnt == WPN_ENEMYBRANG)        return EW_BRANG;
    else if(wpnt == WPN_ENEMYSWORD)        return -1; //Eh? Should be a constant for this...
    else if(wpnt == WPN_ENEMYROCK)        return EW_ROCK;
    else if(wpnt == WPN_ENEMYMAGIC)        return EW_MAGIC;
    else if(wpnt == WPN_ENEMYBOMB)        return EW_BOMB;
    else if(wpnt == WPN_ENEMYSBOMB)        return EW_SBOMB;
    else if(wpnt == WPN_ENEMYLITBOMB)    return EW_BOMBBLAST;
    else if(wpnt == WPN_ENEMYLITSBOMB)    return EW_SBOMBBLAST;
    else if(wpnt == WPN_ENEMYFIRETRAIL)    return EW_FIRETRAIL;
    else if(wpnt == WPN_ENEMYFLAME2)    return EW_FIRE; //Is this right?
    else if(wpnt == WPN_ENEMYFIREBALL2)    return EW_FIREBALL2;
    return -1;
}

And now with aiming!
My intention is to include AimEWeapon and WeaponTypeToID in std.zh, so in the next build you'll have to delete those functions from your script file Pokegamer.

Now it uses the weapon droplist in the first pane for weapon type, weapon damage box for damage, Misc11 for AimType (see AT_ constants), and Misc12 for shoot speed.

#28 XMSB

XMSB

    Furry Friends Furever

  • Members
  • Real Name:Joseph Watson
  • Location:San Antonio, Texas

Posted 19 August 2010 - 07:36 AM

EDIT: Ah ha! On Line 36, you forgot to change WeaponType to WeaponID!
Yet, for some strange reason, it still only fires the weapon upward.

Edited by XMuppetSB, 19 August 2010 - 07:53 AM.


#29 Joe123

Joe123

    Retired

  • Members

Posted 19 August 2010 - 07:54 AM

Oh ok, fixed that. Did you try putting in some different aimtypes to Misc11?

#30 XMSB

XMSB

    Furry Friends Furever

  • Members
  • Real Name:Joseph Watson
  • Location:San Antonio, Texas

Posted 19 August 2010 - 07:55 AM

Uh... Yeah, but no matter which one I select, it still shoots the weapon only upward.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users