Gamestudio Links
Zorro Links
Newest Posts
Black Book, 4th edition
by TipmyPip. 05/11/26 08:40
ZorroGPT
by TipmyPip. 05/09/26 11:58
No errors in the command line
by jcl. 05/08/26 10:59
Purchase A8 full licence version
by jcl. 05/05/26 11:20
Z9 getting Error 058
by k_ivan. 04/25/26 19:13
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (JMMAC, Quad), 4,055 guests, and 22 spiders.
Key: Admin, Global Mod, Mod
Newest Members
curry, DhandhaxKrsna, Specific, DeepxKalsi, codestar42
19215 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Random Entity appearance #137726
06/23/07 11:57
06/23/07 11:57
Joined: Jul 2006
Posts: 111
Germany near Wuerzburg
D
Disaster Offline OP
Member
Disaster  Offline OP
Member
D

Joined: Jul 2006
Posts: 111
Germany near Wuerzburg
Hi
I have a little problem:
I have an entity which can be be killed by the player and i want only one of this entity in my level, but when it's killed it should appear randomized in an other part of the level.so simply the entity should disappear when you hit it and then it should appear on an other position in the level.
i also wrote a little code for this but it doesn't work....

var anz = 1; //to check that theres only one entity

action entity
{
...
// after hitting the entity
anz = 0;
ent_remove(me);
}


var x;
var y;
var z;

function entity_creating()
{
while (!player)
{
if (anz < 1)
{
x = int(random(580) -290);
y = int(random(424) -212);
z = 32;
vec_set (temp,vector(x,y,z));
ent_create (gem_mdl,temp,entity);
}
wait(1);
}
}

Could someone please help me?


mfg Disaster
Re: Random Entity appearance [Re: Disaster] #137727
06/23/07 12:35
06/23/07 12:35
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
There is a mistake in your code:
x = int(random(580) -290);
y = int(random(424) -212);
z = 32;

x,y,z are reserved names and should not be used for naming your var.
replace thoses lines by:
temp.x = int(random(580) -290);
temp.y = int(random(424) -212);
temp.z = 32;

and delete the line "vec_set()" as you do not need it anymore.

EDIT:
Further more your while loop statement is wrong.
That while loop while run as long as player is NOT true.
Change it into this:
while(!player) { wait(1); }
while(player)
{
//your spawn code
}

Last edited by Xarthor; 06/23/07 12:36.
Re: Random Entity appearance [Re: Xarthor] #137728
06/23/07 14:24
06/23/07 14:24
Joined: Jul 2006
Posts: 111
Germany near Wuerzburg
D
Disaster Offline OP
Member
Disaster  Offline OP
Member
D

Joined: Jul 2006
Posts: 111
Germany near Wuerzburg
thank you^^ no the code works


mfg Disaster

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1