Page 6 of 7
Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!
Posted: Wed Oct 22, 2014 7:29 pm
by SnowyOwl47
mpuppetier wrote:I guys, how can i kill a monster??
i had tried
Code: Select all
function killWizard()
wizard_1.monster:destroy();
end
also tried the methods
kill() and dieBastard()
and setHeath(0) ...
but the wizard still looking at me
I think dieBastard should work
Lol ok to destroy an object you say:
As an example I created three tree cluster items in my dungeon through script when a boss starts then when the boss died I destroyed them:
Make sure to replace entity with the name of whatever you want to kill/destroy.
Edit: you can also say
Edit: Another thing you can do to damage it a little is:
Code: Select all
function hurt()
health = entity.monster:getHealth() - 1
entity.monster:setHealth(health)
end
That should work and is a cool thing.
Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!
Posted: Wed Oct 22, 2014 8:07 pm
by mpuppetier
SnowyOwl47:
setHealth works but doesn't kill the monster .
destroy
doesn't trigger onDie
This works :
Code: Select all
die = false;
function killWizard()
if die == false then
wizard.monster:die();
die = true;
end
end
Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!
Posted: Wed Oct 22, 2014 9:50 pm
by zeltak
Is there a way to reset the preview mode? Or to change the time of day in the preview mode?
Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!
Posted: Thu Oct 23, 2014 2:41 am
by [SMUG]Ipecac
Hey can someone tell my how to require a specific object in an alcove or altar for the triggering effect? So far it only work with "add object" which can just be a rock.
I found some old script from loGR but it doesn't work.
function itemPuzzle()
-- iterate through all contained items on alcove, checking for a matching name
for i in itemPuzzleAlcove:containedItems() do
if i.name == "pitroot_bread" then
playSound("level_up")
break
end
end
end
containedItems() is a null value at the very least
Anyone?
Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!
Posted: Mon Oct 27, 2014 8:02 pm
by zeltak
I'll post my question here, so not to flood forum with every single simple question in its own thread.
How do I activate and deactivate teleporters from the script?
I tried:
Code: Select all
teleporter_name.teleporter:activate()
teleporter_name.teleporter:deactivate()
but it returns with "attempt to call method 'activate' (a nil value) x"
Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!
Posted: Mon Oct 27, 2014 8:10 pm
by Lark
Use "enable" and "disable""
Code: Select all
function flyAway()
teleporter_1.teleporter:enable()
end
Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!
Posted: Mon Oct 27, 2014 8:11 pm
by zeltak
Lark wrote:Use "enable" and "disable""
Code: Select all
function flyAway()
teleporter_1.teleporter:enable()
end
Thank you.
Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!
Posted: Mon Oct 27, 2014 8:37 pm
by zeltak
Hmm..
teleporter_1.teleporter:enable() ..:disable(), enables and disables only the teleporter part of the whole thing. Particles, lights, sounds etc. are unaffected. How do I shut down and start up the whole thing? I tried leaving the .teleporter -part away from the script, but then it again doesn't understand enable() & disable().
Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!
Posted: Mon Oct 27, 2014 9:43 pm
by Lark
Well, in that case, I think I would try spawning the teleporter only when it was desired, and destroy it when I no longer wanted it. I'll check for other options later tonight...
Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!
Posted: Mon Oct 27, 2014 9:47 pm
by sps999
[SMUG]Ipecac wrote:Hey can someone tell my how to require a specific object in an alcove or altar for the triggering effect? So far it only work with "add object" which can just be a rock.
I found some old script from loGR but it doesn't work.
function itemPuzzle()
-- iterate through all contained items on alcove, checking for a matching name
for i in itemPuzzleAlcove:containedItems() do
if i.name == "pitroot_bread" then
playSound("level_up")
break
end
end
end
containedItems() is a null value at the very least
Anyone?
This thread was able to help me with the same problem, you should read through it:
viewtopic.php?f=22&t=7698&hilit=rock