Post new topic    
Metal Slime
Send private message
plant grwing script help 
 PostTue Sep 10, 2013 10:27 am
Send private message Reply with quote
Hello,
this time I need help finding an bug that make the first plant (NPC 0, on map 3) change it's picture then it shouldn't. Almost immediately after picking a fuit the plant switches back to the picture facing left, displaying the fully grown plant. :/



For one plant the script wokred fine, but after adding the others, the fist behaves oddly,but the other plants on map 3 grow as they should.

Thanks for your help in advance! Grin

Code:
# plant growing script
# Plant stuff
# Plants

# walkabout graphic 31:
# walkabout graphic 32:
# walkabout graphic 33:
# walkabout graphic 34:
# walkabout graphic 35:
# walkabout graphic 36:
# walkabout graphic 37:


#global variables: 10 to 15 = plantcounterswamp
#global variables (16 to ??,plantcounterroadtoEllysuI)
#global variables (?? to ??,plantcounterroadtoEllysuII)
#global variables (?? to ??,plantcounterForestofEllysu1)
#global variabls  (?? to ??,plantcounterWaytoWestcity)

#show textbox (12)
plantcounterswamp  := plantcounterswamp  +1 #NPC 0
plantcounterswamp1 := plantcounterswamp1 +1 #NPC 1
plantcounterswamp2 := plantcounterswamp2 +1 #NPC 2
plantcounterswamp3 := plantcounterswamp3 +1 #NPC 3
plantcounterRoadtoEllysuIII := plantcounterRoadtoEllysuIII +1 # NPC0

# The 1st plant (NPC0) in the Swamp
if (current map == 3) then
         
   if (plantcounterswamp >= 9) then
      (
      # Alter NPC (0,NPCstat:picture,33)
      set NPC direction (0, left)
      )
   else if (plantcounterswamp > 6) then
      (
      # Alter NPC (0,NPCstat:picture,33)
      set NPC direction (0, down)
      )
   else if (plantcounterswamp > 3) then
      (
      # Alter NPC (0,NPCstat:picture,33)
      set NPC direction (0, right)
      )
   else
      (
      # Alter NPC (0,NPCstat:picture,33)
      set NPC direction (0, up)
      )

# The 2nd plant (NPC 01) in the Swamp
if (current map == 3) then
         
   if (plantcounterswamp1 >= 9) then
      (
      set NPC direction (1, left)
      )
   else if (plantcounterswamp1 > 6) then
      (
      set NPC direction (1, down)
      )
   else if (plantcounterswamp1 > 3) then
      (
      set NPC direction (1, right)
      )
   else
      (
      set NPC direction (1, up)
      )

# The 3rd plant (NPC 02) in the Swamp
if (current map == 3) then
         
   if (plantcounterswamp2 >= 9) then
      (
      set NPC direction (2, left)
      )
   else if (plantcounterswamp2 > 6) then
      (
      set NPC direction (2, down)
      )
   else if (plantcounterswamp2 > 3) then
      (
      set NPC direction (2, right)
      )
   else
      (
      set NPC direction (2, up)
      )


# The 4th plant (NPC 03) in the Swamp
if (current map == 3) then
         
   if (plantcounterswamp3 >= 9) then
      (
      set NPC direction (3, left)
      )
   else if (plantcounterswamp3 > 6) then
      (
      set NPC direction (3, down)
      )
   else if (plantcounterswamp3 > 3) then
      (
      set NPC direction (3, right)
      )
   else
      (
      set NPC direction (3, up)
      )

# The 1st plant (NPC 0) on the road to EllysuIII
if (current map == 6) then
         
   if (plantcounterRoadtoEllysuIII  >= 9) then
      (
      set NPC direction (0, left)
      )
   else if (plantcounterRoadtoEllysuIII  > 6) then
      (
      set NPC direction (0, down)
      )
   else if (plantcounterRoadtoEllysuIII  > 3) then
      (
      set NPC direction (0, right)
      )
   else
      (
      set NPC direction (0, up)
      )      

end

plotscript, getfruitSwamp, begin
if (current map == 3 && plantcounterswamp >= 9) then
   (
   plantcounterswamp := 0
   # Alter NPC (0,NPCstat:picture,33)
   set NPC direction (0, up)
   get item (21,random(2,4))
   )
end

plotscript, getfruitSwamp2, begin
if (current map == 3 && plantcounterswamp1 >= 9) then
   (
   plantcounterswamp1 := 0
   # Alter NPC (0,NPCstat:picture,33)
   set NPC direction (1, up)
   get item (21,random(2,4))
   )
end

plotscript, getfruitSwamp3, begin
if (current map == 3 && plantcounterswamp2 >= 9) then
   (
   plantcounterswamp2 := 0
   set NPC direction (2, up)
   get item (21,random(2,4))
   )
end

plotscript, getfruitSwamp4, begin
if (current map == 3 && plantcounterswamp3 >= 9) then
   (
   plantcounterswamp3 := 0
   set NPC direction (3, up)
   get item (21,random(2,4))
   )
end

plotscript, getfruitRoadtoEllysuIII, begin
if (current map ==6 && plantcounterRoadtoEllysuIII >= 9) then
   (
   plantcounterRoadtoEllysuIII := 0
   set NPC direction (1, up)
   get item (21,random(2,4))
   )
end
Liquid Metal King Slime
Send private message
 
 PostTue Sep 10, 2013 2:40 pm
Send private message Reply with quote
How is this script triggered?

Also, I think a screenshot or two of the plants on the map, and a screenshot of the plant sprites in the sprite editor would be helpful for visualizing what is going on here
Metal Slime
Send private message
 
 PostTue Sep 10, 2013 3:25 pm
Send private message Reply with quote
The script is included in the each-step script, wich also manage weather changes and count your steps.

That's a picture of the plant:


The script to pick up the fruits are run by NPCs, if you click them.


I also re-checked if not two NPC were using the same "get fruit" script, it's not the case here.
I could also upload the .rpg file if that helps.

Edit: The number on the sceen is the "plantcounterswamp" value, also displayed by the each step script. ((show value (plantcounterswamp) ))
Display posts from previous: