Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Đeⓧiaz

"Limited use" Map Scanner?

Question

Posted (edited)

Hello again.

 

Few days ago I've asked for help with spawning Automap on every map (thanks guys, who helped here!)

 

And I changed my mind with this concept and got new problems. I've decided to make an automap scanner which reveals enemies on map. You can bring it on every level but it will use some "energy points" like items from Build Engine games (night visor, jetpack, etc).

 

I've remembered that Samsara uses jetpack and night visor for Duke' character, so I decided to reuse this script to make my Automap Scanner. And I've failed (heh)

 

I won't place my code just because it's a stealed mess... ingame I can spawn it on map, pickup it, choose it in inventory and...nothing. I can't use it. The game just don't let me use this item.

 

Looks like I need to use ZScript instead of Decorate+ACS, but I never learned to use ZScript so I suck here absolutely.

 

Any help will be extremely appreciated. Thanks in advance.

Share this post


Link to post

12 answers to this question

Recommended Posts

  • 0

em... how can we help if we cannot see what you're doing? also, it is absolutely impossible to show monsters on automap with scripting (zscript aside, i don't know it enough).

Share this post


Link to post
  • 0
Posted (edited)

shit. my bad. i never remember about Strife and its goodies. sorry. ;-)

 

still, it is hard to help without seeing your actual code.

Share this post


Link to post
  • 0
16 hours ago, ketmar said:

it is hard to help without seeing your actual code

 

Oh gosh. Ok, since you insist:

ACTOR Allmap1 : MapRevealer
{
  +COUNTITEM
  +INVENTORY.FANCYPICKUPSOUND
  +INVENTORY.ALWAYSPICKUP
  Inventory.MaxAmount 0
  Inventory.PickupSound "misc/p_pkup"
  Inventory.PickupMessage "$GOTMAP" // "Computer Area Map"
  States
  {
  Spawn:
    PMAP ABCDCB 6 Bright
    Loop
  }
}

actor DoomScanner : PowerupGiver
{
  powerup.type "PowerScanner"
  Powerup.Duration 0x7FFFFFFF
  states
  {
  Spawn:
    TNT1 A 1
    stop
  }
}

actor Boolean: Inventory
{
    Inventory.MaxAmount 1
    +UNDROPPABLE
    -INVBAR
}

actor Counter: Inventory
{
    Inventory.MaxAmount 0x7FFFFFFF
    +UNDROPPABLE
    -INVBAR
}

actor RadarUsing: Boolean {}
actor RadarFuel: Counter { Inventory.MaxAmount 100 }

actor DukePortJetpack : CustomInventory
{
    +INVBAR
    +INVENTORY.UNDROPPABLE
	+INVENTORY.FANCYPICKUPSOUND
    +INVENTORY.ALWAYSPICKUP
    +inventory.hubpower
    Inventory.PickupMessage "Map with scanner!"
	Inventory.PickupSound "misc/p_pkup"
    Inventory.MaxAmount 1
    States
    {
      Spawn:
        PMAP ABCDCB 6 Bright
        loop
		
	Pickup:
    TNT1 A 1 A_GiveInventory ("Allmap1")
    stop	

      Use:
        TNT1 A 0 A_JumpIfInventory("RadarFuel",1,"CanStartFlying")
        fail

      CanStartFlying:
        TNT1 A 0 A_JumpIfInventory("RadarUsing",1,"IsFlying")

      NotFlying:
        TNT1 A 0 A_GiveInventory("RadarUsing", 1)
        TNT1 A 0 A_GiveInventory("PowerScanner", 1)
        TNT1 A 1 ACS_ExecuteAlways(214,0,1)
        fail

      IsFlying:
        TNT1 A 1 A_TakeInventory("RadarUsing", 1)
        TNT1 A 1 A_TakeInventory("RadarFuel", 1)
        TNT1 A 1 A_TakeInventory("PowerScanner", 1)
        TNT1 A 15
        fail
    }
}

 

