Jump to content

Photo

Shoot beam, no stab


  • Please log in to reply
14 replies to this topic

#1 Twilight Knight

Twilight Knight

    Tell all with glee, Argon's on PureZC

  • Members
  • Real Name:Sven
  • Location:Rotterdam, NL

Posted 26 October 2008 - 08:27 AM

What I want in my quest is that Link isn't able the stab/slash while a sword beam is shot. How can I make this with scripts? It isn't possible normally.

#2 Joe123

Joe123

    Retired

  • Members

Posted 26 October 2008 - 08:39 AM

So basically you press the button and shoot out a projectile?

Is there any reason for it to be a sword beam?

#3 Twilight Knight

Twilight Knight

    Tell all with glee, Argon's on PureZC

  • Members
  • Real Name:Sven
  • Location:Rotterdam, NL

Posted 26 October 2008 - 09:12 AM

No, techically, I just want the sword to only shoot projectiles, CastChaos told me this method, but it doesn't turn out how I won't.

So all in all, I need a weapon that only shoots projectiles, uses the A button and... that's it. I do want the player to not shoot projectiles constantly. Like 5 seconds(300 frames) between shooting.

#4 Joe123

Joe123

    Retired

  • Members

Posted 26 October 2008 - 09:29 AM

Does it need to trigger any flags?

#5 Twilight Knight

Twilight Knight

    Tell all with glee, Argon's on PureZC

  • Members
  • Real Name:Sven
  • Location:Rotterdam, NL

Posted 26 October 2008 - 09:38 AM

No, it doesn't. Just to hurt enemies.

So you'll make this? I would be very grateful. Of course you'll get credited.

#6 Joe123

Joe123

    Retired

  • Members

Posted 26 October 2008 - 09:44 AM

Yah, it's not a very complicated script.

CODE
item script Projectile{
    void run(int tile, int cset, int aframes, int aspeed, int damage, int speed){
        lweapon projectile = Screen->CreateLWeapon(LW_SCRIPT1);
        projectile->OriginalTile = tile;
        projectile->Tile = tile;
        projectile->CSet = cset;
        projectile->NumFrames = aframes;
        projectile->ASpeed = aspeed;
        projectile->Dir = Link->Dir;
        projectile->Damage = damage;
        projectile->Step = speed*100;
        int x; int y;
        if(Link->Dir>1) x = (((Link->Dir-2)*2)-1)*8;
        if(Link->Dir<2) y = ((Link->Dir*2)-1)*8;
        projectile->X = Link->X+x;
        projectile->Y = Link->Y+y;
        Link->Action = LA_ATTACKING;
    }
}


Just set to the action script for the item.
  • D0 : Tile for projectile to use
  • D1 : CSet
  • D2 : Number of frames of animation
  • D3 : Animation speed
  • D4 : Damage
  • D5 : Speed


#7 Twilight Knight

Twilight Knight

    Tell all with glee, Argon's on PureZC

  • Members
  • Real Name:Sven
  • Location:Rotterdam, NL

Posted 26 October 2008 - 09:46 AM

This seems a lot better. The speed in frames? Also, I don't see you made a break between shooting projectiles... Can you script that too? 5 seconds is enough.

#8 Joe123

Joe123

    Retired

  • Members

Posted 26 October 2008 - 09:48 AM

Oh, right ok.
I thought when you used an item script it had a built-in break already?

I can do that, but it'll mean using some global functions which would be a bit of a pain...


'frames' isn't a unit you can use for speed. Distance is in frames.
Speed is in 'Pixels per frame', and yes, the speed is in pixels per frame.

#9 Twilight Knight

Twilight Knight

    Tell all with glee, Argon's on PureZC

  • Members
  • Real Name:Sven
  • Location:Rotterdam, NL

Posted 26 October 2008 - 10:05 AM

It does? I will test it, I couldn't have seen cause I didn't test it yet, I just deciphered the script.

So pixels/frame it is, not just pixels. I will try out some things, then post here what I've found out.

#10 Joe123

Joe123

    Retired

  • Members

Posted 26 October 2008 - 10:06 AM

Okeydokey.
I think it should work ok.

#11 Twilight Knight

Twilight Knight

    Tell all with glee, Argon's on PureZC

  • Members
  • Real Name:Sven
  • Location:Rotterdam, NL

Posted 26 October 2008 - 10:24 AM

Ok, works completely fine except that I want to play a sound when it's fired. So I need to add another integer in the brackets after void run? Then I put: Game->PlaySound(SFX); in the script?
Also, I asked for the item to use the a button, but I decided I wanted to have that rule to make it able that you can select items for both A and B anyway.

#12 Joe123

Joe123

    Retired

  • Members

Posted 26 October 2008 - 10:26 AM

I had that line in it already, but I realised you can set an item's sound effect in the Action tab in the item editor so I took it out.

#13 Twilight Knight

Twilight Knight

    Tell all with glee, Argon's on PureZC

  • Members
  • Real Name:Sven
  • Location:Rotterdam, NL

Posted 26 October 2008 - 10:29 AM

Err, no it says <unused> for me where you normally set the SFX, that's why I asked.

Edit: I put it in myself now, should work.

Thanks for you help, I will put you on the credits list.

Edited by Twilight_Knight, 26 October 2008 - 10:33 AM.


#14 Joe123

Joe123

    Retired

  • Members

Posted 26 October 2008 - 10:31 AM

Oh, so it does.
Put that line in then, yeah.

#15 Twilight Knight

Twilight Knight

    Tell all with glee, Argon's on PureZC

  • Members
  • Real Name:Sven
  • Location:Rotterdam, NL

Posted 26 October 2008 - 10:33 AM

You beat me, I did, I edited my last post.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users