Raised This Month: $ Target: $400
 0% 

Creating an entity between two points


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Des12
Senior Member
Join Date: Jan 2005
Old 02-26-2006 , 17:25   Creating an entity between two points
Reply With Quote #1

Hello, I want to create a tripwire type thing. Would it be possible to create an invisable entity between two points, and register a touch between it and a player?

I looked at the tripmine plugin and found a traceline. So lets say this:

Code:
public checkLine() { new origin[3] = { 50, 50, 50}; new origin2[3] = { 75, 75, 50}; //trace_line ( IgnoreEnt, Float:Start[3], Float:End[3], Float:vReturn[3] ) new id = trace_line ( -1, float(origin), float(origin2), /*what do I put here?*/ ); if(is_user_alive(id))     client_print(0,print_chat,"[AMXX] User has crossed into the line!"); set_task(0.1,checkLine); }

Would that work in detecting a user crossing a line? And what is the vReturn?
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 02-26-2006 , 18:03  
Reply With Quote #2

try making an env_beam or env_laser and registering its touches.
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-26-2006 , 18:28  
Reply With Quote #3

Quote:
Originally Posted by Kraugh
try making an env_beam or env_laser and registering its touches.
I don't think it registers a touch if it's not solid.

To do that, you'd have to set it to solid and then try it, but that would make the player unable to move through it.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 02-26-2006 , 18:53  
Reply With Quote #4

they do register a touch, that's how they deal damage when you run through them. i believe they are SOLID_TRIGGER: they register a touch but do not block.
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
Des12
Senior Member
Join Date: Jan 2005
Old 02-26-2006 , 19:14  
Reply With Quote #5

So creating an env_beam/laser, how would I disable the damange and set the start/endpoints?
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 02-26-2006 , 19:54  
Reply With Quote #6

http://collective.valve-erc.com/index.php?ent=env_beam

use DispatchKeyValue to assign these values.
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
Des12
Senior Member
Join Date: Jan 2005
Old 03-04-2006 , 11:18  
Reply With Quote #7

Alright, here is the code (it crashes the server)

The beacons work totally fine, but the env_beam crashes when they are activated.

Code:
public plugin_precache() {     precache_model ( BEACONMODEL );     tape = precache_model("sprites/rope.spr");      } public activateBeacons(id) {     switch(beaconcount[id]) {     case 2: {         tape1[id] = create_entity("env_beam");         entity_set_string(tape1[id],EV_SZ_classname,"beacon");           DispatchKeyValue (tape1[id], "LightningStart", beacon1[id]);         DispatchKeyValue (tape1[id], "LightningEnd", beacon2[id]);         DispatchKeyValue (tape1[id], "texture", tape);         DispatchKeyValue (tape1[id], "rendercolor" , "0 0 255");         //DispatchKeyValue (tape1[id], renderamt  , "0 0 255");         DispatchKeyValue (tape1[id], "life" , "0");                             DispatchSpawn ( tape1[id] );     }     case 3: {         tape2[id] = create_entity("env_beam");         entity_set_string(tape2[id],EV_SZ_classname,"beacon");           DispatchKeyValue (tape2[id], "LightningStart", beacon2[id]);         DispatchKeyValue (tape2[id], "LightningEnd", beacon3[id]);         DispatchKeyValue (tape2[id], "texture", tape);         DispatchKeyValue (tape2[id], "rendercolor" , "0 0 255");         //DispatchKeyValue (tape2[id], renderamt  , "0 0 255");         DispatchKeyValue (tape2[id], "life" , "0");                             DispatchSpawn ( tape2[id] );     }     //Two here because the last beacon and first beacon can link     case 4: {         tape3[id] = create_entity("env_beam");         entity_set_string(tape3[id],EV_SZ_classname,"beacon");           DispatchKeyValue (tape3[id], "LightningStart", beacon3[id]);         DispatchKeyValue (tape3[id], "LightningEnd", beacon4[id]);         DispatchKeyValue (tape3[id], "texture", tape);         DispatchKeyValue (tape3[id], "rendercolor" , "0 0 255");         //DispatchKeyValue (tape3[id], renderamt  , "0 0 255");         DispatchKeyValue (tape3[id], "life" , "0");                             DispatchSpawn ( tape3[id] );         tape4[id] = create_entity("env_beam");         entity_set_string(tape4[id],EV_SZ_classname,"beacon");           DispatchKeyValue (tape4[id], "LightningStart", beacon4[id]);         DispatchKeyValue (tape4[id], "LightningEnd", beacon1[id]);         DispatchKeyValue (tape4[id], "texture", tape);         DispatchKeyValue (tape4[id], "rendercolor" , "0 0 255");         //DispatchKeyValue (tape4[id], renderamt  , "0 0 255");         DispatchKeyValue (tape4[id], "life" , "0");                             DispatchSpawn ( tape4[id] );     }     }     return PLUGIN_HANDLED; }
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 03-04-2006 , 14:24  
Reply With Quote #8

did you not get tag mismatches when you compiled? i thought the third parameter of DispatchKeyValue had to be a string. anyway, for the texture key, use "sprites/rope.spr" instead of "tape" (you still need to precache it, however).
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
VEN
Veteran Member
Join Date: Jan 2005
Old 03-04-2006 , 14:32  
Reply With Quote #9

edit: hm, i was in rush so nvm
VEN is offline
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 03-04-2006 , 14:55  
Reply With Quote #10

actually he's using entity_set_string for that, so it should be fine. i'd wait until after DispatchSpawn to change it, though, so that the beam is created successfully. it might not cause any problems, though.
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:24.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode