Gamestudio Links
Zorro Links
Newest Posts
WFO Training with parallel cores Zorro64
by Martin_HH. 02/24/26 19:51
Zorro version 3.0 prerelease!
by TipmyPip. 02/24/26 17:09
ZorroGPT
by TipmyPip. 02/23/26 21:52
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
5 registered members (Martin_HH, TipmyPip, AndrewAMD, Grant, USER0328), 5,287 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
alx, ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon
19199 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Drag entity at run time #173516
12/18/07 08:34
12/18/07 08:34
Joined: Oct 2007
Posts: 85
H
harry3174 Offline OP
Junior Member
harry3174  Offline OP
Junior Member
H

Joined: Oct 2007
Posts: 85
Hi
I want to drag entity at run time.
Can anybody give me command for drag entity ?

Thanking you
Alpa

Re: Drag entity at run time [Re: harry3174] #173517
12/18/07 09:54
12/18/07 09:54
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
There is a code snippet in my modelNodePath demo
try to download it under my sig.

Re: Drag entity at run time [Re: vlau] #173518
12/19/07 13:02
12/19/07 13:02
Joined: Oct 2007
Posts: 85
H
harry3174 Offline OP
Junior Member
harry3174  Offline OP
Junior Member
H

Joined: Oct 2007
Posts: 85
Hello,
Thank you very much for your kind respons and reply.
The download link you have provided is not responding. kindly reset the link so that i can download the file and please make sur that the link works for atleast next 24 hours.


Alpa

Re: Drag entity at run time [Re: harry3174] #173519
12/19/07 13:25
12/19/07 13:25
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
The link works, probably you need to register first
http://www.filefront.com/

Anyway, here is the part of the wdl :
Code:

function nodeEvent()
{
if (event_type == event_release)
{
my.skin = 1; // original skin

}
if (event_type == event_touch)
{
my.skin = 2; // hilight skin
}
if (event_type == event_click)
{
my.skill13 = my.z; // store original z-pos.

// drag node
while(mouse_left)
{
my.skin = 2;

my.skill10 = mouse_pos.x; // follow mouse x-pos
my.skill11 = mouse_pos.y; // follow mouse y-pos
my.skill12 = camera.z; // same as camera z-pos
vec_for_screen(my.skill10,camera);

// update to world pos
my.x = my.skill10;
my.y = my.skill11;
my.z = my.skill12;

my.flag1 = on; // node has been moved, update offset.

wait(1);
}
my.skin = 1;
my.z = my.skill13; // reset z-pos

}
}

action nodeLead
{
lead = my;
my.passable = on;
my.enable_touch = on;
my.enable_release = on;
my.enable_click = on;
my.event = nodeEvent;
}



Re: Drag entity at run time [Re: vlau] #173520
12/21/07 12:51
12/21/07 12:51
Joined: Oct 2007
Posts: 85
H
harry3174 Offline OP
Junior Member
harry3174  Offline OP
Junior Member
H

Joined: Oct 2007
Posts: 85
Dear,

Thank you for your kind co-operation,Your script is quite useful for me.
I am new to 3dgs.
Thanks
Alpa

Re: Drag entity at run time [Re: harry3174] #173521
12/25/07 04:12
12/25/07 04:12
Joined: Oct 2007
Posts: 85
H
harry3174 Offline OP
Junior Member
harry3174  Offline OP
Junior Member
H

Joined: Oct 2007
Posts: 85
Marry Christmas

I have take earth.mdl as drag entity.assine drag action.Now i take other entity sp.mdl which is invisible when game start in wed and define ENTITY* sp; in script.I have this code in drag action.

if (vec_dist(sp.x,my.x) < 75) // play with 50
{
my.INVISIBLE = on;
sp.INVISIBLE = off;
}

Its give me empty pointer error.Please help. here is full code

var video_mode = 8;
var video_depth = 32;

var speed = 10;
entity* lead;
entity* node;
entity* sp;

string snodeName;
string snodeNo;
var nodeNo = 0;

// NOTICE :
// get next node
// name your nodes in sequence in WED, such as
// node_1, node_2, node_3 etc...
/*function getNextNode()
{
nodeNo += 1;
nodeNo = cycle(nodeNo,1,7);
str_cpy(snodeName,"node_");
str_for_num(snodeNo,nodeNo);
str_cat(snodeName,snodeNo);
node = ent_for_name(snodeName);
}*/

function main()
{

level_load("drag.wmb");
wait(2);
// bird view
vec_set(camera.z,vector(0,0,500)); // 2000 = camera z-pos
camera.tilt = -90;

mouse_mode = 1;
mouse_range = 20000;

while(1)
{
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
if (key_w){
camera.tilt += 2 * time_step;
}
if (key_s) {
camera.tilt -= 2 * time_step;
}
if (key_a) {
camera.pan += 2 * time_step;
}
if (key_d){
camera.pan -= 2 * time_step;
}
wait(1);
}
}

