ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

Switch Weapon - Restriction Logic troubles

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.

Switch Weapon - Restriction Logic troubles

Postby DazaKiwi » Fri Oct 14, 2016 9:47 pm

This is for a lazy task Switch Weapon:

Player has 3 Object Properties

> Primary Weapon : Rifle object
> Secondary Weapon : Pistol object
> Current Weapon in use : Rifle object

The Switch Weapons tasks calls two tasks with a reference to Primary and the other task Secondary Property

Two tasks:

Task 1: Ref Primary Weapon Property

Restriction: 'Current Weapon in Use Property' Must NOT = Ref Object

Pass: Set Ref Obj to 'Current Weapon in Use' Property

------

Task 2: Ref Secondary Weapon Property

Restriction: 'Current Weapon in Use' Property Must NOT = Ref Object

Pass: Set Ref Obj to 'Current Weapon in Use' Property


What happens is it works as intended the first time and then after that keeps passing on both tasks and the last task to run is the one that updates the Current Weapon in Use property, so you get stuck with the secondary weapon always being the one in current use.

Why is this broken after the first run? There must be some flawed logic i am using that has baffled me. [Is primary weapon the current weapon NO then make Primary Weapon the Current Weapon in Use, Is the Secondary weapon the Current Weapon in Use NO then make the Secondary Weapon the Current weapon.]

See Demo
Attachments
SwitchWeaponDemo.taf
(15.75 KiB) Downloaded 43 times
User avatar
DazaKiwi
 
Posts: 521
Joined: Thu Oct 21, 2010 9:05 am
Location: New Zealand
Points: 16

Re: Switch Weapon - Restriction Logic troubles

Postby DazaKiwi » Sat Oct 15, 2016 1:39 am

I think I have figured out what was happening, the first called task would pass and then once it does change the weapon around then the next called task would fire/pass because of the knock on effect of the previous called task, kind of like dominoes. By having a circuit breaker variable as it were this stopped this happening...

Took me a while to work this out lol :x

If you are interest see the updated version of the demo...
Attachments
SwitchWeaponDemo_V3.taf
(15.99 KiB) Downloaded 44 times
User avatar
DazaKiwi
 
Posts: 521
Joined: Thu Oct 21, 2010 9:05 am
Location: New Zealand
Points: 16

Re: Switch Weapon - Restriction Logic troubles

Postby Lazzah » Sun Oct 16, 2016 9:04 am

Hi Daza, thanks for going to the trouble of demonstrating this, I hope someone will find a use for it.
OUT NOW: Run, Bronwynn, Run!
Current W.I.P.: Magnetic Moon
Also available: The Axe of Kolt, The Spectre of Castle Coris, The Fortress of Fear, Die Feuerfaust - The Fist of Fire and The Lost Children
User avatar
Lazzah
Moderator
 
Posts: 2104
Joined: Thu Mar 31, 2011 4:54 am
Location: London, England
Points: 17


Return to ADRIFT 5.0

Who is online

Users browsing this forum: No registered users and 6 guests