User Tag List

Results 1 to 10 of 10

Thread: Silver Arrow As Separate Item

  1. #1
    Octorok Lelouche Vi Britannia's Avatar
    Join Date
    Oct 2015
    Location
    Britannia - Area 11
    Posts
    173
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    951
    Level
    10
    vBActivity - Bars
    Lv. Percent
    70.1%

    Silver Arrow As Separate Item

    So I got the brilliant idea to have silver arrows be a different weapon in the game, which of course means scripting time.

    This is what I have so far...

    Code:
    CONST CR_SARROW = 18 //Set Counter for Silver Arrows to Script 12
    CONST CR_MAX_CL = 21 //Set Max Counter Clone for Sub Screen use to Script 15
    
    item script SilverArrow
    {
    	void run(int a, int damage) //D0 reserved for pick up message script
    	{
    		if (Game->Counter[CR_SARROW]<1){Quit();}
    		else
    		{
    			if Link->Item(15)=true; //Bow check Short Bow
    			{
    				int step = 100
    			}
    			if Link->Item(68)=true; //Bow check Long Bow
    				int step = 200
    			}
    			if Link->Item(50)=true;  //Bow check Fairy Bow
    				int step = 400
    			}
    			lweapon shot = NextToLink(LW_ARROW,0);
    			Game->PlaySound(1);
    			shot->Dir = Link->Dir;
    			shot->Step = step;
    			shot->UseSprite(11);
    			shot->Damage = damage;
    			Game->Counter[CR_SARROW]--;
    		 }
    	}
    }
    Now for questions based on the above.

    1) What is the base step speed of the Short Bow? I figure 100 is probably too high but I don't know for sure. Conversely, is there a way to pull this information from elsewhere without setting a variable or is this an okay way to do it?
    2) How do I make the projectile pierce?
    3) How do I make the projectile leave a spark trail? I'm researching this since I think I might have asked for something like this a while back but don't remember the answer I was given on that note.

    Thanks in advance.
    Lost my wings and grew 8 tentacles... I've seen enough Hentai to know where this is going....

  2. #2
    Octorok
    Join Date
    May 2015
    Posts
    139
    Mentioned
    34 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    526
    Level
    8
    vBActivity - Bars
    Lv. Percent
    22.42%
    You don't need scripts for this. Just set silver arrows and wooden arrows as the "item override" in the subscreen for two different slots, and you'll be able to have both. At least, I believe it can work that way. I know DarkMatt did this with silver arrows also costing magic in his Fun in the Sun II.

    Base Speed for Short Bow is 100. Scripted weapon speed is measured in 1/100ths of pixels per frame.
    Piercing is an option in the item editor for silver arrows, though yo'll have to manually keep it alive if you go with scripts.
    Sparkle trail you just set the sparkle sprite in the item editor and it'll enable it. If you wish to do this via scripts, just create LW_SPARKLE at the arrow's locations every few frames.

  3. #3
    Octorok Lelouche Vi Britannia's Avatar
    Join Date
    Oct 2015
    Location
    Britannia - Area 11
    Posts
    173
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    951
    Level
    10
    vBActivity - Bars
    Lv. Percent
    70.1%
    Quote Originally Posted by Dimentio View Post
    You don't need scripts for this. Just set silver arrows and wooden arrows as the "item override" in the subscreen for two different slots, and you'll be able to have both. At least, I believe it can work that way. I know DarkMatt did this with silver arrows also costing magic in his Fun in the Sun II.

    Base Speed for Short Bow is 100. Scripted weapon speed is measured in 1/100ths of pixels per frame.
    Piercing is an option in the item editor for silver arrows, though yo'll have to manually keep it alive if you go with scripts.
    Sparkle trail you just set the sparkle sprite in the item editor and it'll enable it. If you wish to do this via scripts, just create LW_SPARKLE at the arrow's locations every few frames.
    Which just leaves one tiny little problem which I'm sure is something else that needs to be scripted... a separate counter for the remaining shots. I don't think its as easy as changing the counter reference in the editor as this something hard-coded. Correct me if I'm wrong.
    Lost my wings and grew 8 tentacles... I've seen enough Hentai to know where this is going....

  4. #4
    Quest Builder Anarchy_Balsac's Avatar
    Join Date
    Nov 2005
    Posts
    751
    Mentioned
    11 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    2,435
    Level
    16
    vBActivity - Bars
    Lv. Percent
    19.18%
    It may be easier to do if you replace the bows with scripted bows. This will allow you to do a simple:

    Code:
    If (arrows wooden)
      Then deduct arrows
    If (arrows silver)
      Then deduct new variable for silver arrow count
    As a bonus, if you later decide you want to do more tweeks, like, say, make the Fairy Bow do a Tri-Shot, you can.

  5. #5
    Octorok Lelouche Vi Britannia's Avatar
    Join Date
    Oct 2015
    Location
    Britannia - Area 11
    Posts
    173
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    951
    Level
    10
    vBActivity - Bars
    Lv. Percent
    70.1%
    Quote Originally Posted by Anarchy_Balsac View Post
    It may be easier to do if you replace the bows with scripted bows. This will allow you to do a simple:

    Code:
    If (arrows wooden)
      Then deduct arrows
    If (arrows silver)
      Then deduct new variable for silver arrow count
    As a bonus, if you later decide you want to do more tweeks, like, say, make the Fairy Bow do a Tri-Shot, you can.
    I had thought about that... but probably not going to go that route. I did, after much debuging and testing come up with a solution (its mixed with my RPG Counter Script so try to ignore that)...

    Code:
    import "std.zh"
    
    const int CR_LIFEMIRRORMAX = 8; //Life Mirror for Max HP display on SS script 2
    const int CR_MAGICMIRRORMAX = 9; //Magic Mirror for Max MP display on SS script 3
    const int CR_LIFECUR = 10; //Life Current Mirror Script 4
    const int CR_MAGICCUR = 11; //Magic Current Mirror Script 5
    const int CR_SARROW = 18;// Silver Arrow Counter set to Script 12
    
    //MaxHP and MaxMP for max values
    
    
    global script Active
    {
    	void run()
    	{
    		while(true)
    		{
    			GetEquipmentA();
    			GetEquipmentB();
    			SilverArrowStatus();
    			CounterUpdate();
    			Waitdraw();
    			Waitframe();
    		}
    	}
    }
    
    void SilverArrowStatus()
    {
    	int j;
    	for(int i = Screen->NumLWeapons(); i>0; i--)
    	{
    		lweapon w=Screen->LoadLWeapon(i);
    		if (w->ID==LW_ARROW){j++;}
    	}
    	if (UsingItem(14)==true)
    	{
    		if (Game->Counter[CR_SARROW] < 1)
    		{
    			Link->ItemJinx = -1;
    		}
    		if (j > 0)
    		{
    			Link->ItemJinx = -1;
    		}
    	}
    	else
    	{
    		Link->ItemJinx = 0;
    	}
    }
    
    void CounterUpdate()
    {
    	Game->Counter[CR_LIFEMIRRORMAX]=Link->MaxHP;
    	Game->Counter[CR_LIFECUR]=Link->HP;
    	Game->Counter[CR_MAGICMIRRORMAX]=Link->MaxMP;
    	Game->Counter[CR_MAGICCUR]=Link->MP;
    }
    
    item script SilverArrow
    {
    	void run()
    	{
    		Game->Counter[CR_SARROW]--;
    		Game->Counter[CR_ARROWS]++;
    	}
    }
    The only downside I see with this method is plays with item jinx times, but I don't ever use enemies that cause item Jinx in game as its too easy to render Link completely helpless if both types of jinxers are in the same room, so in my case not much of a downside.
    Lost my wings and grew 8 tentacles... I've seen enough Hentai to know where this is going....

  6. #6
    The Timelord
    QDB Manager
    ZC Developer
    ZoriaRPG's Avatar
    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,358
    Mentioned
    110 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,514
    Level
    21
    vBActivity - Bars
    Lv. Percent
    19.68%
    Here, try this script.

    I wrote it ages ago, and it should do what you want to do, easily.

    I wrote this when I was originally mucking about with itemdata in the source. That's why there are lines commented out, everywhere, as those only work in ZC >= 2.54. The script itself, as-is, works in 2.50.x.Pm

    P.S. Here is the companion script, for custom bombs.

    I recall writing that one for Evan.
    Last edited by ZoriaRPG; 03-17-2018 at 12:03 PM.

  7. #7
    Octorok Lelouche Vi Britannia's Avatar
    Join Date
    Oct 2015
    Location
    Britannia - Area 11
    Posts
    173
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    951
    Level
    10
    vBActivity - Bars
    Lv. Percent
    70.1%
    I'll take a look when I'm off work. I'm actually quite proud if the one I wrote, it's my first successful for loop I've ever written, but I'm sure yours will work better.

    Edit

    Ok I glanced it while at work, it's a bit slow. I think I'll stick with my current, but this will come in handy when I get around to doing another quest I'm brainstorming.

    Is there a link to your shared scripts? I'd love to see more of your work since I've been teaching myself coding by looking at the library files and other scripts to see how things interact. Its how I figured out how For Loops work.
    Last edited by Lelouche Vi Britannia; 03-17-2018 at 06:21 PM. Reason: Added more stuff

  8. #8
    The Timelord
    QDB Manager
    ZC Developer
    ZoriaRPG's Avatar
    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,358
    Mentioned
    110 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,514
    Level
    21
    vBActivity - Bars
    Lv. Percent
    19.68%
    Quote Originally Posted by Lelouche Vi Britannia View Post
    I'll take a look when I'm off work. I'm actually quite proud if the one I wrote, it's my first successful for loop I've ever written, but I'm sure yours will work better.

    Edit

    Ok I glanced it while at work, it's a bit slow. I think I'll stick with my current, but this will come in handy when I get around to doing another quest I'm brainstorming.

    Is there a link to your shared scripts? I'd love to see more of your work since I've been teaching myself coding by looking at the library files and other scripts to see how things interact. Its how I figured out how For Loops work.
    Err.... The links are in my signature.

    In what way was the item script 'slow'?

    The arrow step speed can be changed, you know.

  9. #9
    The Timelord
    QDB Manager
    ZC Developer
    ZoriaRPG's Avatar
    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,358
    Mentioned
    110 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,514
    Level
    21
    vBActivity - Bars
    Lv. Percent
    19.68%
    For Loops

    A for loop is similar to a while loop, except that the variable on which it depends can be in the scope of the loop.

    The syntax is:
    for ( DECLARATION/ASSIGN; STATEMENT; EXPRESSION )

    Consider:

    Code:
    int x = 10;
    while ( x > 0)
    {
        --x;
        //do things
    }
    Using a for loop, you do not need a variable outside the loop (although you can still use a variable at a higher scope).

    Code:
    for (int x = 10; x > 0; --x )
    {
        //do things
    }
    That is functionally identical to the while loop.

    ZScript for loops are identical to C for loops, so, I suggest reading more on those.

    You can, as I mentioned, use an external variable, either with or without an assign in the for loop.

    Code:
    int x = 10;
    for ( x = 5; x > 0; --x) //Changes the value of 'x' to '5' as the loop begins.
    int y = 8;
    for ( ; y > 0; --y ) //Uses the existing value of y.
    That should help you get started.

  10. #10
    Octorok Lelouche Vi Britannia's Avatar
    Join Date
    Oct 2015
    Location
    Britannia - Area 11
    Posts
    173
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    951
    Level
    10
    vBActivity - Bars
    Lv. Percent
    70.1%
    I meant its a slow work day. Your scripts are far from slow.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social