Page 10 of 396
Re: Ask a simple question, get a simple answer
Posted: Wed Nov 05, 2014 10:23 pm
by Trollmann
Can someone help with creating custom items? I've started working on a dungeon with new models and item icons etc. but I have no idea how to set things up in Grimrock II.
It seems cloneObject isn't working the way it did in Grimrock I, and if I try to manually set stats etc. I just mess the dungeon up so it wont load anylonger.
Thanks in advance!
Re: Ask a simple question, get a simple answer
Posted: Wed Nov 05, 2014 11:54 pm
by Matlock19
Expanding on Trollman's question:
Could someone show (or throw me a link) how to clone objects and give them different properties? I don't want new icons or models, I just want to, for example, make a different longsword with a new name and higher damage, while keeping the regular old longsword in the game. That's possible, right?
Re: Ask a simple question, get a simple answer
Posted: Thu Nov 06, 2014 12:01 am
by NutJob
Matlock19 wrote:Expanding on Trollman's question:
Could someone show (or throw me a link) how to clone objects and give them different properties? I don't want new icons or models, I just want to, for example, make a different longsword with a new name and higher damage, while keeping the regular old longsword in the game. That's possible, right?
If you only want to change some fundamentals of an object just spawn it in and change what you want.
Example
Code: Select all
local skull_of_dargoth = spawn("skull")
skull_of_dargoth.item:setDescription("Only in purest darkness\nshall the way be shown.")
skull_of_dargoth.item:setWeight(0.8)
skull_of_dargoth.item:setUiName("Brittle Human Skull")
Re: Ask a simple question, get a simple answer
Posted: Thu Nov 06, 2014 12:13 am
by NutJob
What's the easiest way to listen to the sounds? ATM the best method I have is to drop a sound entity and "guess" at sounds then load the game, and, even then, it won't play most of the time (guessing only loops will play with the sound entity?), which is the most implausible way to do it.
Re: Ask a simple question, get a simple answer
Posted: Thu Nov 06, 2014 12:22 am
by Matlock19
NutJob wrote:
Code: Select all
local skull_of_dargoth = spawn("skull")
skull_of_dargoth.item:setDescription("Only in purest darkness\nshall the way be shown.")
skull_of_dargoth.item:setWeight(0.8)
skull_of_dargoth.item:setUiName("Brittle Human Skull")
So that script spawns the item at the location of the script entity when the level is loaded. Nice. Thank you!
And can I alter the properties of a spawned weapon by adding:
Code: Select all
sword_of_whatever.item:setattackPower = 10
sword_of_whatever.item:setaccuracy = 10
sword_of_whatever.item:setbaseDamageStat = dexterity
Re: Ask a simple question, get a simple answer
Posted: Thu Nov 06, 2014 12:25 am
by zeltak
What does the "currentLevelOnly" do in timers? It seems that timers pause even without it when you're in a different level. And is there a way to make them tick even when you're not in the same level as the timer?
Re: Ask a simple question, get a simple answer
Posted: Thu Nov 06, 2014 12:30 am
by NutJob
Matlock19 wrote:
And can I alter the properties of a spawned weapon by adding:
Code: Select all
sword_of_whatever.item:setattackPower = 10
sword_of_whatever.item:setaccuracy = 10
sword_of_whatever.item:setbaseDamageStat = dexterity
Yes, and you can wrap it up in a function and have it triggered by something, or on load of the game. Being you want to clone an object this may be the fastest way, really, without messing with defineObject.
You can give it to a player with
insertItem or to a surface with
addItem or to coordinates while
spawn()'ing the item.
Re: Ask a simple question, get a simple answer
Posted: Thu Nov 06, 2014 12:37 am
by Matlock19
Well it seems that trying to change the attack power, accuracy, etc. gives me an error: " function arguments expected near '=' ".
Code: Select all
local new_rapier = spawn("rapier")
new_rapier.item:setDescription("A ceremonial sword.")
new_rapier.item:setattackPower = 10
new_rapier.item:setUiName("New Rapier")
Re: Ask a simple question, get a simple answer
Posted: Thu Nov 06, 2014 12:42 am
by NutJob
try youritemname.meleeattack:setAttackPower(10) <-- might be wrong, not at the correct computer.
Re: Ask a simple question, get a simple answer
Posted: Thu Nov 06, 2014 1:02 am
by Matlock19
NutJob wrote:try youritemname.meleeattack:setAttackPower(10) <-- might be wrong, not at the correct computer.
Worked perfectly, thank you again. Don't know what I would do without this forum!
FURTHER EDITS!
Forget my dumb question, figured it out. I needed to call the cloak "new_cloak.equipmentitem" when setting those properties, not just ".item". Duh.