Page 1 of 2

few scripts help please

Posted: Thu Jan 10, 2013 3:59 pm
by Drakkan
Hi all,
if somebody is just browsing around and want me help with some scripts I need, I would be grateful

1. Need define axe object, which will have bonus + attack and +str when used by minotaur and -STR when used by any other race

2. SOLVED - need script button on the wall, which could be pushed by any projectile (arrow, rock...)

3. SOLVED - I already used this script to prevent sleeping on dungeon level 4

Code: Select all

cloneObject{
       name = "party",
       baseObject = "party",
       onRest = function(party)
          if ( party.level == 4 ) then
             return false;      
          end
       end,
       onWakeUp = function(party)

       end,
}
but when I am trying to replicate it for floor 3, its not working
cloneObject{
name = "party2",
baseObject = "party",
onRest = function(party2)
if ( party.level == 3 ) then
return false;
end
end,
onWakeUp = function(party2)
end,
}

Re: few scripts help please

Posted: Thu Jan 10, 2013 5:24 pm
by Grimwold
Your third query is pretty straightforward.. you can only have one party.. so you need to include both conditions in a single clone of the party object.

Code: Select all

cloneObject{
       name = "party",
       baseObject = "party",
       onRest = function(party)
          if party.level == 4 or party.level == 3 then
             return false;     
          end
       end,
       onWakeUp = function(party)

       end,
}
Unfortunately I don't have time to dig into the other two questions right now.... but If I get time when I get home from work, I will take a look.

EDIT - a quick and dirty solution to your button question would be to place hidden receptors (one receptor for each missile type) on the same wall as the button... connect each receptor to the button, and when any of the receptors are triggered by a projectile they activate the button.

Re: few scripts help please

Posted: Thu Jan 10, 2013 5:26 pm
by Komag
For 1 you can do something like this:
viewtopic.php?p=50508#p50508

For 2 Grimwold's solution was also my idea, except that I think you can't just link to a button, but would need to activate a script function that does Button:push()

Re: few scripts help please

Posted: Thu Jan 10, 2013 5:52 pm
by Grimwold
Komag wrote:For 2 Grimwold's solution was also my idea, except that I think you can't just link to a button, but would need to activate a script function that does Button:push()
Yeah, that was my bad... I meant link to a script that triggers the button. I've done similar with a lever that activates when hit by a throwing axe.

Re: few scripts help please

Posted: Thu Jan 10, 2013 6:48 pm
by Drakkan
working fine now, thanks guys. 1 and 2 solved
EDIT: mens 2 and 3 :p

Re: few scripts help please

Posted: Thu Jan 10, 2013 7:09 pm
by Komag
that's good news because 3 is the easy fix! :D

Re: few scripts help please

Posted: Thu Jan 10, 2013 8:29 pm
by Drakkan
Komag wrote:that's good news because 3 is the easy fix! :D
aaah, 2 and 3, not the first one :d

Re: few scripts help please

Posted: Thu Jan 10, 2013 9:01 pm
by Komag
I would probably use onEquipItem and onUnequipItem and have it give the bonus to everyone unless champion:getRace() returns ~= minotaur

Re: few scripts help please

Posted: Mon Jan 21, 2013 8:02 pm
by Drakkan
Komag wrote:I would probably use onEquipItem and onUnequipItem and have it give the bonus to everyone unless champion:getRace() returns ~= minotaur
If you will have some free time I will appreciate this whole script, I do not know how to write it correctly :/

cloneObject{
name = "minotaur_axe",
baseObject = "battle_axe",
uiName = "Minotaur Axe",
description = "Haft handle bears signs of often use. Designed for Minotaurs",

**** attackPower = 20 and minus 2STR, when used by minotaur 30 and +2 str ***

coolDownTime = 5,
weight = 6,
}

Re: few scripts help please

Posted: Mon Jan 21, 2013 10:21 pm
by Komag
have the onEquipItem and onUnequipItem do scripts/functions in the dungeon, such as axeScript.equipAxe(champ,slot) and axeScript.unequipAxe(champ,slot)

in those functions do a check first that the slot is 7 or 8, then check on the champ race to see if the champion is minotaur or not. Then if it's in slot 7 or 8 and if it's minotaur, do the stat adjust (strength)

I don't think you can adjust attack power directly - if you really wanted to adjust attack power you would have to define ANOTHER axe and do a hot-swap out in the moment, but the coding for that could get really tricky!

Hope that helps a bit. Sorry I can't help in more detail, but I'm under a time crunch for the next few weeks