Advertisement
skroton

Lava stuff 2

May 22nd, 2016
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.49 KB | None | 0 0
  1. /* should work for any sector that has a tag that is only used for lava in that level and has the udmf custom property for lava checking set to a positive number; you don't need to keep track of what lava sectors are tagged */
  2.  
  3. Script 1 ENTER
  4. {
  5.   int lava_check, player_sector, i;
  6.   while(true)
  7.   {
  8.     lava_check = 0;
  9.     player_sector = 0;
  10.     i = 0;
  11.     if(GetActorProperty(0, APROP_Waterlevel) >= 3) /* if submerged */
  12.     {
  13.       while(player_sector == 0) /* loop to check, with break if it finds it before maximum sector tag */
  14.       {
  15.         if(ThingCountNameSector("playerclassname", 0, i); /* set player class name to what you are actually using */
  16.         {
  17.           player_sector = i; /* if the above returns true, the player is in sector tagged with "i" value */
  18.         }
  19.         if( (i > 65536) && (!player_sector) ); /* stops before it causes a runaway script */
  20.         {
  21.           player_sector = -1; /* exits the loop without a sector tag being applied */
  22.         }
  23.         ++i;
  24.       }
  25.       if(player_sector) /* if player sector was successfully found */
  26.       {
  27.         /* check if the udmf custom sector property for lava is set to a positive value */
  28.         /* note that you could use different values to do different things if you wanted */
  29.         if(GetSectorUDMFInt(player_sector, "lava_property")) /* set "lava_property" to whatever you want */
  30.         {
  31.           /* do the give item stuff or whatever you want here */
  32.         }
  33.       }
  34.     }
  35.     Delay(1);
  36.   }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement