Gamestudio Links
Zorro Links
Newest Posts
[MED] Import from FBX (2010) missing!!!
by USER0328. 09/03/26 18:03
Purchase A8 full licence version
by ukgamer. 08/30/26 14:27
ZorroGPT
by TipmyPip. 08/29/26 06:56
Retrieve optimize() variables order (edited)
by NorbertSz. 08/25/26 13:24
Max Number of Strategies in /Strategy folder
by Martin_HH. 08/17/26 07:54
Pause button for evaluation shell?
by AndrewAMD. 08/13/26 17:16
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 08/10/26 12:46
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (AndrewAMD), 1,327 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
riggi89, shuhari, KD1990, Student_64151, Koti
19230 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