Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
Thanks that helped !
- TheLastOrder
- Posts: 104
- Joined: Wed Oct 17, 2012 1:56 am
Re: Ask a simple question, get a simple answer
I'm trying to find a solution through counters for a button that rotates, sequentially, different force fields. And of course, it's not working. How could I solve this with a script??
The point is that when I'm using the "if" "then" + "else" method, I have only 2 outputs, and I need 4 different stages when pushing this button.
So> There are 4 force fields: the first click on the button will disable the first one. The second click will enable that first one, disabling only the second one. With the 3rd click, the 3rd is disabled. etc.
Any idea? Is there an alternative way to do that without using the "if+then+else"?
EDITED: I have to say that I actually solved WHAT I'm asking for through counters, but the real problem is that I need 2 buttons doing this with a total of 6 different force fields, 4 per button, 2 of which are shared in the buttons hahaha. So I think I need to do through scripting, as through counters there will be always 5 force fields activated (and I need to disable 2 of them).
Does it makes sense for you guys?
Thanks in advance guys!
The point is that when I'm using the "if" "then" + "else" method, I have only 2 outputs, and I need 4 different stages when pushing this button.
So> There are 4 force fields: the first click on the button will disable the first one. The second click will enable that first one, disabling only the second one. With the 3rd click, the 3rd is disabled. etc.
Any idea? Is there an alternative way to do that without using the "if+then+else"?
EDITED: I have to say that I actually solved WHAT I'm asking for through counters, but the real problem is that I need 2 buttons doing this with a total of 6 different force fields, 4 per button, 2 of which are shared in the buttons hahaha. So I think I need to do through scripting, as through counters there will be always 5 force fields activated (and I need to disable 2 of them).
Does it makes sense for you guys?
Thanks in advance guys!
-
- Posts: 168
- Joined: Thu Oct 30, 2014 1:56 am
Re: Ask a simple question, get a simple answer
Sounds like a problem I want to help solve. I will post back in a little while with a prototype.
Say button A cycles forcefields 1-4, button B cycles forcefield 3-6. What do you want to have happen if both buttons are trying to disable the same forcefield? Off or on?
edit:
name your teleports "force_field_n" where n is a number from 1 through 6
Say button A cycles forcefields 1-4, button B cycles forcefield 3-6. What do you want to have happen if both buttons are trying to disable the same forcefield? Off or on?
edit:
Code: Select all
acycle = 0
bcycle = 2
function buttonA()
acycle = acycle + 1
if acycle > 4 then
acycle = 1
end
setTeleport()
end
function buttonB()
bcycle = bcycle + 1
if bcycle > 6 then
bcycle = 3
end
setTeleport()
end
function setTeleport()
for i = 1,6 do
ff = findEntity("force_field_"..i)
if i == acycle or i == bcycle then
ff.controller:deactivate()
else
ff.controller:activate()
end
end
end
- TheLastOrder
- Posts: 104
- Joined: Wed Oct 17, 2012 1:56 am
Re: Ask a simple question, get a simple answer
Yeah, you understood correctly the request!GoldenShadowGS wrote:Sounds like a problem I want to help solve. I will post back in a little while with a prototype.
Say button A cycles forcefields 1-4, button B cycles forcefield 3-6. What do you want to have happen if both buttons are trying to disable the same forcefield? Off or on?
edit:name your teleports "force_field_n" where n is a number from 1 through 6Code: Select all
acycle = 0 bcycle = 2 function buttonA() acycle = acycle + 1 if acycle > 4 then acycle = 1 end setTeleport() end function buttonB() bcycle = bcycle + 1 if bcycle > 6 then bcycle = 3 end setTeleport() end function setTeleport() for i = 1,6 do ff = findEntity("force_field_"..i) if i == acycle or i == bcycle then ff.controller:deactivate() else ff.controller:activate() end end end
This is just.... awesome. Woah! I couldn't have discovered this combination in years... But it seems that is the answer to what I'm looking for.
I'm going to make some testing, and I'll post you back! Thanks A LOT!
-
- Posts: 168
- Joined: Thu Oct 30, 2014 1:56 am
Re: Ask a simple question, get a simple answer
Here Is an improvement:
Now only one forcefield will deactivate at a time. This time the button names matter too. wall_button_1 and wall_button_2. if they are different, then change it in the script to match
Code: Select all
acycle = 0
bcycle = 2
function buttonA(self)
acycle = acycle + 1
if acycle > 4 then
acycle = 1
end
setTeleport(self.go.id)
end
function buttonB(self)
bcycle = bcycle + 1
if bcycle > 6 then
bcycle = 3
end
setTeleport(self.go.id)
end
function setTeleport(button)
for i = 1,6 do
ff = findEntity("force_field_"..i)
if button == "wall_button_1" then
if i == acycle then
ff.controller:deactivate()
else
ff.controller:activate()
end
elseif button == "wall_button_2" then
if i == bcycle then
ff.controller:deactivate()
else
ff.controller:activate()
end
end
end
end
- TheLastOrder
- Posts: 104
- Joined: Wed Oct 17, 2012 1:56 am
Re: Ask a simple question, get a simple answer
My personal Jesus, and I'm atheist!!
Re: Ask a simple question, get a simple answer
When using an item with this set in its definition the editor says it is an "invalid component property". The string I gave it was an item, assuming that once the charges of the spell were used up the item would become what i pass it in the string. Has anyone got this to work? Obviously emptyItem isn't the right name for this property...CastSpellComponent (ItemActionComponent)
...
CastSpellComponent:setEmptyItem(string)
Writer and sometimes artist of the very slightly acclaimed comic series Scrambled Circuits. A comic series about a robot written by a human.
Grimrock 2 socketSystem: viewtopic.php?f=22&t=8546 / Github
Grimrock 2 socketSystem: viewtopic.php?f=22&t=8546 / Github
Re: Ask a simple question, get a simple answer
Missile Weapons are bad.
I want to make them better, starting with improving the skill.
Where do I even begin? Extract all the data for the game?
Thanks >_>
I want to make them better, starting with improving the skill.
Where do I even begin? Extract all the data for the game?
Thanks >_>
Re: Ask a simple question, get a simple answer
Hi
I can't find option for disabling custom party creation for custom dungeon. I was wondering about replacing created party by predefined one (using script) but I was hoping for more elegant solution. If I just missed that somewhere, please let me know
I can't find option for disabling custom party creation for custom dungeon. I was wondering about replacing created party by predefined one (using script) but I was hoping for more elegant solution. If I just missed that somewhere, please let me know
- Ciccipicci
- Posts: 154
- Joined: Mon Oct 08, 2012 12:55 am
Re: Ask a simple question, get a simple answer
Hi. How to pop up a text line from one champion only when walking in a specific point or coordinates?
I'm using this
hudPrint(party.party:getChampion(x):getName() .. ": message you want the champion to say in quotes here" )
but the scripts pop up instantly everywhere.
I'm using this
hudPrint(party.party:getChampion(x):getName() .. ": message you want the champion to say in quotes here" )
but the scripts pop up instantly everywhere.