Register
Email: Password:
Forum » [Modding] A few Questions

[Modding] A few Questions

Petrenko (guest) 11 years ago
Hi there, i'm modding on driftmoon and got some questions:

How do i make enemies respawn, after i leave a zone/territory?

How do i edit animations? (I want to create a pistol/rifle anim.)

Is it possible to have random properties for weapons? (Magic/Rare etc.)

Is there a subforum for driftmoon-modding? (Searched but didn't find anything.)

Thanks in advance!
#
ville 11 years ago
Great to hear that you're making a mod!

Petrenko (guest) said:
How do i make enemies respawn, after i leave a zone/territory?

You'll have to script it, that's the only way to do it. The simple part is making a script to spawn an enemy, but the hard part is figuring out a condition when to activate the script. I'd use a global flag. I'll call it playerOnArea. For each area that's available you'll need to add a controller object that constantly checks whether the playerOnArea flag is different from the area identifier you give to this area, and if it is different, it calls all monster spawners to respawn their monsters, and also resets the playerOnArea flag to the current area id. Got it? I can elaborate it further if you need help.

Petrenko (guest) said:
How do i edit animations? (I want to create a pistol/rifle anim.)

To edit the player animations, just import the object called race/player. It's actually a normal object, and you can edit the animations by going to the "anim" tab. Then remember to export the player back when you're done, and the animation is available to every bot that uses the same base object.

Petrenko (guest) said:
Is it possible to have random properties for weapons? (Magic/Rare etc.)

That's a difficult question. There is no easy system in place for that, but there's usually some way to get around such small details as something not being implemented! If you're looking to have, say a weapon type that might randomly have properties like fire damage, you could fake it by having a weapon type for each random type available, and by using the randomItemFromCategory item properties. That way the random object is replaced by one of your preset items, have a look at how the ingredients are randomized. But as I said right now there is no convenient way of having the random properties in a single item definition, you'll have to have an item definition for each possible type.

Petrenko (guest) said:
Is there a subforum for driftmoon-modding? (Searched but didn't find anything.)

You're in the correct place! At the moment we don't have separate subforums, it's easier to spot new posts this way... Just ask, we're here to help.

Edited 11 years ago
#
Petrenko (guest) 11 years ago
Hello again!

Thanks for the real quick reply!

I got a problem regarding the animation.

I imported the player. Worked.
I added a new animation called "Shooting" with the id "70". Worked.
I exported with overwriting "player". Worked.
I added this weapon + gfx:

[Weapons|Ak47]
id=138
visibleName=AK-47
cost=60
size=0.8
activateSound=draw_weapon
picture=ak47icon.png
onlyInEditor=false
# wieldSlot=0,7
wieldSlot=0
wieldPictureSlot=1
wieldPicture=ak47.png
wieldPictureSize=0.8
wieldOffsetX=0.0
wieldOffsetY=-0.5
wieldAngle=0.0
wieldAnimation=70
activateAnimationSpeed=15
description=An effective automatic-rifle\n-Speed: 15
ammoItems=Weapons|basicarrow,Weapons|basicarrow2,Weapons|arrow,Weapons|jaggedArrow,Weapons|poisonArrow
projectileSpeed=15
weaponSound=weapon_bow
wieldScript=addTag("rangedWeapon")
unWieldScript=removeTag("rangedWeapon")
firstAimTime=0.2
AIHint=weapon_ranged
weaponSet=ranged

Ingame my weapon is stuck in my back and he uses the bow animation. What went wrong?
#
ville 11 years ago
You've specified the wield animation to be 70, which means that animation is activated when the weapon is held in the hand. The wield animation is supposed to be one frame only, just the pose when the weapon is idle.

The shooting animation is actually defined in skills.ini. You might want to have a look at how the staff works in the main game. You need to define a shooting skill in the skills.ini, give the skill to the player (easiest is to give it by default to all humans in races.ini), and make sure your weapon has the correct tag for the skill (for example the staff item sets the tag "staff" when wielded, and the staffAttack skill requires it).
#
Pete 11 years ago
"Pete three minutes ago" said:
Hm, if I remember correctly the animations a weapon uses are determined by their type (rangedWeapons in this case), which are set up... somewhere else. One moment.
*rustling of e-paper*
Right, its in skills.ini. Here, for example, is the default ranged weapon attack:

[defaultRangedAttack]
visibleName=Attack
description=Normal attack.
picture=attack_punch.png
availableCondition=hasTag("rangedWeapon")
conditionExplanation=Requires ranged weapon
activateScript=setThisAsTarget() AND WAIT(0.15) fireProjectile(1,0.7,1.2,0.2,1,"playerNormalAttackEffect") AND reduceAmmo(1)
#activateScript=setThisAsTarget() AND reduceAmmo(1) AND WAIT(0.15) fireProjectile2(1,0.7,1.2,0.2,1)
rechargeTime=0
activateAnimationNumber=15
unusable=true

Note the activateAnimationNumber=15. This is the animation a weapon with a rangedWeapon tag will use.
As for the weapon being positioned incorrectly, the weapons are positioned in relation to the players hand (the little red dot specifically) and offset by these:
wieldOffsetX=0.0
wieldOffsetY=-0.5
wieldAngle=0.0

Gah, ninjad.
#
Petrenko (guest) 11 years ago
Heyho,

thank you so much! Now i'll get my ak ingame :3
#
Petrenko (guest) 11 years ago
Alright,

i got the same problem.

Exporting isn't really working. Player got the red and green dot on his hands and every animation is now not wielding weapons right.

Look at my code.

The skill:

[rifleAttack]
visibleName=Attack
description=Normal attack.
picture=attack_punch.png
availableCondition=hasTag("rifle")
conditionExplanation=Requires rifle-class weapon
activateScript=setThisAsTarget() AND WAIT(0.15) fireProjectile(1,0.7,1.2,0.2,0,"staffHitEffect") AND reduceAmmo(1)
rechargeTime=0
activateAnimationNumber=100
unusable=true

And the weapon:

[Weapons|Ak47]
id=139
visibleName=AK-47
cost=60
size=1.8
activateSound=draw_weapon
picture=ak47icon.png
onlyInEditor=false
# wieldSlot=0,7
wieldSlot=0
wieldPictureSlot=1
wieldPicture=ak47.png
wieldPictureSize=1.8
wieldOffsetX=0.0
wieldOffsetY=-0.5
wieldAngle=0.0
wieldAnimation=42
activateAnimationSpeed=15
description=An effective automatic-rifle\n-Speed: 15
ammoItems=Weapons|basicarrow,Weapons|basicarrow2,Weapons|arrow,Weapons|jaggedArrow,Weapons|poisonArrow
projectileSpeed=15
weaponSound=weapon_bow
wieldScript=addTag("rifle")
unWieldScript=removeTag("rifle")
firstAimTime=0.2
AIHint=weapon_ranged
weaponSet=ranged
#
ville 11 years ago
The red and green dots were used long ago, but not for a while now. Do you think you might have gotten the player object from an older version? Check that you're running Driftmoon 0.903.

If you can't get it working, I can have a look if you can send me the mod. ville@instantkingdom.com

Edited 11 years ago
#
ville 11 years ago
It's just as I suspected, you've got the player object file from March 2011 (which is outdated in respect to the animation numbers of course). I think it will be easiest that you copy the player.ob2 from the mainmod folder and start from there. And be sure to delete your copy of player.obj, that's even using the old object format, don't know how you got that there.

I like what you've got there already! It's going to be a great mod, I can tell.

[Edit] I just figured where you've gotten the old player.obj file, it must simply have been left over from a previous update of the game. Just ignore any .obj files from now on (don't copy them to your mod), and you might even consider doing a fresh install of Driftmoon to a clean directory...

Edited 11 years ago
#
Petrenko (guest) 11 years ago
Hi there,

i reinstalled driftmoon and the mod.

But i can't import objects anymore. Not even without mod in the editor. Wth?
#
ville 11 years ago
Wow, what a strange problem... Maybe you could elaborate on the problem? Does it just give you an empty list, when you press the import button? Are you sure you have any objects in the objects folder, because the import function just lists those objects that you already have in the objects folder of the current mod?

It sounds a bit tricky, but I'm sure we'll work it out.
#
Forum » [Modding] A few Questions

Post Reply


Your email:
Your name: