Archived copy of warcraft-source.com, the Warcraft: Source (WCS) forum (2007–2011), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2010-07-29 (original capture). Home · Forum · All archived topics · Downloads

Author Topic: Teleport  (Read 557 times)

joshtrav

  • Level 7 Expert
  • Posts: 186
  • Country:
Re: Teleport
« Reply #15 on: July 17, 2010, 08:33:53 PM »
Let me make it simple for you.  You and people like you are the very reason we don't post anything.  Here's a clue: try the damn file and than ask questions because it does work well.  It's geared to accept and react as close to the coding that est did. You won't get another response as you have done nothing but make necavi's point stated earlier in this thread.

Tl:dr
try it and than comment so you don't look like a moron

^[Psycho]^

  • Level 5 Trained Intermediate
  • Posts: 101
  • Country:
  • <3 WCS :)
Re: Teleport
« Reply #16 on: July 17, 2010, 09:07:15 PM »
well post some stuff here, ignore those guys, if someone can work with that great if not then never mind just ignore
know what i mean?

necavi

  • Level 7 Expert
  • Posts: 260
  • WCSx Codeveloper
Re: Teleport
« Reply #17 on: July 17, 2010, 09:25:11 PM »
I would rather do it myself than be handfed, then again, I consider getting the code at all being handfed, if you are unable to implement it, or read and reverse engineer it, then there is no hope for you.

Muse

  • Level 7 Expert
  • Posts: 414
  • Country:
  • The lord of drunken bears, 102 lvl.
Re: Teleport
« Reply #18 on: July 17, 2010, 09:26:02 PM »
Oh, Does I said that this doesn't work bad?

