Chaosforge Forum

  • January 28, 2022, 14:41
  • Welcome, Guest
Please login or register.



Login with username, password and session length

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - tehtmi

Pages: 1 [2] 3 4 ... 25
16
Bug Reports / Re: [0.9.9.7G] Apostle error
« on: April 03, 2013, 05:05 »
Fixed, thanks for the bug report.

17
Modding / Re: About traits, doc needed
« on: April 03, 2013, 04:51 »
The ironman bonus is actually
Code: [Select]
math.floor(0.2 * player.hpnom)
although I think AoHu is the only thing that changes hpnom.

I have to agree with yaf about adding and subtracting hp instead of setting it, especially if you want to later reverse the affect.  Remember that there are items that can affect hpmax, and nothing is keeping track of them.  You can calculate the target value you want, and then keep track of the delta so you can reverse it later.

18
Modding / Re: Changing the ammo system?
« on: April 03, 2013, 04:45 »
I also have another question: From experimentation it seems that a being's scount can become negative without causing errors. What's the lowest value that it can be safely set to? Or are negative values not intended to be used at all?
Scount is a 32-bit signed integer, so it can be as small as -2147483648.  I found one bug relating to the player having a negative scount however.  It may not occur very much in practice because it only happens on the player's turn (when the player's scount will usually be positive).

Quote
EDIT2: Could I have an up to date list of the names of the ally prototype fields? When I use the values from the wiki, it doesn't recognise some of them.

Ally?  I'm not sure what you're referring to.

19
Modding / Re: A couple questions
« on: April 01, 2013, 20:46 »
Isn't it DoomRL.OnCreateEpisode()?

Ah, yes.  It does work after all.  Good catch!

20
Modding / Re: Changing the ammo system?
« on: March 31, 2013, 11:53 »
The rocket launcher is able to get away with this because it only changes the missile which nothing else really modifies.

If you are worried about modding, I think you could fix this by using a custom item property to keep track of which mode the weapon is in.  In OnFire and OnFired, you can subtract 3 shots and add 3 accuracy, but only if the weapon is in "alt-fire-mode", and in OnAltFire you can add 3 shots and subtract 3 accuracy, but only if the weapon is in "normal-mode".  It still isn't perfect because the effect of a mod sometimes depends on the item's current stats which may be in either mode, so you could also try resetting the stats to normal mode in OnEquipTick.

21
Modding / Re: Changing the ammo system?
« on: March 30, 2013, 21:11 »
Doesn't seem to work by simply doing that.

It looks like changing it on the fly won't work because the current implementation only checks the flag when the thing is loaded.  It might be hard to do for the player at all because of how early the player is loaded.

22
Modding / Re: Changing the ammo system?
« on: March 30, 2013, 17:31 »
I need to see how a sprite of a size bigger than one tile is handled. When I try to use them, they are cropped from their upper left corner to one tile.

Give a being (or item) the flag F_LARGE to allow for an oversized sprite.

23
Modding / Re: Changing the ammo system?
« on: March 30, 2013, 17:18 »
1. I have a missile defined with the MF_RAY flag set, but the game seems to ignore that and still draws a bullet travelling across the screen. It works in console mode however - has the flag become deprecated since graphics were introduced?
I wouldn't say it is deprecated, just not supported in graphics mode yet.

Quote
2. Is there a list of sprites somewhere? I don't know the names of any of the missile sprites, so I've had to put in random sprites that I do know for now. Although I suppose there is something to be said for a shotgun that shoots shotguns...

Here's all the sprite constants that are declared; use them.  (Spoilered for length)
Spoiler (click to show/hide)
Alternatively, you could also just copy the values from things you know like beings.imp.sprite.

Quote
3. I've been trying to change the missile property of a weapons using the OnFire hook, but I always get an error when I try to assign it - what should the assignment look like?
The value needs to be the number id of the missile.  Number ids are subject to change between versions, so you should translate from the string id e.g.
Code: [Select]
  it.missile = missiles.mgun.nid
  -- or
  it.missile = missiles[string_id].nid

Quote
4. This is just out of interest, for now: I notice that calling Player:power_backpack() reshuffles the player's ammo stacks. Is there any way to do this without also turning the backpack on? It would be quite a handy feature.
Honestly, I suspect there are still bugs in power_backpack ;)  But no, I'm not aware of any other code that resorts the inventory like this; it is tied together with the backpack flag.

24
1. How are the monster's melee attack handled?
Monster melee attacks work exactly the same as the player's default fists attack; they do 1d3 damage plus any bonuses.  The only bonus is typically the monster's todam modifier (which only applies to melee attacks as opposed to todamall).

