DoomRL > Modding
Can we have tutorial on how to make a the main.lua file?
tehtmi:
--- Quote from: SPTX on March 29, 2013, 12:50 ---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.
--- End quote ---
Sorry, I think klass and trait modification isn't really supported in the current version.
SPTX:
That is sad. And what about the sprites?
EDIT :
I have an other issue :
--- Code: --- function OnEquip()
player.res_fire = player.res_fire+25
player.movetime = player.movetime+5
function OnRemove()
player.res_fire = player.res_fire-25 end end
--- End code ---
It says "expected ( near OnEquip". It seems to be a syntax error, but I just don't get it. The code is inserted into an weapon type item. My objective was to change the player stats according to the equipped weapon and revert if unequipped.
Can we have the sources for player emitted sounds too? I also need a way to override default player melee attack (when you bump into a monster without an equipped melee weapon or with an equipped ranged weapon).
I also wanted to prevent weapon switching, I think that can be achieved looping the player:quick_weapon function with the weapon I want to keep in hand as the ID.
EDIT 2 : On a side note, the field "damage_add" doesn't seem to be valid anymore on items, so I added +1 to my dice roll (1d3+1). It appears ingame and works.
yaflhdztioxo:
Okay, that's a register_item you've spliced code out of right?
Proper syntax is:
--- Code: ---
OnEquip = function (self,being)
your_actions
end,
--- End code ---
Damage_Add is still a valid item attribute. I've manipulated it in 0997 with success before. Other options for boosting damage on equip would be adjusting the player's todamall trait.
Now for critiques. Why are you adding these adjustments to the OnEquip hook when you can just modify the item directly? You are also increasing/decreasing attributes by fixed amounts. For resistances I *think* that's the right way to do it but for movetime it NEEDS to be a multiplier (player.movetime = player.movetime * 1.05). If you don't do this the math gets wonky fast and can easily be exploited for good or for ill.
Player sounds may or may not be modifiable. The sound engine is still one of the weak spots in DoomRL modding. IF they can be changed it would be with this code:
--- Code: ---beings["soldier"].sound_melee = core.resolve_sound_id("your_sound")
--- End code ---
You can reuse another being's sound by replacing "your_sound" with their sound name. For instance, "soldier.melee" would be the player's default punching noise. If you have a custom sound in your /sound directory then you would replace "your_sound" with its extension-less name.
As for quick_weapon that cannot be abused. Only cursed weapons block the equip/unequip logic.
SPTX:
--- Quote from: yaflhdztioxo on March 30, 2013, 05:54 ---Proper syntax is:
--- Code: ---
OnEquip = function (self,being)
your_actions
end,
--- End code ---
--- End quote ---
Thanks I am trying that right away.
EDIT : alright this works however I can't make more than one function to work on an item, when I try to put a second one, like for :
--- Code: --- OnEquip = function (self,player)
player.res_acid = player.res_acid+50 end
OnRemove = function (self,player)
player.res_acid = player.res_acid-50 end
--- End code ---
The crashlog tells me that the last line of the second one (where I remove the res bonus) is expected to close my whole item declaration even though neither notepad++ nor I see a syntax error.
here I just changed the enabled functions but the issue is still the same (second function in order fucking up)
Embedding the second function in the first allows the game to launch but will ultimately cause an error on use.
--------------------------
--- Quote ---Damage_Add is still a valid item attribute. I've manipulated it in 0997 with success before. Other options for boosting damage on equip would be adjusting the player's todamall trait.
--- End quote ---
Don't know why, it just did not accept damage_add, unless it takes upper casing into account, I don't think I made a mistake. Also I don't want to boost the overall player damage, just the weapons, so the "XdY+Z" notation is perfect.
--- Quote ---Now for critiques. Why are you adding these adjustments to the OnEquip hook when you can just modify the item directly?
--- End quote ---
For damage I don't, that's is unrelated. Sorry if I was not clear about it. I do this for the later (resistances), which aren't handled by weapons.
--- Quote ---You are also increasing/decreasing attributes by fixed amounts. For resistances I *think* that's the right way to do it but for movetime it NEEDS to be a multiplier (player.movetime = player.movetime * 1.05). If you don't do this the math gets wonky fast and can easily be exploited for good or for ill.
--- End quote ---
That clears some things up, thanks.
Player sounds may or may not be modifiable. The sound engine is still one of the weak spots in DoomRL modding. IF they can be changed it would be with this code:
--- Code: ---beings["soldier"].sound_melee = core.resolve_sound_id("your_sound")
--- End code ---
You can reuse another being's sound by replacing "your_sound" with their sound name. For instance, "soldier.melee" would be the player's default punching noise. If you have a custom sound in your /sound directory then you would replace "your_sound" with its extension-less name.[/quote]
I'll try that, however I noticed the sound_ID were different from the actual sound file names eg : the ID for the shotgun fire is "shotgun" but the filename is "dsshotgn". How does the game differentiate ID from filename?
--- Quote ---As for quick_weapon that cannot be abused. Only cursed weapons block the equip/unequip logic.
--- End quote ---
My aim isn't to prevent the weapon from just being unequipped but also to prevent the player from changing weapon at all, ie : note being able to switch to the "prepared" slot.
yaflhdztioxo:
You are missing a comma. The functions are just like the other attributes--they must be comma delimited.
I don't actually know if it is case sensitive. I don't think so. Never thought about it, which is a failing on my part really.
Weapons do in fact have resistance attributes. I do not know if they have any effect though; must research. If not, well there are ways to go about hacking it in, and you've found one so that's fine (unless teht knows better)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version