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: [help?] Random Pick for trap placement  (Read 1095 times)

0 Members and 1 Guest are viewing this topic.
[help?] Random Pick for trap placement
« on: September 07, 2008, 10:14:47 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 57
Alright so I'm almost through coding the first boss for my game.
The boss is going to blacken the screen and spawn lanterns in circle.

Link will have to pick the right Lantern to attack.
The correct one stuns the boss while the rest will just hurt link.

The thing that I need help with coding is one of the lanterns needs to randomly be unique while the rest are the same.
I want only one of the lanterns to stun the boss.

How would I go about randomly giving one of the objects such a variable when they're all created?
Logged
Re: [help?] Random Pick for trap placement
« Reply #1 on: September 07, 2008, 10:49:19 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3374
I think its something like:
Code: [Select]
createdinstance = instance_create(x,y,instance)
with (createdinstance){
unique = 1
}
And so on. Of course you'll have to make the chance random and make it check to make sure there's not 2 of the unique ones on screen.
Logged
Quote from: Jason
Your community is a bunch of stuck up turds.
Re: [help?] Random Pick for trap placement
« Reply #2 on: September 07, 2008, 11:04:14 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
I think he knows how to do that Darklight, its the later part he dosen't understand.
Logged
Re: [help?] Random Pick for trap placement
« Reply #3 on: September 07, 2008, 11:06:22 pm »
  • The Dark Lord is here...
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 29
Code: [Select]
with (objlantern)
{
  unique=false;
}
(instance_find(objlantern, floor(random(instance_number(objlantern))))).unique = true;
Logged
Darth RPG - Feel Dark Side temptation

  • The Legend of Cerda Website
Re: [help?] Random Pick for trap placement
« Reply #4 on: September 07, 2008, 11:30:38 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 57
Code: [Select]
with (objlantern)
{
  unique=false;
}
(instance_find(objlantern, floor(random(instance_number(objlantern))))).unique = true;

This is working! Awesome thankyou
If anyone wants to learn from this thread, you can call this code for your instance from a separate object once they have all been created and it will give one of them the variable "unique=true"
« Last Edit: September 07, 2008, 11:41:26 pm by ClamyD »
Logged
Pages: [1]   Go Up

 


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



Page created in 0.038 seconds with 48 queries.