Hi all,
I was kinda wondering where I can find the code that I need to change to make a player teleport intstantly by just walking over the teleportentity (topdown view) instead of needing to press the alt (or any other key) at all.
Thanks in advance
*checks SVO code*
Open NetGore.sln
Goto
DemoGame.Server > World > Map > Entities > Character > User.cs
Find:
readonly UserStats _userStatsMod;
bool justWarped;
protected override void UpdatePreCollision(IMap map, int deltaTime) { // Update velocity UpdateVelocity(map,deltaTime);) }
Inside the procedure, after UpdateVelocity, Add:
OnMove();
Now, outside the procedure, Add:
protected void OnMove() { foreach (TeleportEntity warp in Map.DynamicEntities.OfType<TeleportEntity>()) { // If we're standing on a warp if (warp.Intersects(this)) { // And we weren't already on one... if (!justWarped) { // Warp, and check if we're on one! warp.Use(this); if (Map.DynamicEntities.OfType<TeleportEntity>().Any(newwarp => newwarp.IntersectsTD(this))) { justWarped = true; return; } justWarped = false; return; } return; } } //We looped through every warp without finding one we're standing on! justWarped = false; }
well I guess I was looking in the way wrong area I figured it would be client side since u hit a key and it should call an event o.o but then again the server maintains the characters position...
@ Shinsetsu I had the same idea. I have been looking at the client side for the key input and the as well. No wonder I couldn't find it
@ darkfrost thanks for your reaction, I will give it a go tonight
Hi darkfrost (or Skye) I tried the code you provided but I couldn't find
protected override void UpdatePreCollision(IMap map, int deltaTime) { // Update velocity UpdateVelocity(map,deltaTime);) }
Error 1 'DemoGame.Server.TeleportEntity' does not contain a definition for 'IntersectsTD' and no extension method 'IntersectsTD' accepting a first argument of type 'DemoGame.Server.TeleportEntity' could be found (are you missing a using directive or an assembly reference?)
Can it be that you forget to mention some code that needs to be changed/added aswell in addition to the code you provided??
Thanks again Dark for helping out
Check the overloads available for a DynamicEntity. I believe there is an OnCollideWith overload, or something like that.
That subs in there however its not in there as Protected Override void, I believe its in there as protected private void, then when u continue to work with it you being to get other errors.
I hope not. Otherwise, the code wouldn't compile. ![]()
I wouldn't be surprised if its protected virtual... that just means it can be overridden.
your right its virtual void
protected virtual void UpdatePreCollision(IMap map, int deltaTime) { // Update velocity UpdateVelocity(map, deltaTime); }
foreach (TeleportEntity warp in Map.DynamicEntities.OfType<TeleportEntity>())
2 errors
Map does not exist in this context
The type or namespace 'TeleportEntity' could not be found "Missing assembly reference?"
//We looped through every warp without finding one we're standing on! justWarped = false;
the name just warped does not exist in this context
now here is the interesting thing I only get the justwarped error on the last one but not the other 3... as for the second error It disappears if I change it to just Map.Entities.TeleportEntity()
however I havent used this long so Idk if that is the same thing... =/ guess i should spend less time watching shows in my freetime and actually try and crack netgore open =P
PART 2.
So i also tried changing it from virtual to override it got rid of all the error except I got a new one now its on where I changed it to override new error is no suitable method found to override o.o
Has anyone gotten this working without errors yet? How about a wiki how-to?
Well, I have ![]()
Not sure if I missesd anything, only other thing is
if (warp.IntersectsTD(this))
should be
if (warp.Intersects(this))
Sorry to bumb this one but is there no one who has an idea?? I have been looking for two days now.