Jump to content

Photo

Non-Respawning Item Spawner


  • Please log in to reply
6 replies to this topic

#1 ShadowTiger

ShadowTiger

    The Doctor Is In

  • Members

Posted 19 March 2017 - 07:32 AM

So there's this lovely little item spawner script in the database, (Thank you, 744!) but it has the unique disadvantage of not being able to spawn items that are spammable in getting.

Hypothetically, if someone wanted to put several rupee pickups on the floor and have them only be able to be picked up once, how would someone go about having the item respawn each time the screen is remade unless they picked up the item?

I suppose having the FFC occupy the same space as the item, and check whether the player entered its hitbox. It's the only way I can think of at the moment.
  • Shane likes this

#2 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 19 March 2017 - 08:26 AM

Set Screen->D on item collection using either pick-up script, or Collision. Use a binary flagset, storing the item flag into one of its Misc slots, to identify unique item values:

0000001b; //item one
0000010b; //item two

...and so forth. Then, OR the flags together on collection into a specific Screen-D index. The ffc would use a D arg to specify its unique flag (per screen)

When the ffc that spawns items runs, if an the Screen->D index has that flag, it spawns no more. Otherwise, spawn the item and mark it. The item pick-up script registers that flag to Screen-D on collection.

Note that with the itemdata updates in 2.51 and above (2.54, inclusive), you could use the ffc that spawns the items to assign them a specific pick-up script, rather than needing to set one to the items by default. This allows using an item that has no pick-up script set, or a differemt script, in the above manner.

Those itemdata changes are in canonical ZC now, and will be in the next major release.

If you use Collision, just OR the value stored in item->Misc[] to Screen->D[]. It would be best if only one ffc script runs the collision function.

Edited by ZoriaRPG, 19 March 2017 - 08:30 AM.

  • ShadowTiger likes this

#3 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 19 March 2017 - 10:07 AM

I went and made a script for mass spawning items that you can find here. Looking at the OP again, I might've slightly misunderstood what you wanted, but hopefully it serves your purposes anyways.



#4 ShadowTiger

ShadowTiger

    The Doctor Is In

  • Members

Posted 19 March 2017 - 10:56 AM

Ladies and gentleman, (Because that's the kind of world we live in today, where such a diverse preamble is mandatory.) I do thank you very much. Such wonderful stuff right there.

So, Moosh, given that I see that these use flags #16-31, apparently, what does that mean in terms of the screen's secrets?

Y'know what'd be interesting for this script? And correct me if I'm wrong on this and this is actually how it works, but it'd be neat if each FFC defined a Combo ID number rather than a Combo Flag. This way you could have a unique floor combo just to have these items appear on it without having to have a flag on it.

#5 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 19 March 2017 - 11:00 AM

Mooshs script lets you use any flag, not just flags 16-31 :)


  • ShadowTiger likes this

#6 ShadowTiger

ShadowTiger

    The Doctor Is In

  • Members

Posted 19 March 2017 - 11:08 AM

Mooshs script lets you use any flag, not just flags 16-31 :)


......!

Who's a moron with two thumbs? This guy. *Points to self with a banana*

Thanks very much! I hadn't figured that when reading the directions. I'll experiment around with it.

What a glorious day. :-P

#7 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 19 March 2017 - 11:09 AM

So, Moosh, given that I see that these use flags #16-31, apparently, what does that mean in terms of the screen's secrets?

It means I like to live dangerously. On a screen where there's actual secrets going on you'd want to use script flags or raft flags or block trigger or something else that functionally does nothing. I was just showing off that in cases where there's no secrets on the screen, you can use secret flags.
 

Y'know what'd be interesting for this script? And correct me if I'm wrong on this and this is actually how it works, but it'd be neat if each FFC defined a Combo ID number rather than a Combo Flag. This way you could have a unique floor combo just to have these items appear on it without having to have a flag on it.

This sounded like a handy feature if flags were for whatever reason on short supply. I went ahead and updated the script so it interprets a negative flag as a combo number.


Edited by Moosh, 19 March 2017 - 11:24 AM.

  • ShadowTiger likes this


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users