Dropping Keycards
- konamikode
- Posts: 21
- Joined: Sat Oct 11, 2014 11:11 pm
Dropping Keycards
Hello! I want it that every time you take a teleporter, you lose all of the keycards you had.
(FYI I am using Doom in Hexen Format)
(FYI I am using Doom in Hexen Format)
RE: Dropping Keycards
I'm not sure if keys can be removed after being grabbed, but perhaps change the keys to inventory items and check for those at locked doors. Those can definitely be removed from the player's inventory.
RE: Dropping Keycards
What? Of course they can be removed. Just use takeinventory using acs.Fused wrote: I'm not sure if keys can be removed after being grabbed, but perhaps change the keys to inventory items and check for those at locked doors. Those can definitely be removed from the player's inventory.
<agaures> I'm guessing you haven't played many doom mods before huh? :p
<Zuplin> i have played master of puppets zombies doom center and a couple more
<agaures> so not many
<Zuplin> i thought that was everything
<Zuplin> i have played master of puppets zombies doom center and a couple more
<agaures> so not many
<Zuplin> i thought that was everything
RE: Dropping Keycards
Thanks for clarifying I guess. So if you have a teleporter, create a script that teleports him and also removed the keycards using takeinventory.
RE: Dropping Keycards
Maybe something like this for a global solution? Haven't tested but should work in theory..
Code: Select all
function int abs (int a)
{
if (a < 0)
return -a;
return a;
}
script 123 ENTER
{
int dx, dy, prevx, prevy;
while (true)
{
prevx = GetActorX (0);
prevy = GetActorY (0);
delay (1);
dx = GetActorX (0) - prevx;
dy = GetActorY (0) - prevy;
// Check if player moved faster than he is moving
if (abs (dx) > abs (GetActorVelX (0)) || abs (dy) > abs (GetActorVelY (0)))
{
TakeInventory ("RedCard", 1);
TakeInventory ("BlueCard", 1);
TakeInventory ("YellowCard", 1);
TakeInventory ("RedSkull", 1);
TakeInventory ("BlueSkull", 1);
TakeInventory ("YellowSkull", 1);
}
}
}
- Vincent(PDP)
- Forum Regular
- Posts: 527
- Joined: Thu Mar 14, 2013 7:35 pm
- Location: Sweden
- Clan: My DOOM site
- Clan Tag: <MDS>
- Contact:
RE: Dropping Keycards
In Zan 3.0 you should be able to use the A_CheckFlag DECORATE function to check if the TELEPORT flag is set.
But for now I'd go with Dusk's or Fused's solution.
But for now I'd go with Dusk's or Fused's solution.
- konamikode
- Posts: 21
- Joined: Sat Oct 11, 2014 11:11 pm
RE: Dropping Keycards
That just removes any keycard I grab.Dusk wrote: Maybe something like this for a global solution? Haven't tested but should work in theory..
Code: Select all
function int abs (int a) { if (a < 0) return -a; return a; } script 123 ENTER { int dx, dy, prevx, prevy; while (true) { prevx = GetActorX (0); prevy = GetActorY (0); delay (1); dx = GetActorX (0) - prevx; dy = GetActorY (0) - prevy; // Check if player moved faster than he is moving if (abs (dx) > abs (GetActorVelX (0)) || abs (dy) > abs (GetActorVelY (0))) { TakeInventory ("RedCard", 1); TakeInventory ("BlueCard", 1); TakeInventory ("YellowCard", 1); TakeInventory ("RedSkull", 1); TakeInventory ("BlueSkull", 1); TakeInventory ("YellowSkull", 1); } } }
- Vincent(PDP)
- Forum Regular
- Posts: 527
- Joined: Thu Mar 14, 2013 7:35 pm
- Location: Sweden
- Clan: My DOOM site
- Clan Tag: <MDS>
- Contact:
RE: Dropping Keycards
If the player's running speed is Doom's default then he is running about 10-15 mapunits/sec I think (without jumping or straferunning). If you measure his speed in different situations you can check if he moves alot faster than the greatest one of them. (Like if he moves faster than strafejumping and running at the same time). You should always also check the player's speed via GetActorProperty (and possibly multiply the highest value with it) to make sure that it not takes your keys just because you've uses the "turbo" command or got a turbosphere.
I'll see later if I can create a script for you.
I'll see later if I can create a script for you.
Last edited by Vincent(PDP) on Sat Jul 18, 2015 9:53 am, edited 1 time in total.