Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Leeverscript  (Read 1462 times)

0 Members and 1 Guest are viewing this topic.
Leeverscript
« on: April 25, 2011, 03:45:34 pm »
  • Let's do this.
  • *
  • Reputation: +4/-0
  • Offline Offline
  • Gender: Male
  • Posts: 211
I am trying to make a Leever but I have an error in my code.
This is the Leever-appear code:
Code: [Select]
if (AI_stage == 0)
{
 if (i < 99)
 {i = random(100)}
 if (i >= 99)
 {
  if (randomfloor == 0)
  {x = random(room_width); y = random(room_height); randomfloor = 1}
  if (place_meeting(x,y,Collision) == true)
  {x = random(room_width); y = random(room_height)}
  if (place_meeting(x,y,Collision) == false)
  {AI_stage = 1; AI_timer_neu = 0}
 }
}
if (AI_stage == 1)
{
 if (AI_timer_neu == 0)
 {AI_timer = 45; AI_timer_neu = 1}
 AI_timer-= 1;
 if (AI_timer <= 0)
 {}
}
If there isn't a collision the AI_stage should change to AI_stage 1.
But sometimes there is a collision and the AI_stage is AI_stage 1. :-\

EDIT: AI_STAGE 1 IS IN THE CODE!
« Last Edit: April 25, 2011, 07:14:39 pm by Rayo »
Logged
This is one of many tales Hylian lore speaks of...

Click here to check out my Deviantart!
  • Zelda Time Walker
Re: Leeverscript
« Reply #1 on: April 26, 2011, 04:34:32 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2245
That's because your first checking there is a collision and then setting the x,y coordinates. and then you're checking for another collision, which is almost certainly going to fail and thus that variable will be set to 1.

Code: [Select]
if (place_meeting(x,y,Collision))
{
x = random(room_width);
y = random(room_height);
}
else
{
AI_stage = 1;
AI_timer_neu = 0;
}
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.296 seconds with 38 queries.

anything