| Blockland Forums > Modification Help |
| Making hats? (New feature idea) |
| << < (3/7) > >> |
| Mawpius:
You'd have to make a new shape for the hat (like the one posted by swollow) and mount that to the player instead, using $Headslot as its mountpoint. edit: to hide the head you could just do %obj.hideNode("headskin"); |
| Demian:
--- Quote from: Mawpius on October 10, 2011, 02:17:51 PM ---You'd have to make a new shape for the hat (like the one posted by swollow) and mount that to the player instead, using $Headslot as its mountpoint. edit: to hide the head you could just do %obj.hideNode("headskin"); --- End quote --- I can see the two ShapeBaseImageData datablocks in swollow's script but I do not know how to use them in the script. How do they differ from eachother? Why do they have the same name? |
| Mawpius:
They shouldn't have the same name. Just add this: --- Code: ---datablock ShapeBaseImageData(SkullHat) { shapeFile = "./skull.dts"; emap = true; mountPoint = $HeadSlot; offset = "0 -0.05 0.1"; eyeOffset = "0 0 10 1"; rotation = eulerToMatrix("0 0 0"); scale = "1 1 1"; doColorShift = false; colorShiftColor = "0.392 0.196 0.0 1.000"; }; --- End code --- And change %obj.mountimage(IM_SkullHead, 1); in IM_SkullHead::onFire to %obj.mountimage(SkullHat, 1); |
| Demian:
Okay now this is purely cosmetic fine tuning. How would I remove the image (not item) from my hand when I equip the hat and then put the image back when unequipping? So it looks like you actually put on the hat and took it off. |
| Mawpius:
This is the way I did it: --- Code: ---datablock ItemData(IT_SkullHead) { category = "Item"; className = "Item"; shapeFile = "./skull.dts"; image = "IM_SkullHead"; rotate = false; emap = true; uiName = "Skull Head"; iconName = "Add-Ons/Weapon_Gun/icon_gun"; canDrop = true; mass = 1; drag = 0.1; density = 0.1; friction = 0.5; elasticity = 0.1; sticky = 0; gravityMod = 1; maxVelocity = -1; dynamicType = 0; doColorShift = false; colorShiftColor = "0 0 0 0"; }; datablock ShapeBaseImageData(IM_SkullHead) { className = "ItemImage"; shapeFile = "./skull.dts"; item = "IT_SkullHead"; emap = true; firstPersonParticles = true; armReady = false; melee = false; mountPoint = 0; offset = "0 -0.05 0.1"; rotation = eulerToMatrix("0 0 0"); eyeOffset = "0 0 10 1"; eyeRotation = "0 0 0 0"; correctMuzzleVector = false; doColorShift = false; colorShiftColor = "0 0 0 0"; stateName[0] = "Activate"; stateWaitForTimeout[0] = false; stateTimeoutValue[0] = 0.1; stateTransitionOnTimeout[0] = "Ready"; stateName[1] = "Ready"; stateAllowImageChange[1] = true; stateTransitionOnTriggerDown[1] = "Equip"; stateName[2] = "Equip"; stateScript[2] = "onFire"; stateTransitionOnTriggerUp[2] = "Ready"; }; datablock ShapeBaseImageData(IM_SkullHeadEmpty) { className = "ItemImage"; shapeFile = "./skull.dts"; item = "IT_SkullHead"; emap = true; firstPersonParticles = true; armReady = false; melee = false; mountPoint = 0; offset = "0 -0.05 0.1"; rotation = eulerToMatrix("0 0 0"); eyeOffset = "0 0 10 1"; eyeRotation = "0 0 0 0"; correctMuzzleVector = false; doColorShift = false; colorShiftColor = "0 0 0 0"; stateName[0] = "Activate"; stateWaitForTimeout[0] = false; stateTimeoutValue[0] = 0.1; stateTransitionOnTimeout[0] = "Ready"; stateName[1] = "Ready"; stateAllowImageChange[1] = true; stateTransitionOnTriggerDown[1] = "Equip"; stateName[2] = "Equip"; stateScript[2] = "onFire"; stateTransitionOnTriggerUp[2] = "Ready"; }; function IM_SkullHead::onFire(%this, %obj, %slot) { %client=%obj.client; if(!%obj.HatWear) { %obj.HatWear = 1; %client.centerPrint("\c6You put on the hat.",3); for(%i = 0;$hat[%i] !$= "";%i++) { %obj.hideNode($hat[%i]); } %obj.unmountimage(1); %obj.mountimage(SkullHat, 1); %obj.mountimage(IM_SkullHeadEmpty,0); } } function IM_SkullHeadEmpty::onFire(%this, %obj, %slot) { %client=%obj.client; if(%obj.HatWear) { %obj.HatWear = 0; %client.centerPrint("\c6You took off the hat.",3); %obj.unmountimage(1); %obj.mountImage(IM_SkullHead,0); %client.applyBodyParts(); %client.applyBodyColors(); } } function IM_SkullHead::onMount(%this,%obj,%slot) { if(%obj.HatWear) { %obj.unMountImage(0); %obj.mountImage(IM_SkullHeadEmpty,0); } } datablock ShapeBaseImageData(SkullHat) { shapeFile = "./skull.dts"; emap = true; mountPoint = $HeadSlot; offset = "0 -0.05 0.1"; eyeOffset = "0 0 10 1"; rotation = eulerToMatrix("0 0 0"); scale = "1 1 1"; doColorShift = false; colorShiftColor = "0.392 0.196 0.0 1.000"; }; --- End code --- The only problem is holding down your mouse button will constantly change your hat. I'm sure this is because of how the states are set up, but I have a hard time understanding those. edit: oops, forgot to change one of the shapefiles back since I was testing it on another model. |
| Navigation |
| Message Index |
| Next page |
| Previous page |