Jump to content

Art of S

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by Art of S

  1. @havenphillip thnx for your help. I have adapted your script to my weapon and ammo but I get the same error message every time. "Script Error attempt to compare with nil line 73" what's wrong? :-( @havenphillip thnx for your help. I have adapted your script to my weapon and ammo but I get the same error message every time. "Script Error attempt to compare with nil line 73" what's wrong? :-( Edit the error line is formatted thick. Script.ammoamount = 20 --float "Ammo Amount Per" Script.ammotype= 4 --int "Ammo Type" Script.maxammo=200 --int "Max Ammo" Script.ammo = 5 Script.removeBodyTime = 20 --int "Despawn Time" Script.removeBodyTimer = 0 Script.useOnce = true --bool "Use Once" Script.enabled = true --bool "Enabled" Script.floatup1 = false Script.counter= 0 function Script:Start() --Load a sound self.sound = Sound:Load("Sound/Interaction/pickupammo.wav") self.enabled = true self.entity:SetMass(0) local os = self.entity:GetPosition() self.entity:SetPosition(os.x,os.y+1,os.z) end function Script:floatUp(amount) local a1 = self.entity:GetPosition() local b1 = amount/20 self.entity:SetPosition(a1.x,a1.y + b1,a1.z) end function Script:UpdatePhysics() local window = Window:GetCurrent() if window:KeyHit(Key.O) then self:ChangeFloat() end local lastpos = self.entity:GetPosition() if self.enabled==true then if self.lastchangetime==nil then self.lastchangetime=0 end local t = Time:GetCurrent() local floatamount if self.floatup1==true then floatamount= 0.03 else floatamount = -0.03 end self:floatUp(floatamount) self.counter = self.counter +1 if self.counter >= 100 then self:ChangeFloat() self.counter=0 end self.lastchangetime = t end end function Script:ChangeFloat() if (self.floatup1 == false) then self.floatup1=true else self.floatup1=false end end function Script:UpdateWorld() self.entity:Turn(0,Time:GetSpeed(),0,true) self.removeBodyTimer = self.removeBodyTimer + (Time:GetSpeed()/100) if (self.removeBodyTimer > self.removeBodyTime) then self:IsHidden() end end function Script:Collision(entity, position, normal, speed) if entity:GetKeyValue("type")=="player" then for a = 0, 10 do if entity.script.weapons[a]~=nil then if entity.script.weapons[a].index == self.ammotype then if entity.script.weapons[a].ammo + entity.script.weapons[a].clipammo < entity.script.weapons[a].maxammo then entity.script.weapons[a].ammo = entity.script.weapons[a].ammo + self.ammoamount --Make sure the sound exists and play it if self.sound then self.sound:Play() end if entity.script.weapons[a].ammo + entity.script.weapons[a].clipammo > entity.script.weapons[a].maxammo then entity.script.weapons[a].ammo = entity.script.weapons[a].maxammo - entity.script.weapons[a].clipammo end if self.useOnce then self:IsHidden() end end end end end end end function Script:IsHidden() self.entity:Hide() if self.entity:Hide() then self.entity:Release() end end
  2. Don´t work for me,too. I did everything as described. Script Error : attemp to compare number with nil Line 8
  3. Thanks for the hints. The problem occurs only in this one map. After creating a new map everything works as it should.
  4. today i bought the "Mercenary Action Figure" and he floats in the map. Does anyone have a solution?
×
×
  • Create New...