Jump to content

How to set character on fire?


Ramibuk

Recommended Posts

I saw this here http://projectzomboid.com/blog/2012/01/expanded-modding-support-details/

 in expoding apple example

 

if sq ~= nil then

sq:StartFire();
 

Full function:

function DoExplodingApple(character, item)   if item:GetType() == "Apple" then      local radius = 30;      local numFires = 300;      local cell = GetWorld():GetCell();      local objects = cell:GetObjects();	for k,v in ipairs(objects) do	   if character:DistTo(v) < radius and v:IsCharacter() then		v:Kill(character);	   end	end	GetSoundManager():PlayWorldSound("explode", character:GetSquare(), 0, 20, 1.0, false);	for i = 0, numFires do	   local sq = cell:GetGridSquare(ZombRand(character:GetX()-radius, character:GetX()+radius),	  		                 ZombRand(character:GetY()-radius, character:GetY()+radius),					 character:GetZ() );	    if sq ~= nil then		sq:StartFire();	    end	end    endendEvents.OnUseItem.Add(DoExplodingApple); 

 

but that's from january 2012 so i was interesting how fire work now

Link to comment
Share on other sites

There's a public static class called IsoFireManager... you could try

 

IsoFireManager:StartFire(IsoCell cell, IsoGridSquare gridSquare, boolean IgniteOnAny, int FireStartingEnergy) 

 

Can't remember the exact methods but I guess it would be something like:

IsoFireManager:StartFire(getPlayer():getGridSquare():getCell(), getPlayer():getGridSquare(), true, 10)

Link to comment
Share on other sites

  • 2 weeks later...

Thanks to Stormy:


 


gridSquare:AddTileObject(IsoFire.new(gridSquare:getCell(), gridSquare, true, 2))


 


Not sure what that end number is for and the fire seems to spawn long after I call the function but that definitely does add a fire to a square.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...