Destroy actor Glitch.. i think.

Non-platform specific questions.

Destroy actor Glitch.. i think.

Postby Caaz Games » Thu Jul 19, 2007 4:23 pm

i think theres a glitch or some thing in ge, every time i try to add a create actor in the destroy actor event, it wont work, when the actor is destroyed, nothing happens, theres no error messege or anything, heres the code i'm useing.
Code: Select all
int n;
n=rand(1);
if (n==0)CreateActor("HealthDrop", "HealthDrop", "StarTrak", "(none)", 0, 0, false);
if (n==1)CreateActor("UpgrdDrop", "UpgrdDrop", "StarTrak", "(none)", 0, 0, false);
ive even tried :
Code: Select all
CreateActor("HealthDrop", "HealthDrop", "StarTrak", "(none)", 0, 0, false);
but it still wont work :(
You are welcome to join my forum. 4 active members lol but it's a cool place. active... much talking :D it's fun!
http://caaz.freeforums.org/
User avatar
Caaz Games
 
Posts: 729
Joined: Wed Feb 14, 2007 9:09 am
Location: California....knows how to party!
Score: 25 Give a positive score

Postby d-soldier » Thu Jul 19, 2007 5:32 pm

Dunno what the problem would be... I have actors created from my destroyactor scripts in nearly every actor without ever having a problem... I'd check the actors that are supposed to be created by putting them where the player starts and setting them to be created on startup, thereby watching to see if they react as you want them to from the get-go... The process of elimination would suggest that if they work fine while created at startup, the problem must be in the destroy-actor script somehow...
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby makslane » Thu Jul 19, 2007 7:24 pm

Use:

Code: Select all
n = round(rand(1));
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby summer_goth » Thu Jul 19, 2007 8:06 pm

I might be wrong in this but don't rand return a number between zero and the maximum number? In that case the maximum value is not one of the values that will be returned. I think that makslane's code will work or try this:

Code: Select all
int n=rand(2);
if (n==0)CreateActor("HealthDrop", "HealthDrop", "StarTrak", "(none)", 0, 0, false);
else if (n==1)CreateActor("UpgrdDrop", "UpgrdDrop", "StarTrak", "(none)", 0, 0, false);


That should work if memory serves correctly. If not then I apologise. :wink:
User avatar
summer_goth
 
Posts: 153
Joined: Fri Jun 22, 2007 8:07 am
Location: South Africa
Score: 5 Give a positive score

Postby pixelpoop » Thu Jul 19, 2007 10:05 pm

rand() always includes 0 as one of the possibilities, so...

rand(1); can only equal zero.

rand(2); can equal zero or one.
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby Caaz Games » Fri Jul 20, 2007 7:10 am

:) yay now it works.
You are welcome to join my forum. 4 active members lol but it's a cool place. active... much talking :D it's fun!
http://caaz.freeforums.org/
User avatar
Caaz Games
 
Posts: 729
Joined: Wed Feb 14, 2007 9:09 am
Location: California....knows how to party!
Score: 25 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest