slayer
New Member
- Reaction score
- 2
Hello!
I wanted to create a script were items spawn after buying a specific item from a shop. So far so good, it works as intended.
But I also wanted to set a maximum of items being created, in this case a maximum of 4 items being created inside the region. I tried to do this, but without success. (I'm not sure about the variables at all...)
Summarized: The script I am trying to make, should do the following; When A item have been bought, create 4 of item B in region C. If there already is 4 or less of items B in this region, do not create any more than a maximum of 4 in that region. err..![Big Grin :D :D](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
My question is: What do I have to change to make this work?
Or do you guys have any other cool ideas to solve this problem with?![Cool :cool: :cool:](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Shimmerweed Start Q
Events
Unit - A unit Sells an item (from shop)
Conditions
(Item-type of (Sold Item)) Equal to Shimmerweed START Q
Actions
Set TotalItems[0] = (CurrentItemValue + 4)
Set L = (Center of shimmerweed <gen>)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Custom value of (Random item in shimmerweed <gen>)) Less than or equal to 4
Then - Actions
Set L = (Random point in shimmerweed <gen>)
Item - Create Shimmerweed at L
Set TotalItems[CurrentItemValue] = (Custom value of (Last created item))
Custom script: call RemoveLocation(udg_L)
Else - Actions
Do nothing
I wanted to create a script were items spawn after buying a specific item from a shop. So far so good, it works as intended.
But I also wanted to set a maximum of items being created, in this case a maximum of 4 items being created inside the region. I tried to do this, but without success. (I'm not sure about the variables at all...)
Summarized: The script I am trying to make, should do the following; When A item have been bought, create 4 of item B in region C. If there already is 4 or less of items B in this region, do not create any more than a maximum of 4 in that region. err..
My question is: What do I have to change to make this work?
Or do you guys have any other cool ideas to solve this problem with?
Shimmerweed Start Q
Events
Unit - A unit Sells an item (from shop)
Conditions
(Item-type of (Sold Item)) Equal to Shimmerweed START Q
Actions
Set TotalItems[0] = (CurrentItemValue + 4)
Set L = (Center of shimmerweed <gen>)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Custom value of (Random item in shimmerweed <gen>)) Less than or equal to 4
Then - Actions
Set L = (Random point in shimmerweed <gen>)
Item - Create Shimmerweed at L
Set TotalItems[CurrentItemValue] = (Custom value of (Last created item))
Custom script: call RemoveLocation(udg_L)
Else - Actions
Do nothing