| Blockland Forums > Modification Help |
| Input Event - onTorchHit |
| (1/2) > >> |
| eddierocks2000:
Anyways, I'm making an RP of some sorts, and it uses the new Torch Item a good deal. I thought an input event for using the torch on a brick would make for a interesting new experience. Here's the problem: I can't script worth stuff. I know this goes in there somewhere: function TorchjWeaponImage::onPreFire(%this, %obj, %slot) { %obj.playthread(2, armattack); } function TorchjWeaponImage::onStopFire(%this, %obj, %slot) { %obj.playthread(2, root); } function torchProjectile::onCollision(%this, %obj, %col, %fade, %pos, %normal, %client) { And i'm pretty sure I got the code for the event right too, I just don't know the format or where to insert these codes. if(%col.getClassName() $= "fxDTSBrick") { $InputTarget_["Self"] = %col; $InputTarget_["Player"] = %obj.client.player; $InputTarget_["Client"] = %obj.client; if($Server::LAN) { $InputTarget_["MiniGame"] = getMiniGameFromObject(%obj.client); } else { if(getMiniGameFromObject(%col) == getMiniGameFromObject(%obj.client)) { $InputTarget_["MiniGame"] = getMiniGameFromObject(%col); } else { $InputTarget_["MiniGame"] = 0; } } %col.processInputEvent(onTorchHit,%obj.client); } } If anyone can insert this into the Torch script so that it works, please do so. Thanks, here's the Torch script if you don't already have it. |
| Demian:
This should help: http://forum.blockland.us/index.php?topic=138833.0 |
| eddierocks2000:
That is pretty helpful. I'll mess around with that later. |
| eddierocks2000:
So i've been plugging in stuff to this code over and over and can't get it to work. I honestly don't know what i'm doing but here's what I have: --- Quote ---registerInputEvent(fxDTSBrick,onTorchHit,"Self fxDTSBrick" TAB "Player Player" TAB "Client GameConnection" TAB "Minigame Minigame"); function TorchjWeaponImage::onHitObject(%this,%obj,%slot,%col,%pos,%normal,%shotVec,%crit) { parent::onHitObject(%this,%obj,%slot,%col,%pos,%normal,%shotVec,%crit); if(%col.getClassName() $= "fxDTSBrick") { $InputTarget_["Self"] = %col; $InputTarget_["Player"] = %obj.client.player; $InputTarget_["Client"] = %obj.client; if($Server::LAN) { $InputTarget_["MiniGame"] = getMiniGameFromObject(%obj.client); } else { if(getMiniGameFromObject(%col) == getMiniGameFromObject(%obj.client)) { $InputTarget_["MiniGame"] = getMiniGameFromObject(%col); } else { $InputTarget_["MiniGame"] = 0; } } %col.processInputEvent(onTorchHit,%obj.client); } } --- End quote --- I've tried using the projectile instead of the image, and onCollision, instead of onHitObject. I thought it worked, and it registers the event in the input list, but it never has any effect. So when i'm testing it, ill put: onTorchHit --> Player --> Kill But when I hit it nothing happens. Help please. |
| eddierocks2000:
I also tried this approach: --- Quote ---registerInputEvent("fxDTSBrick","onTorchHit","Self fxDTSBrick" TAB "Player Player" TAB "Client GameConnection" TAB "MiniGame MiniGame" TAB "Owner(Player) Player" TAB "Owner(Client) GameConnection",1); function fxDTSBrick::onTorchHit(%obj,%client) { $InputTarget_["Self"] = %obj; $InputTarget_["Player"] = %client.Player; $InputTarget_["Client"] = %client; if(%client.minigame == %obj.getGroup().client.minigame) { $InputTarget_["MiniGame"] = %obj.getGroup().client.minigame; } $InputTarget_["Owner(Player)"] = %obj.getGroup().client.Player; $InputTarget_["Owner(Client)"] = %obj.getGroup().client; %obj.processInputEvent("onTorchHit",%client); } --- End quote --- Same problem. |
| Navigation |
| Message Index |
| Next page |