few scripts help please

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

few scripts help please

Post 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,
}
Last edited by Drakkan on Mon Jan 21, 2013 8:04 pm, edited 4 times in total.
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: few scripts help please

Post 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.
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: few scripts help please

Post 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()
Finished Dungeons - complete mods to play
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: few scripts help please

Post 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.
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: few scripts help please

Post by Drakkan »

working fine now, thanks guys. 1 and 2 solved
EDIT: mens 2 and 3 :p
Last edited by Drakkan on Thu Jan 10, 2013 8:30 pm, edited 1 time in total.
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: few scripts help please

Post by Komag »

that's good news because 3 is the easy fix! :D
Finished Dungeons - complete mods to play
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: few scripts help please

Post by Drakkan »

Komag wrote:that's good news because 3 is the easy fix! :D
aaah, 2 and 3, not the first one :d
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: few scripts help please

Post by Komag »

I would probably use onEquipItem and onUnequipItem and have it give the bonus to everyone unless champion:getRace() returns ~= minotaur
Finished Dungeons - complete mods to play
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: few scripts help please

Post 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,
}
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: few scripts help please

Post 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
Finished Dungeons - complete mods to play
Post Reply