Gamestudio Links
Zorro Links
Newest Posts
No connection to MT4
by JeyKey II. 10/29/26 09:34
Zorro plugin for Hyperliquid.xyz
by opm. 10/28/26 13:50
Icon "OP"
by JeyKey II. 10/27/26 07:03
ZorroGPT
by TipmyPip. 10/26/26 08:09
Chat Room for Zorro Programmers
by Haitao_Ren. 10/25/26 03:14
Trading Journey
by Haitao_Ren. 10/25/26 03:14
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (TipmyPip), 14,971 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Haitao_Ren, JimSimons, julienp, julienper, KelleyAbbey
19247 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