| Blockland Forums > Modification Help |
| Image mount on spawn |
| (1/3) > >> |
| Thorax:
I've been searching and testing code for about an hour now, and frankly, I have no idea what to do. I want the code to mount the image "JuggernautImage" when the player spawns with this Playertype. Here is the code I currently have: --- Code: ---//Juggernaut //a new player datablock with Juggernaut-like movement and armor datablock ShapeBaseImageData(JuggernautImage) { // Basic Item properties shapeFile = "./Juggernaut.dts"; emap = true; // Specify mount point & offset for 3rd person, and eye offset // for first person rendering. mountPoint = $BackSlot; offset = "0 0 0"; eyeOffset = 0; //"0.7 1.2 -0.5"; rotation = eulerToMatrix( "0 0 180" ); scale = "3 3 3"; offset = "0 0 -0.5"; doColorShift = true; colorShiftColor = "0.100 0.100 0.100 1.000"; }; //function serverCmdJuggernaut(%Client,%Arg) //{ //if(isObject(%client.player)) // { // %client.player.mountImage(JuggernautImage,2); // } //} package EquipArmor { function GameConnection::spawnPlayer(%this) { %this.mountImage(JuggernautImage,2); parent::SpawnPlayer(%this); } }; activatepackage(EquipArmor); datablock PlayerData(PlayerJuggernautArmor : PlayerStandardArmor) { runForce = 100 * 90; runEnergyDrain = 0; minRunEnergy = 0; maxForwardSpeed = 3; maxBackwardSpeed = 1; maxSideSpeed = 1; maxForwardCrouchSpeed = 0; maxBackwardCrouchSpeed = 0; maxSideCrouchSpeed = 0; jumpForce = 7.5 * 90; //3 * 0; jumpEnergyDrain = 0; minJumpEnergy = 0; jumpDelay = 0; minJetEnergy = 0; jetEnergyDrain = 0; canJet = 0; uiName = "Juggernaut"; showEnergyBar = false; }; --- End code --- |
| otto-san:
I think you can put that in PlayerJuggernautArmor::onMount. |
| Thorax:
--- Quote from: otto-san on December 21, 2011, 12:20:18 AM ---I think you can put that in PlayerJuggernautArmor::onMount. --- End quote --- Could you make me some sample code? I'm still learning all this stuff. |
| Destiny/Zack0Wack0:
Try this: --- Code: ---function PlayerJuggernautArmor::onAdd(%this,%player) { %player.mountImage(JuggernautImage,2); } --- End code --- I haven't tested it, I was just wondering if you could do it this way instead of a package. If it doesn't work, then this code should work inside your package: --- Code: ---function GameConnection::spawnPlayer(%this) { %result = parent::spawnPlayer(%this); //I think this might return something %player = %this.player; if(isObject(%player)) %player.mountImage(JuggernautImage,2); return %result; } --- End code --- |
| Thorax:
That first method did it. Thanks so much. Last question, how would I hide any backpacks or shoulder-pads the user might have? |
| Navigation |
| Message Index |
| Next page |