Oh if I said forgive me all I doesn't wanted that.
Лет'с толк ин личку ин рашен.
Who`ll dare to face me?
I wanna spend all your money at the gay bar, gay bar, gay bar.
oh.. you touch my talala )

[Oddity]TeacherCreature

  • Moderator
  • Level 7 Expert
  • Posts: 1660
Re: Teleport
« Reply #19 on: July 17, 2010, 10:13:52 PM »
Well I appreciate you sharing Joshtrav and most of the community will, and if I use your code in next release I am sure many will be happy you shared.

You can not please everyone - just the way it is , but thanks again!

joshtrav

  • Level 7 Expert
  • Posts: 186
  • Country:
Re: Teleport
« Reply #20 on: July 18, 2010, 12:59:34 PM »
Just something for you guys to look at; this is how I would have done it with vecmath. It cuts the calls down no end. Also, there is very little "hacky" code in here.

Code: [Select]
import es
import vecmath
import cmdlib

# --------------------
# Teleport courtesy of:
#
# www.joinWCS.com
# 72.5.102.36:27015
#
# Credits:
# MaxLap
# joshtrav
#
# --------------------

def load():
    cmdlib.registerServerCommand("wcs_teleport", teleport_ultimate, "wcs_teleport <userid> <distance>")
   
def unload():
    cmdlib.unregisterServerCommand("wcs_teleport")

def teleport_ultimate(args, distance=None):
    if distance is None:
        userid, distance = map(int, args)
    else:
        userid, distance = args, distance
    if not es.exists("userid", userid):
        return
    es.prop_dynamic_create(userid, 'props_c17/tv_monitor01_screen.mdl')
    index = int(es.ServerVar("eventscripts_lastgive"))
    if index < 1:
        return
    view = vecmath.Vector(es.getindexprop(index, "CBaseEntity.m_vecOrigin"))
    es.remove(index)
    distance *= 3
    loc = vecmath.Vector(es.getplayerlocation(userid))
    vect = (view - loc) * 2
    cur_distance = vect.length()
    vect = vect.setlength(min(cur_distance, distance))
    if vect[2] > distance:
        vect[2] = distance
       
    maxhoriz = max((abs(vect[0]), abs(vect[1])))
    if maxhoriz > 2000:
        rat = 2000. / maxhoriz
        vect[0] *= rat
        vect[1] *= rat
           
    if vect[2] > 2000:
        vect[2] = 2000.0
    elif vect[2] < -2000:
        vect[2] = -2000.0

    cvel = [es.getplayerprop(userid, 'CCSPlayer.baseclass.localdata.m_vecVelocity[%s]' % x) for x in xrange(3)]
       
    nvect = [str((-cv + v) * .9852) for v, cv in zip(vect, cvel)]
    es.setplayerprop(userid,'CBasePlayer.localdata.m_vecBaseVelocity', ",".join(nvect))

This seemed to work on my box when I tested it.

Vecmath is awesome :D If you're ever dealing with vectors, I highly advise that you use it. Vecmath cut the lines from 104 -> 58 (well amongst other things too). This also uses cmdlib instead of es.regcmd(); but I suspect on your server you don't even register that command.

-freddukes

Just looked at the code, I could not from the iPhone.  However I did discuss this on the ES boards and the fact that lastgive is not reliable.  This could be wrong with the most current update but I doubt it considering the implementation of the wait command.  My way is strongly to due with the fact that lastgive is far from reliable and often returns the wrong value.

That will work great with "you", i.e., 1 player.  Try it in a full 40 man server, and watch it crash or individuals get teleported backwards, etc (places other peoples prop is created.)

I get that you want it simple, but its not going to be under the current engine.  I also tried forcing the cheat command via sourcemod and hooking the entity with SDKhook, and it still fails.  It requires at least a gameframe under optimum conditions to render that cheat command, the creation of the entity, and the teleport itself.  I highly suggest you test your method with more than just yourself in a test server as I have, and promise you it fails under the previous ES release, which according to a simple python check takes roughly the same amount of time to render and create that addon using a tick listener to check all props for the dynamic on a map like ace_comabatant in the current release. (Note, this is only tested by forcing a script that runs this for all userids on a test currently with a few dozen bots but still should be relatively equal.)

Good luck to you, but I will stick with a way that works for more than a single player on a large load.  If you want you can refer back to the thread that I already discussed this on the ES boards. 

Edit-
Also to point out for anyone concerned, one of the reasons our server is so well off is because we avoid commands such as:
Code: [Select]
es.remove()

-Edit
I will try to run a script on the main tomorrow creating props only and recording returns to see what happens, and compare to the SM log of OnEntityCreated and see how the logs differ or if they are equal with the timestamps and let you know.  But again, it doesn't seem to be solved on the test server.
« Last Edit: July 18, 2010, 01:10:06 PM by joshtrav »

[Oddity]TeacherCreature

  • Moderator
  • Level 7 Expert
  • Posts: 1660
Re: Teleport
« Reply #21 on: July 18, 2010, 06:37:01 PM »
I use sourcemod wcs and sdkhooks well
I have it working on my server ;)

joshtrav

  • Level 7 Expert
  • Posts: 186
  • Country:
Re: Teleport
« Reply #22 on: July 18, 2010, 06:59:52 PM »
I use sourcemod wcs and sdkhooks well
I have it working on my server ;)

you have what working oddity?

As fat as tele when I was in your server you were using the sm version whch from the code is viewangle plusba tracer to check for objects which is not similar or are you talking about onentitycreated?
« Last Edit: July 18, 2010, 07:34:24 PM by joshtrav »

[Oddity]TeacherCreature

  • Moderator
  • Level 7 Expert
  • Posts: 1660
Re: Teleport
« Reply #23 on: July 19, 2010, 01:15:11 AM »
NO I meant the tele with tracer for objects you had it right wasnt sure if u knew

I think that method is preferrable to the old teleport although I havent tried yours yet on, I was only on ur server once a while ago and tele wasnt working yet

joshtrav

  • Level 7 Expert
  • Posts: 186
  • Country:
Re: Teleport
« Reply #24 on: July 21, 2010, 08:00:54 PM »
NO I meant the tele with tracer for objects you had it right wasnt sure if u knew

I think that method is preferrable to the old teleport although I havent tried yours yet on, I was only on ur server once a while ago and tele wasnt working yet

It is really a toss up I think.  I like the old only because you can really aim your teleport so to speak.  Like you can angle it like the old days to get to a specific overhang or whatever.  I like yours as well because I think the actual teleport is pretty cool.

You could merge the too and grab the viewcoord from mine, run a tracer in SM to make sure you are in a wall and use a true teleport like yours.  That could be pretty cool.

[Oddity]TeacherCreature

  • Moderator
  • Level 7 Expert
  • Posts: 1660
Re: Teleport
« Reply #25 on: July 21, 2010, 10:26:56 PM »
i always hated the arcing push teleport of wcs so i am leaving mine.
it seemed to me like the original creator could do it right and it is a hacky version which bugged me.

Anyway thanks for sharing you should consider hte SM version if u are good at it
I have gotten a good taste of it and made 3 races in the last two days and soon will have full function server and I have yet to experience lag or crash, i think other than my own hard restarts the server hasnt crashed in a month someitmes between my starts is as long as like 4 or 5000 minutes  8)

Strickened

  • Level 1 Trained Beginner
  • Posts: 36
  • Country:
  • <3 WCS :)
Re: Teleport
« Reply #26 on: July 23, 2010, 02:34:15 PM »
Just started to create my own server, yes I'm a noob, I'm just asking how would you actually put this into your race database for human? I'm inexperienced with coding in this.

Thanks :).

EDIT: nvm, found solution @
Code: [Select]
http://warcraft-source.com/board/index.php/topic,10343.0.html
Thanks JT.
« Last Edit: July 23, 2010, 04:59:13 PM by Strickened »

Strickened

  • Level 1 Trained Beginner
  • Posts: 36
  • Country:
  • <3 WCS :)
Re: Teleport
« Reply #27 on: July 24, 2010, 11:43:06 AM »
Still can't get this teleport to work, I have done all as said:

Autoexec.cfg includes es_load joinwcs,
uploaded the joinwcs folder to eventscripts/,
changed the human skill4 to:
Code: [Select]
    "skill4_setting" "es_xset wcs_range 650;es_xset wcs_fadetimer 1|es_xset wcs_range 700;es_xset wcs_fadetimer 0.9|es_xset wcs_range 750;es_xset wcs_fadetimer 0.8|es_xset wcs_range 800;es_xset wcs_fadetimer 0.7|es_xset wcs_range 900;es_xset wcs_fadetimer 0.6|es_xset wcs_range 1000;es_xset wcs_fadetimer 0.5|es_xset wcs_range 1100;es_xset wcs_fadetimer 0.5|es_xset wcs_range 1200;es_xset wcs_fadetimer 0.5"
"skill4_cmd" "es wcs_teleport server_var(wcs_userid) server_var(wcs_range)"
"skill4_sfx" "0"
"ultimate_cooldown" "10"

It is still not working, any Ideas?

Thanks

Strickened

  • Level 1 Trained Beginner
  • Posts: 36
  • Country:
  • <3 WCS :)
Re: Teleport
« Reply #28 on: July 24, 2010, 02:40:16 PM »
Changed it from server_var(wcs_userid) to server_var(userid).

This stopped the crashing, but teleport is still not working.

[Oddity]TeacherCreature

  • Moderator
  • Level 7 Expert
  • Posts: 1660
Re: Teleport
« Reply #29 on: July 27, 2010, 06:56:50 AM »
changeing it isnt a fix u basically diabled it

mgith as well left it like me with error message :)