RE: cogwheel/elevatormachine
here is the script
void OnStart()
{
AddEntityCollideCallback("cogwheel01_dyn", "cogwheel02", "CollideWrongWheel", false, 1);
AddEntityCollideCallback("cogwheel01_dyn", "cogwheel03", "CollideWrongWheel", false, 1);
AddEntityCollideCallback("cogwheel02_dyn", "cogwheel01", "CollideWrongWheel", false, 1);
AddEntityCollideCallback("cogwheel02_dyn", "cogwheel03", "CollideWrongWheel", false, 1);
AddEntityCollideCallback("cogwheel03_dyn", "cogwheel01", "CollideWrongWheel", false, 1);
AddEntityCollideCallback("cogwheel03_dyn", "cogwheel02", "CollideWrongWheel", false, 1);
//SetLocalVarInt("WheelOK", 3);
//SetLocalVarInt("CoalOK",3);
//SetLocalVarInt("GuideOK",1);
//SetLocalVarInt("SticksOK",1);
for(int i=1;i<=12;i++){
AddEntityCollideCallback("coal_"+i, "AreaBurner", "CollideCoalInBurner", true, 1);
SetPropEffectActive("coal_"+i, false, false);
}
//---- INTERACT CALLBACKS ----//
for(int i=1;i<=3;i++) for(int j=1;j<=3;j++)
AddUseItemCallback("guiding_rod0"+i+"0"+j, "guiding_rod0"+i, "ra0"+j, "UseRod", false);
}
void AttachWheel(string &in asArea, string &in asBody)
{
AddTimer(asArea, 0.5f, "TimerWheel");
AddLocalVarInt("WheelOK", 1);
AddLocalVarInt(asArea, 1); //asChild in CollideWrongWheel, to not display message as spoke is taken
//DO PARTICLE
SetLocalVarString("WheelSound", asBody);
PlaySoundAtEntity(GetLocalVarString("WheelSound"), "scrape_metal.snt", asArea, 0.1f, false);
PlaySoundAtEntity(GetLocalVarString("WheelSound"), "13_attach_wheel.snt", asArea, 0.2f, false);
AddDebugMessage("Attach "+asArea+"_dyn", false);
SetEntityActive("AreaSpokes", false); //Turns off the missing spokes message.
}
void TimerWheel(string &in asTimer)
{
StopSound(GetLocalVarString("WheelSound"), 0.5f);
SetEntityActive(asTimer+"_dyn", false);
SetEntityActive(asTimer+"_mounted", true);
}
/*Message that it is not the correct spoke for the wheel
*/
void CollideWrongWheel(string &in asParent, string &in asChild, int alState)
{
if(GetLocalVarInt(asChild) != 1){
SetMessage("Ch01Level13", "WheelNoFit", 0);
PlaySoundAtEntity("clank", "impact_metal_low", asChild, 0.05f, false);
}
}
how to post images please tell me?
(This post was last modified: 07-17-2017, 05:58 PM by masanoffi.)
|