Chaosforge Forum

  • October 03, 2024, 14:11
  • Welcome, Guest
Please login or register.



Login with username, password and session length
Pages: [1] 2  All

Author Topic: A couple questions  (Read 18335 times)

Trar

  • Backer
  • Sergeant
  • *
  • *
  • Offline Offline
  • Posts: 98
  • dsvilsit.wav
    • View Profile
A couple questions
« on: March 29, 2013, 07:00 »

I'm looking to create a mod that modifies the enemies, weapons, pickups and consumables of DOOMRL, but not the levels. Basically, new stuff but no new levels (for now). Is this possible? I can't seem to find the tables for the original game stuff, so I can't modify them. Is it possible for me to find the tables that display the enemy, weapon and item (powerups and pickups) and mods in the game so I can modify them from there, or do I have to start from scratch? I was also wondering if you can re-name klasses. Thank you in advance.
Logged
0.9.9.7: Hell Knight 2nd Lieutenant
0.9.9.8: Former Human Lance Corporal

tehtmi

  • Programmer
  • Local Inquisitor
  • Lieutenant Colonel
  • *
  • *
  • Offline Offline
  • Posts: 458
    • View Profile
Re: A couple questions
« Reply #1 on: March 29, 2013, 11:47 »

All the basic things that you normally have access to in a module (cells, items, beings, etc) are declared in code that runs from doomrl.wad which is still closed source.  You can, however, still modify things after they are declared.  (This doesn't always work quite as you expect since the declaration functions do some processing.  Feel free to ask if something in particular isn't working.)  Prototypes stored in global tables indexed by both number id and string id.  For example, items are in "items" and beings are in "beings".  There's nothing preventing you from printing out the contents of these tables if you need more info.  In fact, I've attached a logging library (from my own module "inferno") should help with logging the contents of the tables (although I haven't bothered to make it print in the correct order).

Use this code to print out the contents of e.g. the items tables (replace MY_MODULE_NAME):
Code: [Select]
require "MY_MODULE_NAME:lib_item"
require "MY_MODULE_NAME:lib_being"
require "MY_MODULE_NAME:lib_log"

MY_MODULE_NAME.log = lib_log.make_log_function("lib_log")

for _, it in ipairs(items) do -- It may take a minute to print all this out.
  MY_MODULE_NAME.log(it)
end
Then check log.txt.

To actually modify stuff, just do e.g.
Code: [Select]
items.pistol.name = "my pistol" -- P.S., this doesn't work great for starting equipment

To create a game with all the basic levels, you want an "episode" type module.  Since you say "no new levels", the hooks you care about are OnCreateEpisode which sets up special levels and the over all path of the game, and OnGenerate which creates random levels.  If you don't want to do anything special, you can just call DoomRL.CreateEpisode() and DoomRL.OnGenerate() respectively.

Edit:
Apparently you can't call DoomRL.CreateEpisode, but you can still replicate it pretty closely.  See here
« Last Edit: March 29, 2013, 12:37 by tehtmi »
Logged

Trar

  • Backer
  • Sergeant
  • *
  • *
  • Offline Offline
  • Posts: 98
  • dsvilsit.wav
    • View Profile
Re: A couple questions
« Reply #2 on: April 01, 2013, 11:13 »

Thanks for the info and files. However, I was looking for the original stats for the items and beings in DOOMRL. I was wondering if you could, er, 'loan' them to me. If that's not possible I can make up my own stats, but I'm really looking to make modified versions of the vanilla stuff.
« Last Edit: April 01, 2013, 11:16 by Trar »
Logged
0.9.9.7: Hell Knight 2nd Lieutenant
0.9.9.8: Former Human Lance Corporal

shark20061

  • Programmer
  • Elder Chaos Guard
  • Captain
  • *
  • *
  • Offline Offline
  • Posts: 266
    • View Profile
Re: A couple questions
« Reply #3 on: April 01, 2013, 18:59 »

Most stats should be on the wiki, but you can also just use a value directly while registering your item:
Code: [Select]
register_item "yourid" {
  ...
  <item_property> = items.<itemid>.<desiredproperty>,
  ...
}

or after registering the item:
Code: [Select]
items.yourid.<item_property> = items.<itemid>.<desiredproperty>

This should work for most properties.
Logged
Hell Knight Warrant Officer (0.9.9.4)  [26!/8/3/1/0]

Mancubus 2nd Lieutenant (0.9.9.6)  [22/12/3/0/0]
M:16 S:43 (126) A:17

shark20061

  • Programmer
  • Elder Chaos Guard
  • Captain
  • *
  • *
  • Offline Offline
  • Posts: 266
    • View Profile
Re: A couple questions
« Reply #4 on: April 01, 2013, 19:08 »

...you can just call DoomRL.CreateEpisode()

Edit:
Apparently you can't call DoomRL.CreateEpisode, but you can still replicate it pretty closely.  See here
Isn't it DoomRL.OnCreateEpisode()?
Logged
Hell Knight Warrant Officer (0.9.9.4)  [26!/8/3/1/0]

Mancubus 2nd Lieutenant (0.9.9.6)  [22/12/3/0/0]
M:16 S:43 (126) A:17

tehtmi

  • Programmer
  • Local Inquisitor
  • Lieutenant Colonel
  • *
  • *
  • Offline Offline
  • Posts: 458
    • View Profile
Re: A couple questions
« Reply #5 on: April 01, 2013, 20:46 »

Isn't it DoomRL.OnCreateEpisode()?

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

SPTX

  • Sergeant
  • *
  • Offline Offline
  • Posts: 77
  • Lost Soul
    • View Profile
Re: A couple questions
« Reply #6 on: April 02, 2013, 01:56 »

Ah! I no longer have to worry about that then.
Logged

Trar

  • Backer
  • Sergeant
  • *
  • *
  • Offline Offline
  • Posts: 98
  • dsvilsit.wav
    • View Profile
Re: A couple questions
« Reply #7 on: April 02, 2013, 13:36 »

Again, thank you. Feel a bit embarrassed that most of the stats were on the wiki to begin with, though...
Logged
0.9.9.7: Hell Knight 2nd Lieutenant
0.9.9.8: Former Human Lance Corporal

SPTX

  • Sergeant
  • *
  • Offline Offline
  • Posts: 77
  • Lost Soul
    • View Profile
Re: A couple questions
« Reply #8 on: April 04, 2013, 09:53 »

I have this :
Code: [Select]
function Repercussions.OnLoaded()
ui.msg_choice("Do you want to become a Lost Soul(S) or a Former Human(H)?","SH")
if ui.msg_choice == "S" then player.eq[SLOT_WEAPON] = "SPTXlostsoul"
elseif ui.msg_choice == "H" then player.eq[SLOT_WEAPON] = "SPTXformerhuman"
end end
However the procedures aren't executed when chosen. What am I doing wrong?

Note that the player.eq[SLOT_WEAPON] procedures work properly when used alone. Is ui.msg_choice really returning S or H?
I tried with
Code: [Select]
if ui.msg_choice("Do you want to become a Lost Soul(S) or a Former Human(H)?","SH") == "S" then player.eq[SLOT_WEAPON] = "SPTXlostsoul"which yielded the same non-result.

Also, how do I put characters in bold (like the mod install asks with armor boots weapon [abw])?
Logged

shark20061

  • Programmer
  • Elder Chaos Guard
  • Captain
  • *
  • *
  • Offline Offline
  • Posts: 266
    • View Profile
Re: A couple questions
« Reply #9 on: April 04, 2013, 20:35 »

I have this :
Code: [Select]
function Repercussions.OnLoaded()
ui.msg_choice("Do you want to become a Lost Soul(S) or a Former Human(H)?","SH")
if ui.msg_choice == "S" then player.eq[SLOT_WEAPON] = "SPTXlostsoul"
elseif ui.msg_choice == "H" then player.eq[SLOT_WEAPON] = "SPTXformerhuman"
end end
However the procedures aren't executed when chosen. What am I doing wrong?

Note that the player.eq[SLOT_WEAPON] procedures work properly when used alone. Is ui.msg_choice really returning S or H?
I tried with
Code: [Select]
if ui.msg_choice("Do you want to become a Lost Soul(S) or a Former Human(H)?","SH") == "S" then player.eq[SLOT_WEAPON] = "SPTXlostsoul"which yielded the same non-result.

Maybe it doesn't like the uppercase letters.  Try lowercase letters for the choice.

Also, how do I put characters in bold (like the mod install asks with armor boots weapon [abw])?

Use "@<" to make the text bolder and "@>" to stop bolding.

Code: [Select]
"Do you want to become a Lost @<S@>oul or a Former @<H@>uman?"
Logged
Hell Knight Warrant Officer (0.9.9.4)  [26!/8/3/1/0]

Mancubus 2nd Lieutenant (0.9.9.6)  [22/12/3/0/0]
M:16 S:43 (126) A:17

tehtmi

  • Programmer
  • Local Inquisitor
  • Lieutenant Colonel
  • *
  • *
  • Offline Offline
  • Posts: 458
    • View Profile
Re: A couple questions
« Reply #10 on: April 04, 2013, 20:52 »

I have this :
...
However the procedures aren't executed when chosen. What am I doing wrong?
This isn't working because you aren't storing the return value of the function call, you are comparing the function itself.

Quote
I tried with
Code: [Select]
if ui.msg_choice("Do you want to become a Lost Soul(S) or a Former Human(H)?","SH") == "S" then player.eq[SLOT_WEAPON] = "SPTXlostsoul"

This is working for me (although there is no end statement).  Are you sure it isn't something else that is wrong?
Logged

SPTX

  • Sergeant
  • *
  • Offline Offline
  • Posts: 77
  • Lost Soul
    • View Profile
Re: A couple questions
« Reply #11 on: April 05, 2013, 02:48 »

This isn't working because you aren't storing the return value of the function call, you are comparing the function itself.
This is working for me (although there is no end statement).  Are you sure it isn't something else that is wrong?
I just tried again and it worked, can't tell what I did wrong the first time since I erased it. However since I use "if" I have to print the text twice (and make the choice twice) which makes the use of msg_choice useless compared to msg_confirm.
I'll use this until I can figure out something more... elegant.

Speaking of it, I don't seehow to return the value from the function call after calling it.

Use "@<" to make the text bolder and "@>" to stop bolding.
Code: [Select]
"Do you want to become a Lost @<S@>oul or a Former @<H@>uman?"
Wonderful, thanks. How come I didn't find anything about it on the internet, is it exclusive to the Pascal engine?

Side question : I'll need to check which weapon has been equipped later-on. How do?
« Last Edit: April 05, 2013, 03:25 by SPTX »
Logged

tehtmi

  • Programmer
  • Local Inquisitor
  • Lieutenant Colonel
  • *
  • *
  • Offline Offline
  • Posts: 458
    • View Profile
Re: A couple questions
« Reply #12 on: April 05, 2013, 20:57 »

Speaking of it, I don't seehow to return the value from the function call after calling it.
This is probably what you want:
Code: [Select]
function Repercussions.OnLoaded()
  local choice = ui.msg_choice("Do you want to become a Lost Soul(S) or a Former Human(H)?","SH")
  if choice == "S" then
    player.eq.weapon = "SPTXlostsoul" -- SLOT_WEAPON works as well, but this is the more standard way
  elseif choice == "H" then
    player.eq.weapon = "SPTXformerhuman"
  end
end

Quote
How come I didn't find anything about it on the internet, is it exclusive to the Pascal engine?
I believe this is valkyrie (the chaosforge-roguelike-pascal library) specific.  P.S. there are codes to switch to any color http://doom.chaosforge.org/wiki/Modding:Color

Quote
Side question : I'll need to check which weapon has been equipped later-on. How do?
Example
Code: [Select]
-- make sure the player has a weapon at all (will be nil if nothing is equipped)
if player.eq.weapon then
  if player.eq.weapon.id == "SPTXlostsoul" then
    do_one_thing()
  elseif player.eq.weapon.id == "SPTXformerhuman" then
    do_another_thing()
  end
end 
Logged

SPTX

  • Sergeant
  • *
  • Offline Offline
  • Posts: 77
  • Lost Soul
    • View Profile
Re: A couple questions
« Reply #13 on: April 08, 2013, 03:42 »

Perfect, thanks.

Now about these melee attacks I talked about earlier (maybe not ITT). How are they called by the game? I am talking about the melee attacks or non-melee monsters and the player when he has a weapon equipped. When bumping into other beings.

I basically need to change the default 1d3 given by fists.
Do fists have an ID? "fists" or items.fists doesn't seem to work.
« Last Edit: April 11, 2013, 16:42 by SPTX »
Logged

Equality

  • Second Lieutenant
  • *
  • Offline Offline
  • Posts: 174
  • Lost Soul
    • View Profile
Re: A couple questions
« Reply #14 on: April 14, 2013, 02:51 »

What are proper sizes of properties variables?
From wiki,

armor
durability
ammo
ammomax
res_bullet (and res_melee and so on)
movemod, knockmod and (undocumented) dodgemod

all are integers. Far from it! When created a new instance of item object,
armor - byte
durability - word
ammo, ammomax - word
resistances, movemod, knockmod - signed doubleword

well, for most cases no matter what is it - from 0 to 250 quite enough. But what about level depth? danger level? Hp and hpmax? Who knows?
Logged
Once advanced DoomRL player
Find mysterious sword Dragonslayer
Say "Best thing ever found!" and start jumping around...
But he can't get the sword from the ground
Pages: [1] 2  All