silhouett Posted June 24, 2016 Share Posted June 24, 2016 I have created a quest and have 10 Alias or slots say to fill for actorsI want to be able to fill the first empty Alias with in a script that each actor has attached.I also want to be able to remove or clear that actors Alias so that another actor with the same script can fill the empty place. Actor has script that when a certain thing event triggers it it will add the actor to a quest Alias if the quest alias is cleared the next actor with the same script can just fill that spot when there event is activated. Any Papyrus people (Quest guys) want to show me a quick bit of code. Thank You Link to comment Share on other sites More sharing options...
Surilindur Posted June 24, 2016 Share Posted June 24, 2016 Generally, you would get your answer faster by browsing the Creation Kit wiki Script Objects list for the appropriate scripts: http://www.creationkit.com/fallout4/index.php?title=Category:Script_Objects Check these, they will have what you want:Quest Script - http://www.creationkit.com/fallout4/index.php?title=Quest_ScriptReferenceAlias Script - http://www.creationkit.com/fallout4/index.php?title=ReferenceAlias_ScriptTo clear an alias: rRefAlias.Clear()To fill an empty alias: rRefAlias.ForceRefIfEmpty(rNewRef)And maybe something like this would do, it compiled at least, but has not been tested: Quest Property rQuest Auto ReferenceAlias rRefAlias Function ClearFromAlias() If (rRefAlias) rRefAlias.Clear() rRefAlias = None EndIf EndFunction Function AddToAlias() ClearFromAlias() int i = 10 ; the number of aliases you have While(i > 0) i -= 1 rRefAlias = rQuest.GetAlias(i) as ReferenceAlias If (rRefAlias && rRefAlias.ForceRefIfEmpty(Self)) Debug.MessageBox("Added to Alias: " + i) i = 0 EndIf EndWhile EndFunctionJust an idea. If the functions - and especially casts - do not work, you need to rethink that so that it works with ReferenceAliases properly. There was no function in Quest Script to get a ReferenceAlias out, only Alias, so the cast to Reference Alias is there to make it compile. It wither will or will not work. Your Papyrus log should tell you if it fails to cast it. Link to comment Share on other sites More sharing options...
silhouett Posted June 24, 2016 Author Share Posted June 24, 2016 (edited) Contrathetix Oh and Thank you so very much as this did indeed shed some light on the Reference as an array. I did have a problem with it at first but starting a new game seems to work great. Again Thanks Edited June 24, 2016 by silhouett Link to comment Share on other sites More sharing options...
Surilindur Posted June 25, 2016 Share Posted June 25, 2016 (edited) Umm... okay. No problem. The Aliases (of type "ReferenceAlias" I assumed) have indices, starting from 0, going up, to identify them. Maybe they could be considered a sort of array... if that was what you meant. Also, that way of doing it (counting from 10 down) works in reverse, by filling the last one, then the second last one, etc. The ReferenceAlias variable should keep track of the alias the current actor is in. I assume Self still refers to the object the script runs on. What sort of a problem did you have? Edited June 25, 2016 by Contrathetix Link to comment Share on other sites More sharing options...
silhouett Posted July 5, 2016 Author Share Posted July 5, 2016 this works well now, I was having an issue that some how the reference I was using was not containing the actor but using your array method worked fine. I pre-establish the links in the quest so as each actor is placed in the ref they are linked to the last actor counting down so 9 is linked to 10 and 10 to a terminalthis works fine and I figured out how to removed the reference and maintain the linking however if I move the Terminal to say position 11 and change the links so 11 goes to 10 and 10 to the next actor etc it wont work ??? I am ok with it working with 1 terminal and 9 actors but curious as to why it fails above that number. Link to comment Share on other sites More sharing options...
Surilindur Posted July 5, 2016 Share Posted July 5, 2016 (edited) In the OP you said you have 10 alias slots, so I put this in the code: int i = 10 ; the number of aliases you have While(i > 0) i -= 1 <cycle through aliases and blaablaablaa> EndWhileYou would need to raise the value of i to something higher if you want more aliases. When i = 10, it goes through aliases [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], which is ten. If you add an alias with an ID of 10, the loop will still start at 9, because i = 10 and it is decreased on each loop (including first one). So you could try changing i to the number of aliases you have. Another option would be to use a script command to calculate the number of aliases your quest has, but I dod not find one when I last had a look. I have no idea what you are trying to achieve, so that is all I can comment at the moment. You just asked how to fill a bunch of aliases with a script attached to an actor. Good luck with your project, though. Sounds interesting. :thumbsup: Edit: Another option would be to use a loop like this, because the wiki says GetAlias() will return None of an alias of that ID does not exist (so if you stop when GetAlias returns None, you can cycle it upwards from 0). If that would be more closer to what you originally had in mind. It should work with an arbitrary amount of aliases, and it should count from 0 upwards as you first wanted. Apologies for any confusion, I am just throwing around ideas. However, if that one below fails to end, it will run forever, and you do not want that! So the above example is still safer. Quest Property rQuest Auto ReferenceAlias rRefAlias Function ClearFromAlias() If (rRefAlias) rRefAlias.Clear() rRefAlias = None EndIf EndFunction Function AddToAlias() ClearFromAlias() int i = -1 ; starts from 0, goes upwards bool b = True While (b) i += 1 rRefAlias = rQuest.GetAlias(i) as ReferenceAlias If !(rRefAlias) Debug.MessageBox("Stop! No more reference aliases remain. First empty: " + i) b = False ElseIf (rRefAlias.ForceRefIfEmpty(Self)) Debug.MessageBox("Added to Alias: " + i) b = False EndIf EndWhile EndFunction Edited July 5, 2016 by Contrathetix Link to comment Share on other sites More sharing options...
Recommended Posts