Share this post


Link to post
  • 0
Posted (edited)

ok, that is something we can work with. ;-)

 

sadly, ZDoom decorate for inventory is severely flawed: inventory `Held` state is "inventory thinker", but you cannot manipulate owner's inventory in that state. if only we had AAPTR_OWNER... but "design" and "ZDoom" are completely unrelated things. so, you need to implement it with DECORATE+ACS.

 

first, your Scanner powerup giver should last something around 35 tics (or how much one scanner cell can give). this is so it can expire, because it is quite hard to take away a powerup. ;-) we let the engine do it for us.

 

now, in `Pickup` state of your inventory item you have to call ACS method (you'd better use `ACS_ExecuteAlwaysNamed()` there, so you won't have script number conflicts).

 

also, you have to have a boolean "Scanner is active" hidden inventory item; it will work as a flag for ACS script. in `Use`, check if that item is in the inventory, and if it is there, take it away; if it is not there, give it. all other logic is in ACS script you spawned earlier;

 

in that ACS, you should do this (warning! the code is completely untested, and may not event compile!)

 

script "MyScannerInnerScript" {
  // if our "main" inventory item somehow disappeared, stop the script
  while (CheckInventory("MyScannerItem")) {
    // check if scanner is active (MyScannerActiveFlag item is managed by DECORATE)
    if (CheckInventory("MyScannerActiveFlag")) {
      // check if we have any cells left
      if (CheckInventory("MyScannerCell")) {
        // take out one cell
        TakeInventory("MyScannerCell", 1) {
        // this is our powerupgiver with 35 tics duration
        // activate it, because we just "charged" it with a cell
        GiveInventory("MyScannerPowerup", 1);
      }
    }
    // sleep for 35 tics (i.e. until our scanning powerup expires)
    Delay(35);
  }
}

 

Share this post


Link to post
  • 0
Posted (edited)

now, you definitely did something wrong. upload your pk3 then. did you forgot to put your ACS code into a library and load it with "loadacs"? you have to manually compile ACS code, put the resulting .o file in acs/ directory of your pk3, and put its name into "loadacs" lump, otherwise it won't be loaded.

 

p.s.: sorry for asking for such simple things, but sometimes shit happens. ;-)

Share this post


Link to post
  • 0
Posted (edited)

Sorry, but no. I can't upload it, the mod itself is the secret project (like most my previous mods, to be honest). And I won't delete all other stuff just because to upload it for alpha testing purposes.

 

If you want a pk3 with mentioned decorate codes and acs inside - just copy my decorate code from previous message and add your acs code inside the file. I can't say nothing more.

Share this post


Link to post
  • 0

no, i don't need to debug my code. as you don't want to provide your code to debug, i guess that's where we came to a dead end. you have to solve the problem by yourself then.

Share this post


Link to post
  • 0

I've already provided my code earlier, check previous messages again. So if you're thinking that your code is awesome so fix my decorate code. Same situation, opposite direction.

Share this post


Link to post
  • 0

Alright, seasoned veteran of inventory items here (yeah right).

 

First of all, when using an inventory item, frame delays will be completely ignored so you will want to move the current code to ACS. Also, any empty frame should be either deleted or have a codepointer assigned, which can be A_RailWait (which does absolutely nothing). That's all i can suggest by looking at the code you gave.

 

Also, you can just send the .pk3 via a private message. By the way, it's not like someone would go nuts when they find out what's your secret project early on "OH fiddlesticks, i saw what was Dexiaz's secret project and now i can't unsee it! Damn now my whole life is destroyed, excuse me while i go kill myself"

Share this post


Link to post
  • 0
Posted (edited)

I've just asked for advice/help with exotic coding situation, not for your opinion about my policy about my mods. That's kinda rude, so don't think that I will react to this positively somehow.

 

You won't help me? Ok, fine, it's always was a voluntary topic.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×