Quote
2. is there any parameter that defines the aggressive behaviour or monsters toward the player? I'd want to invert that behaviour (friendly monsters attacking other monsters)

The built-in AIs don't really have support for this.  You can either write your own AI or try to hack the built-in AI; probably writing a new one is simpler as long as you don't need it to be very complex.

25
Modding / Re: Changing the ammo system?
« on: March 30, 2013, 10:10 »
I tried looking through the inventory like this:
The "return false" needs to be outside the loop for this to work as you intended.  You may also need to manually :destroy() the item when its ammo reaches 0, but I'm not 100% sure.

26
To add a flag do
Code: [Select]
player.flags[BF_ENVIROSAFE] = true
If you are doing this in OnEquip, OnRemove, it is possible for there to be strange interactions.  For example, the player can equip your item, then equip the phaseshift set which also grants to the flag.  Then if the player unequips the phaseshift set, that will remove the flag even though your item is still equipped.  The only reason the phaseshift wet works is that there is no other way of changing this flag.  The classic way of solving this problem is to do something like
Code: [Select]
OnEquip(self, player)
  if not player:has_property("envirosafe") then
    player:add_property("envirosafe", 0)
  end
  player.envirosafe = player.envirosafe + 1
  player.flags[BF_ENVIROSAFE] = true
end,
...
OnRemove(self, player)
  if not player:has_property("envirosafe") then
    player:add_property("envirosafe", 0)
  end
  player.envirosafe = player.envirosafe - 1
  if player.envirosafe <= 0 then
    player.flags[BF_ENVIROSAFE] = false
  end
end,
However, this requires all things modifying this flag to use this protocol.  Or you can just ignore it since it's usually an edge case.

damage_add is a valid item property that just effects that particular item.  The corresponding prototype property isn't accepted by the blueprint because it is intended to be parsed from the damage string, as you discovered.

Weapon resistances are used in DoomRL by the Acid Spitter, so they are officially supported (if not widely used).

27
Modding / Re: Changing the ammo system?
« on: March 29, 2013, 21:14 »
...what's the property name of "fire" on a weapon? The wiki says "usetime", but I've tried both "usetime" and just "fire" and I get a lua error saying I'm reading an undeclared variable.
"fire" is the name of the prototype property and "usetime" is the object property.  If the Lua error is for an undeclared variable, the problem could be the context you are using it in, as that doesn't sound like an error you'd get when declaring an item.  I'd have to see what you're doing.

Quote
Also, how are OnAltFire hooks for scripted alt fire modes meant to be used. Should I temporarily alter the stats of the weapon and then change them back in the OnFired hook, or is that completely wrong?

OnAltFire is called when you use altfire = ALT_SCRIPT.  I don't consider this to be very mature yet, as most of DoomRL alternate fire modes are not implemented in Lua.  However, what you suggest sounds like the best way to do it to me.  DoomRL's rocket launcher actually uses OnFire to switch the stats back, but I think OnFired would generally work better.

Quote
I know the lua files for the main game aren't being released yet, but have you considered including an example file with each release containing the definitions for one or two items of each type, and perhaps the ai for one or two enemies? ...
This would probably be good, but I'd have to go through Kornel to get permission about what we can post.

Quote
how do I access the player's inventory? I want to go through it to check if a particular kind of ammo is present - I'm trying to make a weapon that draws ammo directly from the inventory.

Currently the only real access seems to be through the inventory iterator
Code: [Select]
for it in player.inv:items() do
  print(it.name)
end
The order they are stored in is undefined (i.e. should not be relied upon).  The rest of the inventory API would be .inv:empty() (this is a predicate), .inv:clear(), .inv:add(it, [params])

28
2. I intend to make a(some) new klasse(s), with their own traits, but I can't get my hands on any source of either klass or trait to see how they are made.

Sorry, I think klass and trait modification isn't really supported in the current version.

29
Ah, sorry.  I'm running in the dev environment, so I guess that's not allowed normally.  The example provided by classic.module should show you how to get a basic episode.  All that really remains is to add the special levels, which I believe are still available even in the normal environment.

classic.module shows how to do "script" levels that replace basic levels.  To add special stairs to a level (this is partly a function of the generator), do e.g.:
Code: [Select]
player.episode[2].special = "hells_arena"

The ids of the special levels are more or less what you would expect, but you can print out the "levels" table to check.

30
Isn't there a way to just call for the default one?

You can call DoomRL.OnCreateEpisode in the OnCreateEpisode hook to create the default episode (and use DoomRL.OnGenerate to use the default generator).

Pages: 1 [2] 3 4 ... 25