Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 645 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
again problem with removing and creating! #317363
03/30/10 21:44
03/30/10 21:44
Joined: Feb 2008
Posts: 85
Germany
Schloder87 Offline OP
Junior Member
Schloder87  Offline OP
Junior Member

Joined: Feb 2008
Posts: 85
Germany
got a problem again.

following problem: i coded a inventory, if i pick the shield from the inventory an klick on mouse middle, the shield should fall down on the floor. this works, but if the shield already lies on the floor an i press mouse middle, a new one gets created!


Quote:


function pick_shield()
{
my.enable_click = on;

if (mouse_map != pointer_pcx) {return;} // don't pick the item if the mouse pointer isn't the cursor
if (vec_dist (player.x, my.x) > 100) {return;} // if the player is far away ignore it

player.shield = 1; // the player has got the shield
show_pointer = 1; // show the mouse pointer
mouse_map = shield_pcx;


if (mouse_map == shield_pcx)
{
on_mouse_middle= delete_shield;
// wegwerfen des schildes bei rechter maustaste ///////////////
}
}


//// WIRF DEN SCHILD WEG//////////

action delete_shield()
{
mouse_map=pointer_pcx;
my = ent_create(shield_mdl,player.x,NULL);
show_pointer=0;
player.shield =0;
while (player == null) {wait (1);}


my.enable_click = on;
my.event = shield_init;

}




Visit IGRAVISION at: http://www.igravision.com
_________________________
Re: again problem with removing and creating! [Re: Schloder87] #317367
03/30/10 22:34
03/30/10 22:34
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Why do you open a new topic ?!?!

Change
if (mouse_map == shield_pcx)
{
on_mouse_middle= delete_shield; // wegwerfen des schildes bei rechter maustaste ///////////////
}

to:

if (mouse_map == shield_pcx)
{
if(mouse_middle) {
delete_shield();
while(mouse_middle) { wait(1); }
}
}


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: again problem with removing and creating! [Re: Superku] #317368
03/30/10 22:43
03/30/10 22:43
Joined: Feb 2008
Posts: 85
Germany
Schloder87 Offline OP
Junior Member
Schloder87  Offline OP
Junior Member

Joined: Feb 2008
Posts: 85
Germany
still doesn`t work. now nothing happens anymore...


Visit IGRAVISION at: http://www.igravision.com
_________________________
Re: again problem with removing and creating! [Re: Schloder87] #317371
03/30/10 23:20
03/30/10 23:20
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Shouldn't you ask first whether the player still has the shield?
Like this:

action delete_shield()
{
if(layer.shield == 1)
{
mouse_map=pointer_pcx;
my = ent_create(shield_mdl,player.x,NULL);
show_pointer=0;
player.shield =0;
}
while (player == null) {wait (1);}


my.enable_click = on;
my.event = shield_init;

}


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | 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