2 registered members (vicknick, 1 invisible),
801
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Problems with pointers [new title]
[Re: Ditje]
#336272
08/02/10 18:30
08/02/10 18:30
|
Joined: Jul 2010
Posts: 127 Germany, Herford
Ditje
OP
Member
|
OP
Member
Joined: Jul 2010
Posts: 127
Germany, Herford
|
Another mistake must be earlier. I have a player (the starship) created in WED and added an action with lite-c:
// Spieler Raumschiff
ENTITY* spieler;
action spieler_aktion()
{
spieler = my;
my.STATE = 1;
while(1)
{
...
// Schiessen - Shot
if (my.STATE == 1) // kein Schuss
{
if(mouse_left) my.STATE = 2;
}
if(my.STATE == 2) // Schuss
{
if(last_bomb_x == 15) last_bomb_x = -15;
else last_bomb_x = 15;
if(bomb_anzahl < 4)
{
bomb = ent_create("bomb.mdl",vector(my.x+last_bomb_x,my.y+10,my.z),move_bomb);
bomb_anzahl ++;
}
my.STATE = 3;
}
if (my.STATE == 3)
{
if (!mouse_left) my.STATE = 1;
}
wait(1);
}
}
If I try "if(HIT_TARGET) remove(you);" ENTITY 'spieler' got removed when bomb hits an enemy ENITY
Last edited by Ditje; 08/02/10 18:39.
|
|
|
Re: Problems with pointers [new title]
[Re: Ditje]
#336274
08/02/10 18:49
08/02/10 18:49
|
Joined: Sep 2003
Posts: 5,900 Bielefeld, Germany
Pappenheimer
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
|
I don't know where the heck you found this "HIT_TARGET" thing! Look into the manual for the event handling and the different events. http://www.conitec.net/beta/aevent_entity.htmEVENT_ENTITY should do the job for you, because it returns 'you' as the pointer to the touched/hit entity, and then you can 'ent_remove(you);'.
|
|
|
Re: Problems with pointers [new title]
[Re: Pappenheimer]
#336280
08/02/10 19:35
08/02/10 19:35
|
Joined: Jul 2010
Posts: 127 Germany, Herford
Ditje
OP
Member
|
OP
Member
Joined: Jul 2010
Posts: 127
Germany, Herford
|
Yeah - that was it - oh my god so silly - I`ve got the HIT_TARGET from a tutorial Haven`t understood the manual first - now I tried again step by step and it works Hurray Vielen vielen Dank!!! Ditje
|
|
|
New problems with you pointer
[Re: Ditje]
#336377
08/03/10 15:03
08/03/10 15:03
|
Joined: Jul 2010
Posts: 127 Germany, Herford
Ditje
OP
Member
|
OP
Member
Joined: Jul 2010
Posts: 127
Germany, Herford
|
next step next problem I am still working on my function, when enemy got hit. There are several cases. My problem is case 4. It should just switch skins and change you.TYPE If I hit one enemy of TYPE 4, all enemies TYPE 4 switch their skins and switch{} doesn`t break; you.TYPE is now 3 and case 3 done (punkte_spieler+=240 ent_remove(you)) Thank you Ditje
...
#define TYPE skill4
...
my.TYPE = 4; // capture
...
// Gegner getroffen /////////////////////////////////////////////////
function treffer()
{
snd_play(snd_explode,100,0);
switch(you.TYPE)
{
case 1:
punkte_spieler += 50;
ent_remove(you);
break;
case 2:
punkte_spieler += 80;
ent_remove(you);
break;
case 3:
punkte_spieler += 240;
ent_remove(you);
break;
case 4:
// switch skins
ent_mtlset(you,mtl_rosa,1);
ent_mtlset(you,mtl_blau,2);
ent_mtlset(you,mtl_lila,3);
you.TYPE = 3;
break;
case 5:
// code for bonus level
break;
}
wait(1);
return;
}
my.emask = (ENABLE_ENTITY);
my.event = treffer;
...
function move_bomb()
{
...
if (event_type == EVENT_ENTITY) // Kollisionsabfrage wird etwas getroffen(?)
{
my.STATE = 3;
}
...
}
Last edited by Ditje; 08/03/10 15:04.
|
|
|
Re: New problems with you pointer
[Re: Helghast]
#336411
08/03/10 17:24
08/03/10 17:24
|
Joined: Jul 2010
Posts: 127 Germany, Herford
Ditje
OP
Member
|
OP
Member
Joined: Jul 2010
Posts: 127
Germany, Herford
|
yeah - dank je well
Ditje
edit: hmm but switch{} statement still got not stopped by break;
Last edited by Ditje; 08/03/10 17:46.
|
|
|
|