| Blockland Forums > Modification Help |
| Looping a Schedule/ Obtaining Health of a Vehicle [Fixed] |
| << < (3/5) > >> |
| Chrono:
No no, you wouldn't use Armor::damage You'd use WheeledVehicleData:: and FlyingVehicleData:: %this is the datablock. %obj is the vehicle bla bla bla |
| KuriousGeorge:
Oh sorry. That's what I meant anyhow, it was the arguments I got wrong. so if I would want to message the driver after the vehicle took damage --- Code: ---messageClient(%obj.driver.client, 'bottom print', "Your vehicle took" SPC %damage SPC "damage."); --- End code --- |
| Chrono:
You wouldn't do that because if someone shot at the vehicle with a machine gun, the driver would get spammed. I'd say stick to a right aligned center print, like this: CenterPrint(%obj.getMountedObject(0).client,"<just:right><color:ffffff>Vehicle: <color:00ff00>" @ (1-%obj.getDamagePercent())*100 @ "%",3); %obj is the vehicle .getMountedObject(0) is the driver .client is the driver's client <just:right> puts the message to the right side of the screen. (1-%obj.getDamagePercent())*100 %obj.getDamagePercent is a number between 0 and 1 to show how much damage the vehicle has taken. 1- that^ gets the health percent, multiply by 100 to get a number between 0 and 100. 3 shows the center print for 3 seconds. Do this AFTER the Parent::damage |
| KuriousGeorge:
--- Code: ---package NewPackage { function wheeledVehicle::damage(%this, %obj, %sourceObject, %position, %damage, %damageType) { Parent::damage(%this, %obj, %sourceObject, %position, %damage, %damageType) centerPrint(%obj.getMountedObject(0).client,"<just:right><color:ffffff>Vehicle: <color:00ff00>" @ (1-%obj.getDamagePercent())*100 @ "%",3); } }; activatePackage(NewPackage); --- End code --- 1. Chrono your ideas are as good as your add-ons, I like the right aligned thing. 2. Thank god for Package/Syntax Tutorial or else I would have had no idea what to do 3. I tried executing it but the console doesn't like it. Can someone help me wrap this up? 4. why won't simply %obj.driver.client work? |
| Chrono:
You forgot the ; at the end of Parent::damage(%this, %obj, %sourceObject, %position, %damage, %damageType) |
| Navigation |
| Message Index |
| Next page |
| Previous page |