0 registered members (),
1,498
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Action when object is in view
#341507
09/17/10 16:58
09/17/10 16:58
|
Joined: Sep 2010
Posts: 42 NS, Canada
gSet
OP
Newbie
|
OP
Newbie
Joined: Sep 2010
Posts: 42
NS, Canada
|
I've got a slightly strange requirement, here. I'm using a first-person movement script, and I'm wondering if it's possible to activate a certain event (such as send a bit value to the parallel port) when a specific object is in view. I'm still in the process of learning Lite-C so I really just need to know if this is possible and if it's going to be complex. Any advice would be appreciated!
"If it's true what you say to me, that the whole world will mourn his death - If the whole world will weep, I will give him back his breath."
|
|
|
Re: Action when object is in view
[Re: gSet]
#341508
09/17/10 17:06
09/17/10 17:06
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
No worries.
All you need to do is research events as triggered by "c_scan", so you can perform a "port_out" command to send data to the serial or parallel port.
Both "c_scan" and "port_in / port_out" commands can be found in the manual.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Action when object is in view
[Re: Saturnus]
#341795
09/20/10 16:31
09/20/10 16:31
|
Joined: Sep 2010
Posts: 42 NS, Canada
gSet
OP
Newbie
|
OP
Newbie
Joined: Sep 2010
Posts: 42
NS, Canada
|
Thanks for the suggestions! This should work great
"If it's true what you say to me, that the whole world will mourn his death - If the whole world will weep, I will give him back his breath."
|
|
|
Re: Action when object is in view
[Re: gSet]
#341907
09/21/10 15:53
09/21/10 15:53
|
Joined: Sep 2010
Posts: 42 NS, Canada
gSet
OP
Newbie
|
OP
Newbie
Joined: Sep 2010
Posts: 42
NS, Canada
|
Alright, so I've been trying to learn to use c_scan, but for some reason this just isn't working for me. I've read all the documentation and searched the forums but to no avail. What I'm trying to do is essentially have one model use ProxFinish to detect when another entity comes within 400 quants (in any direction) and then load a specific level. Sounds easy, right? There must be something simple I'm doing wrong or forgetting. Here's what I've got.
Sorry it isn't tabbed, not sure how to do that. Also, camera_follow is just a simple function that does exactly what it sounds like.
action ProxFinish() { my.emask |= ENABLE_DETECT; while(1) { c_scan(my.x,my.pan,vector(0,0,400),SCAN_ENTS); wait(1); } }
action PlayWalk() { camera_follow(me); my.emask |= ENABLE_SCAN; VECTOR vFeet; vec_for_min(vFeet,me);
while (1) { my.pan += (key_cul-key_cur)*10*time_step; var distance = (key_cuu-key_cud)*30*time_step; c_move(me, vector(distance,0,0), NULL, GLIDE); c_trace(my.x,vector(my.x,my.y,my.z-1000),IGNORE_ME | IGNORE_PASSABLE); my.z = hit.z - vFeet.z; if (event_type == EVENT_SCAN) { level_load("Level1.wmb"); } wait(1); } }
"If it's true what you say to me, that the whole world will mourn his death - If the whole world will weep, I will give him back his breath."
|
|
|
Re: Action when object is in view
[Re: gSet]
#341912
09/21/10 16:49
09/21/10 16:49
|
Joined: Apr 2008
Posts: 650
Sajeth
User
|
User
Joined: Apr 2008
Posts: 650
|
First, youre using the event-system in a wrong way, I suggest to look it up in the manual again. Second, just use vec_dist(my.x,player.x) for distance detection.
Teleschrott-Fan.
|
|
|
Re: Action when object is in view
[Re: Sajeth]
#342099
09/23/10 13:35
09/23/10 13:35
|
Joined: Sep 2010
Posts: 42 NS, Canada
gSet
OP
Newbie
|
OP
Newbie
Joined: Sep 2010
Posts: 42
NS, Canada
|
Problem solved. It was a dumb mistake, I just didn't find the documentation very clear... Came about it with enough trial and error.
"If it's true what you say to me, that the whole world will mourn his death - If the whole world will weep, I will give him back his breath."
|
|
|
|