Jump to content
Sign in to follow this  
tolemi959

Making ores/nodes/wood or w/e "randomly" spawn

Recommended Posts

So, how can I achieve this? I want ores to spawn in a pre-set place at a x% chance whenever a player enters the map the ore is being placed in. Is this possible? What script can I use to accomplish this with? Thanks in advance!

Share this post


Link to post
Share on other sites

Absolutely no script necessary. This is very simple and easy to do.

 

Start out with one simple node.

 

Put the node as autorun. In the events put:

 

Conditional Branch, go to tab four, click script, and put this in:

 

rand(100) <= 30

 

The 30 is the % chance the event will not appear. So if you want it to have a 10% chance of disappearing put 10 instead of 30.

 

Make sure there's an else for the conditional branch.

 

In the branch put an Erase Event command.

 

In the else, turn on Self-Switch A.

 

Then make a new page that has the condition on the left being that the Self-Switch A is ON.

 

Put all your node work in this page.

Share this post


Link to post
Share on other sites

I tried doing that, but due to it being on auto run it also instantly asks the player to "chop down" the tree if the event has spawned. I also want it to be able to respawn even if it has been chopped/mined before.

This is what it currently looks like.

 

2n0inoh.png

 

*sadface*

Edited by tolemi959

Share this post


Link to post
Share on other sites
Then make a new page that has the condition on the left being that the Self-Switch A is ON.

 

Put all your node work in this page.

 

You need to put your node stuff in the second page, not in the branch.

 

As for respawning... I forgot about that issue. I had someone make me a code that resets certain self switches. that fixed the problem for me, but that won't work here.  I'll tell you what I figure out.

 

EDIT: Kay figured it out. When the node is expired and all mined out, turn on off the self-switch A and erase the event.

Edited by Titanhex

Share this post


Link to post
Share on other sites

I think I almost got it right now. Problem now is it ALWAYS respawns. When I enter another map and zone back in it's always there.

 

30hrhc5.png

Share this post


Link to post
Share on other sites

You don't need a third page. Delete the third page.

 

Put the condition, Self-Switch A is ON, as the condition for the second page.

 

Allow me to explain this whole things.

 

First, when the player enter the map no self switches are on. So we have Page 1 run with the autoevent.

 

It checks a random number from 1 to 100.  If it's less than or equal to 30, it just gets rid of the event. Event is gone til you enter the map again.

 

However if it is greater than 30, we turn on Self-Switch A.

 

The game turns the event to Page 2 since Self-Switch A is now on.

 

Page 2 has all the tree-chopping stuff.

 

If we chop the tree down, failure or not, we turn off Self-Switch A. This turns the event back to page 1 because page 2's conditions aren't met. But because we're getting rid of the event and erasing it til you re-enter, the game won't do the stuff on Page 1.

Edited by Titanhex

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted