Jump to content

Photo

Custom "Collectable" Item Question.


  • Please log in to reply
43 replies to this topic

#31 Peteo

Peteo

    Back in Business!

  • Members
  • Real Name:Pete
  • Location:Finland

Posted 20 February 2013 - 12:04 PM

Sorry to revive this topic again and bother you all, but I have a new problem. The "give an item" code works perfectly like I stated in my previous post. However, the counter up code \10\x\x I have a problem with. As one of the prizes for collecting tokens I want to give the player a certain amount of money. With the code number 10 it is possible. But when I exit the room and come back, I can get the money prize over and over again. is there any way to make it a one time event? I don't want the players to cheat and fill their wallets this way. icon_frown.gif

Edited by Peteo, 20 February 2013 - 12:04 PM.


#32 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 20 February 2013 - 12:42 PM

Use this script to play a string once, the first time you enter a room.

CODE
//D0: String to play
//D1: Screen variable to save to (0-7)
//D2: Time before string is played (minimum 12)
ffc script oneTimeMessage{
    void run(int m, int perm, int delay){
        if (Screen->D[perm]){
            return;
        }
        else{
            Waitframes(Max(12, delay));
            Screen->Message(m);
            Waitframe();
            Screen->D[perm] = 1;
        }
    }
}


#33 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 20 February 2013 - 12:48 PM

Scripting would be the best way. But, when you give Link the money, you could also give him a dummy item, and use a "Switch to" string control code to go to a different string that doesn't give Link money if he has the dummy item.

#34 Peteo

Peteo

    Back in Business!

  • Members
  • Real Name:Pete
  • Location:Finland

Posted 20 February 2013 - 01:07 PM

Thanks to the both of you! Seems like I can use either one of these to get the "give money only once" idea to work. Spectacular. icon_smile.gif

#35 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 15 March 2013 - 10:36 AM

I'm wondering how you could do something like this while:
- also being able to reduce the script counter (that I can do)
- but with the counter never going below 0 (I don't know about that)

I can have the player collect items, give them through string control codes, etc. and everything works fine.

But my problem is that if I want to decrease the counter by removing an item, and if it drops below 0, it won't stay at 0 (in fact, it goes to 65535).

Edited by Jamian, 16 March 2013 - 09:28 AM.


#36 Anthus

Anthus

    Lord of Liquids

  • Members
  • Location:Ohio

Posted 16 March 2013 - 03:01 PM

QUOTE(Jamian @ Mar 15 2013, 11:36 AM) View Post

I'm wondering how you could do something like this while:
- also being able to reduce the script counter (that I can do)
- but with the counter never going below 0 (I don't know about that)

I can have the player collect items, give them through string control codes, etc. and everything works fine.

But my problem is that if I want to decrease the counter by removing an item, and if it drops below 0, it won't stay at 0 (in fact, it goes to 65535).


This is some pretty unqualified advice, but could you make a script that checks if the number goes below 0, at which point, it could set it to 0 (and over ride it going to 65535?)

#37 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 16 March 2013 - 03:14 PM

I think any built-in function in ZQuest (item pickups and string control codes) will probably prevent wrap-arounds for you.

#38 DragonDePlatino

DragonDePlatino

    Pixel Dragon

  • Members

Posted 16 March 2013 - 03:19 PM

Hey! This sounds pretty interesting! I was thinking of doing something similar to this in my own quest if I ever continued it. Here's the idea...

You could create a sense of "story progression" by utilizing the string switches. When you talk to a certain person, an invisible counter could be increased. Or when you walk into a certain room you could pick up a dummy item which could also increase the counter. The counter would go up and up, and when it's at a certain level you can speak to a previous NPC and they would switch their string to something else! And you could make the string only appear one time by making an invisible step switch somewhere which would remotely activate a screen secret which would make the tile warp for talking to that person change. Or...do people already do stuff like that?

#39 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 16 March 2013 - 03:23 PM

You could do that, but there's a much easier way to make NPCs with a popular script (look for "NPC" in the script database) so you won't need warps to their conversations.

#40 DragonDePlatino

DragonDePlatino

    Pixel Dragon

  • Members

Posted 16 March 2013 - 04:17 PM

QUOTE(MoscowModder @ Mar 16 2013, 03:23 PM) View Post

You could do that, but there's a much easier way to make NPCs with a popular script (look for "NPC" in the script database) so you won't need warps to their conversations.

Yeah, but some people really don't like scripts...It's my first quest and I don't want to screw around with a bunch of scripts because it will just overly complicate things, and it's hard to find lots of support of scripts. Not to mention, one of the purposes of my quest is to show of what ZQuest can do well without scripts. You wouldn't believe the kind of enemies people on the forums would suggest which are already fully possible in the enemy editor! Ah...but of course, I do know how to install scripts, and sideview ladders are a necessity for me.

#41 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 16 March 2013 - 08:23 PM

QUOTE(Anthus @ Mar 16 2013, 02:01 PM) View Post

This is some pretty unqualified advice, but could you make a script that checks if the number goes below 0, at which point, it could set it to 0 (and over ride it going to 65535?)


I know you could have a global script that would check for this, but that would mean checking every frame if counter X is at a correct level, which would undoubtedly slow down the game if you don't have a fast computer.

#42 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 16 March 2013 - 08:42 PM

Actually, checking for a counter going negative every frame probably wouldn't make any noticeable speed difference at all.

#43 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 17 March 2013 - 10:05 AM

Ok, I'm trying to set this up as an active global script but it has no effect:

CODE

global script Active
{
     void run()
     {
          if (Game->Counter[CR_SCRIPT1] > 500) // checking for an abnormally high value, since when it goes negative it changes to 65535
          {
                    Game->Counter[CR_SCRIPT1] = 0;
          }
     }
}

Edited by Jamian, 17 March 2013 - 10:08 AM.


#44 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 17 March 2013 - 01:58 PM

That will only run the first frame of the game. To make code run every frame, put it in a while(true) loop with a Waitframe() at the end.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users