function drag()
{
if (event_type == event_release)
{
my.skin = 1; // original skin
}
if (event_type == event_touch)
{
my.skin = 1; // hilight skin
}
if (event_type == event_click)
{
my.skill13 = my.z; // store original z-pos.

// drag
while(mouse_left)
{
my.skin = 1;

my.skill10 = mouse_pos.x; // follow mouse x-pos
my.skill11 = mouse_pos.y; // follow mouse y-pos
my.skill12 = camera.z; // same as camera z-pos
vec_for_screen(my.skill10,camera);

// update to world pos
my.x = my.skill10;
my.y = my.skill11;
my.z = my.skill12;

my.flag1 = on; // node has been moved, update offset.

wait(1);
}
my.skin = 1;
my.z = my.skill13; // reset z-pos

}
}

action nodeLead
{
lead = my;
my.passable = on;
my.enable_touch = on;
my.enable_release = on;
my.enable_click = on;
my.event = drag;
if(vec_dist(sp.x,my.x) < 75) // play with 50
{
my.INVISIBLE = on;
}
}


action sp_entity
{
Sp = my;
my.INVISIBLE = On;
// set(my,INVISIBLE); //giving syntex error
}

Re: Drag entity at run time [Re: harry3174] #173522
12/25/07 06:04
12/25/07 06:04
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Code:

action nodeLead
{

// Ensure entity sp is load in the level
// before access its pointer
while (sp==NULL) {wait(1);}

lead = my;
my.passable = on;
my.enable_touch = on;
my.enable_release = on;
my.enable_click = on;
my.event = drag;

if(vec_dist(sp.x,my.x) < 75) // play with 50
{
my.INVISIBLE = on;
}
}



Re: Drag entity at run time [Re: vlau] #173523
12/27/07 04:25
12/27/07 04:25
Joined: Oct 2007
Posts: 85
H
harry3174 Offline OP
Junior Member
harry3174  Offline OP
Junior Member
H

Joined: Oct 2007
Posts: 85
Thanks,
Well i change priority.I put earth action as second action.So my empty error has gone.
Actully i am trying snap entity(earth with sphere).when earth goes near to sp earth will invisible and sp will visible.In car action which condition you used,
i put it in earth action.But nothing is happend.Please help.


var video_mode = 8;
var video_depth = 32;

var speed = 10;

ENTITY* earth;

string snodeName;
string snodeNo;
var nodeNo = 0;

// NOTICE :
// get next node
// name your nodes in sequence in WED, such as
/*function getNextNode()
{
nodeNo += 1;
nodeNo = cycle(nodeNo,1,7);
str_cpy(snodeName,"node_");
str_for_num(snodeNo,nodeNo);
str_cat(snodeName,snodeNo);
node = ent_for_name(snodeName);
}*/

function main()
{

level_load("drag.wmb");
wait(2);
// bird view
vec_set(camera.z,vector(0,0,2000)); // 2000 = camera z-pos
camera.tilt = -90;

mouse_mode = 1;
mouse_range = 10000;

while(1)
{
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
if (key_w){
camera.tilt += 2 * time_step;
}
if (key_s) {
camera.tilt -= 2 * time_step;
}
if (key_a) {
camera.pan += 2 * time_step;
}
if (key_d){
camera.pan -= 2 * time_step;
}
wait(1);
}
}

function drag()
{
if (event_type == event_release)
{
my.skin = 1; // original skin
}
if (event_type == event_touch)
{
my.skin = 1; // hilight skin
}
if (event_type == event_click)
{
my.skill13 = my.z; // store original z-pos.

// drag
while(mouse_left)
{
my.skin = 1;

my.skill10 = mouse_pos.x; // follow mouse x-pos
my.skill11 = mouse_pos.y; // follow mouse y-pos
my.skill12 = camera.z; // same as camera z-pos
vec_for_screen(my.skill10,camera);

// update to world pos
my.x = my.skill10;
my.y = my.skill11;
my.z = my.skill12;

my.flag1 = on; // node has been moved, update offset.

wait(1);
}
my.skin = 1;
my.z = my.skill13; // reset z-pos

}
}

action nodeLead
{
earth = my;
my.passable = on;
my.enable_touch = on;
my.enable_release = on;
my.enable_click = on;
my.event = drag;

/*if (vec_dist(my.x,earth.x)< 50) // play with 50
{
my.INVISIBLE = off;
}*/
}


action sp_entity
{
// sp = my;
my.INVISIBLE = On;
if (vec_dist(my.x,earth.x)< 50) // play with 50
{
earth.INVISIBLE = off;
my.INVISIBLE = Off;
}


}

Re: Drag entity at run time [Re: harry3174] #173524
12/27/07 09:36
12/27/07 09:36
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
It didn't work because the sp entity check the
distance only once when it load into the level.

You need to put the if statement inside a loop.

Code:

action sp_entity
{
sp = my;
my.INVISIBLE = On;

while(my)
{
if (vec_dist(my.x,earth.x)< 50) // play with 50
{
earth.INVISIBLE = On;
my.INVISIBLE = Off;
}
wait(1);
}
}



Re: Drag entity at run time [Re: vlau] #173525
12/29/07 04:07
12/29/07 04:07
Joined: Oct 2007
Posts: 85
H
harry3174 Offline OP
Junior Member
harry3174  Offline OP
Junior Member
H

Joined: Oct 2007
Posts: 85
Thanks a lot,

I make what i want.In function main() i change
camera.tilt = -90; to camera.pan = 90;Because i want front view.
Then drag action cant work.
Why ?Does everything depends upon camers ?

Please help
Thanks

Page 1 of 2 1 2

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

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