Forum Discussion

kiki01hun's avatar
kiki01hun
Seasoned Rookie
4 years ago

portal editor teleport and vectors

Hi there.
I tried to make a parachute deploy and set different ammo and health if the player is landed, but it never enters the if nor the else path. 

About the teleport function.. the error log says: can't teleport, it is out of bounds. I can't figure it out.

10 Replies

  • Matty101yttam's avatar
    Matty101yttam
    Seasoned Hotshot
    4 years ago

    couple of things i can think of..

    1st, the x/y/z position i think is in relation to the whole map, not just the areas that are in bounds, so it may be trying to teleport a player to 30,10 x/y coordinates but that's out of the play area.

    2nd, RandomReal allows for quite a few decimal places so it MAY be possible its teleporting beyond its limit, like it may allow for 3 decimal places but you spin up a random number like 1.665543, probably a low chance of that being the issue though

    3rd, wouldn't happen 100% of the time but there's a chance of spinning a number under 1, this would still put the players collision box partially out of bounds.

    I'd probably put my money on 1, if you display your co-ordinates on screen a lot of maps play areas start at about 50,50, so i'd set that as your lower limit for random real, it would also fix problem 3 if it ever occurs.

    Also the create vector function uses x,y,z but it looks like your using your z variable in the y co-ordinate, wouldn't hurt functionally but could cause you issues if you get them confused

    Lastly the ongoing event where your loadouts are, ongoing events need to have a condition and that condition needs to be toggled off at some point to be toggled on again. Another words if it happens at all currently it will only happen once. 

  • kiki01hun's avatar
    kiki01hun
    Seasoned Rookie
    4 years ago

    Okay. Every smaller map has it's own unique coordinate... nice.

    So.. how can i extract the player's default spawn coordinate from playerlocation?.

  • kiki01hun's avatar
    kiki01hun
    Seasoned Rookie
    4 years ago

    Okay. The teleport is working but i can't use bool varible as condition because if i set it to false or true, the error log says it gave a number to the and gate.

    If i use this:

    Setvariable enabled {true}

    Rule

    Condition AND {...}, {equals[getvar. enabled], [true]}

    Error log says can't compare number with a bool.

  • Matty101yttam's avatar
    Matty101yttam
    Seasoned Hotshot
    4 years ago

    default spawn co-ordinate can be found with getplayerstate-eventplayer-playerstatevector(set to position) put into an onplayerdeploy rule. 

    got a screenshot....or you can just copy paste the url up top of portal in here, can see it but cant change it that way.

  • Matty101yttam's avatar
    Matty101yttam
    Seasoned Hotshot
    4 years ago

    hmmm...just out of curiosity what makes you say you cant get/set variables as bool?

    Also looking at the logic, your trying to check the players distance from ground correct?

    I may be wrong but i THINK your currently your checking to see if the distance between the players position and 0,-1,0 is bigger than 50, since the downvector is a directional vector not a positional one, like i think it may as well be 0,0,0. If that's the case it's probably always going to be true.

    You may be better off checking if the getycomponent of your playerstate/position vector is > 50

  • kiki01hun's avatar
    kiki01hun
    Seasoned Rookie
    4 years ago

    Wow everything is working now.
    Look at the code now.
    I just have one question. I get this in the error logs.

  • Matty101yttam's avatar
    Matty101yttam
    Seasoned Hotshot
    4 years ago

    error seems to be trying to do something while the player isn't alive/in deploy screen, can only happen with the ongoing rules so i'd guess that if you also added whether the playerstatebool-isalive  to the condition of the ongoing rules it would stop anything happening while your dead/in deploy screen.

  • kiki01hun's avatar
    kiki01hun
    Seasoned Rookie
    4 years ago

    It is there, that's why i don't understand. There is no bool for isdeployed as far as i know.

  • Matty101yttam's avatar
    Matty101yttam
    Seasoned Hotshot
    4 years ago

    it's got me beat, the only other way i can think of is if you applied something to another player rather than yourself but i cant see anything like that in there either