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
"Create" nothing on destination #372712
06/03/11 19:19
06/03/11 19:19
Joined: Sep 2006
Posts: 292
M
Mythran Offline OP
Member
Mythran  Offline OP
Member
M

Joined: Sep 2006
Posts: 292
Quote:
function main()
{
level_load (rpg1_wmb);
mouse_map = pointer_pcx;
mouse_mode = 2;
camera.x = player.x;
camera.y = player.y;
camera.z = 200;
camera.pan = 90; // initial pan angle
camera.tilt = -60;
while (1)
{
mouse_pos.x = pointer.x;
mouse_pos.y = pointer.y;
if ((mouse_pos.x < 2) && (camera.x > -2500)) {camera.x -= 10 * time;}
if ((mouse_pos.x > screen_size.x - 2) && (camera.x < 2500)) {camera.x += 10 * time;}
if ((mouse_pos.y > screen_size.y - 2) && (camera.y < 2500)) {camera.y -= 10 * time;}
if ((mouse_pos.y < 2) && (camera.y > -2500)) {camera.y += 10 * time;}
wait (1);
}
}

entity* destination;

action warlock
{
player = me;
while (1)
{
my.skill1 = 5 * time;
my.skill2 = 0;
vec_set (temp, my.x);
temp.z -= 3000;
trace_mode = ignore_you + ignore_passable + use_box;
my.skill3 = -trace (my.x, temp);

if (destination != null)
{
vec_set (temp.x, destination.x);
vec_sub (temp.x, my.x);
vec_to_angle (my.pan, temp);
my.tilt = 0; // don't bow laugh
if (vec_dist (my.x, destination.x) > 40)
{
move_mode = ignore_passable;
ent_move (my.skill1, nullvector); // moves using skill1..3
ent_cycle("walk", my.skill46);
my.skill46 += 10 * time; // "walk" animation speed
my.skill46 %= 100; // loop animation
}
else
{
destination.invisible = on;
ent_cycle("idle", my.skill46); // play "stand" frames animation
my.skill46 += 2 * time; // "stand" animation speed
my.skill46 %= 100; // loop animation
}
}
wait (1);
}
}

on_mouse_left = set_target;

function set_target()
{
var pos1;
var pos2;
pos1.x = mouse_pos.x;
pos1.y = mouse_pos.y;
pos1.z = 0;
vec_for_screen (pos1, camera);
pos2.x = mouse_pos.x;
pos2.y = mouse_pos.y;
pos2.z = 20000; // use a big value here
vec_for_screen (pos2, camera);
trace (pos1, pos2); // now "target" holds the coordinates of the hit point
destination = ent_create (destination_mdl, target, show_target);
}

function show_target()
{
my.passable = on;
while (mouse_left == 1) {wait (1);}
while (mouse_left == 0) {wait (1);}
ent_remove (me);
}


This code is from aum 34.
I just want to know how can i make it so that when you click
to set a destination nothing is created. I believe this change
wont matter if it's lite-c or c-script.

Thanks.

Re: "Create" nothing on destination [Re: Mythran] #372714
06/03/11 19:36
06/03/11 19:36
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Remove this:
"destination = ent_create (destination_mdl, target, show_target);"

Re: "Create" nothing on destination [Re: Pappenheimer] #372718
06/03/11 19:55
06/03/11 19:55
Joined: Sep 2006
Posts: 292
M
Mythran Offline OP
Member
Mythran  Offline OP
Member
M

Joined: Sep 2006
Posts: 292
It's true i do like things simple, but that simplicity lead me 2 days ago
to find that when i press the mouse button the character wont move(disables the destination)...
So i need to replace the ent_create or something else.

I also tryed

destination = mouse_pos;
destination = target;

Last edited by Mythran; 06/03/11 19:57.
Re: "Create" nothing on destination [Re: Mythran] #372720
06/03/11 20:00
06/03/11 20:00
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
Code:
function show_target()
{
my.passable = on;
my.invisible = on;
while (mouse_left == 1) {wait (1);}
while (mouse_left == 0) {wait (1);}
ent_remove (me);
}



Re: "Create" nothing on destination [Re: Slin] #372721
06/03/11 20:07
06/03/11 20:07
Joined: Sep 2006
Posts: 292
M
Mythran Offline OP
Member
Mythran  Offline OP
Member
M

Joined: Sep 2006
Posts: 292
I dont want it to be created, not to get invisible.
I'll explain why, i changed the code to a point that it keeps creating those bottles, and after a while it chrashes saying that i exceeded the number of entities...
But i also thought on that one tongue

Re: "Create" nothing on destination [Re: Mythran] #372724
06/03/11 20:27
06/03/11 20:27
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Change destination to a vector:

VECTOR destination;

Remove the if conditions with destination.

After the trace:
vec_set(destination, target);

Re: "Create" nothing on destination [Re: Pappenheimer] #372728
06/03/11 20:41
06/03/11 20:41
Joined: Sep 2006
Posts: 292
M
Mythran Offline OP
Member
Mythran  Offline OP
Member
M

Joined: Sep 2006
Posts: 292
thank you SO VERY MUCH Pappenheimer!
That did it, it's so perfect laugh
Really, thanks alot!

Re: "Create" nothing on destination [Re: Mythran] #372733
06/03/11 21:05
06/03/11 21:05
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Great to hear that it worked. wink

Re: "Create" nothing on destination [Re: Pappenheimer] #372753
06/04/11 00:22
06/04/11 00:22
Joined: Oct 2005
Posts: 4,771
Bay City, MI
lostclimate Offline
Expert
lostclimate  Offline
Expert

Joined: Oct 2005
Posts: 4,771
Bay City, MI
i believe if you put NULL in for the string in ent_create you get a dummy model that doesnt have any geometry. im not 100% about it though. sounds like youve already got a solution anyways.

Re: "Create" nothing on destination [Re: lostclimate] #372757
06/04/11 01:19
06/04/11 01:19
Joined: Sep 2006
Posts: 292
M
Mythran Offline OP
Member
Mythran  Offline OP
Member
M

Joined: Sep 2006
Posts: 292
lostclimate i tryed it yestarday, and no that doesnt work, even if you put NULL in the ent_create something else in the code keep creating it, mysterious hein?
Yes it is done laugh

Thank you all wink


Moderated by  adoado, checkbutton, mk_1, Perro 

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