How do I get a transmission to start after enough time has passed?

Started by PR0T05T33L, April 05, 2017, 10:08:21 PM

Previous topic - Next topic

PR0T05T33L

I've put something in a map I'm making that takes a while to become active, but once it does, I want to draw the player's attention to it with a brief discussion between Skars and Lia.

How do I make a transmission start after, for example, 10 minutes and 30 seconds if and only if a specific unit exists?

GoodMorning

This may help:


#DelayedConversation
$Wait:18900 #10m30s
$Unit:-1 #Your target UID here

once
<-Wait Delay
ClearConversation
0 "Lia, something odd is going on..." AddConversationMessage
1 "I'm scanning it, Skars." AddConversationMessage
ShowConversation
PauseGame
endonce
A narrative is a lightly-marked path to another reality.

PR0T05T33L

How do I find the UID of a unit? And does the UID relate to the specific unit or every unit of that type?

GoodMorning

A UID is unique to the specific unit.

CurrentCoords 10 GetAllUnitsInRange 0 do #Fairly close units
->UID
#Something to distinguish the correct unit from others
#Example:
<-UID GetUnitType "PULSECANNON" eq if
<-UID ->Unit
break
endif
loop
A narrative is a lightly-marked path to another reality.

PR0T05T33L

I have no idea how to use that. Am I supposed to put the unit's coordinates in there somewhere?

GoodMorning

Forget the previous code:

#DelayedConversation
$Wait:18900 #10m30s
$UnitX:-1 #Set these to the cooordinates of the unit you want to check on.
$UnitY:-1
once
Self "main" "NONE" SetImage #Invisible
Self CONST_COUNTSFORVICTORY 0 SetUnitAttribute #Don't have to destroy this to win
Self CONST_TAKEMAPSPACE 0 SetUnitAttribute #Don't obstruct placement
Self CONST_NULLIFIERDAMAGES 0 SetUnitAttribute #Don't be accidentally killed
<-Wait Delay
<-UnitX <-UnitY GetUnitAt -1 neq if
ClearConversation
0 "Lia, something odd is going on..." AddConversationMessage
1 "I'm scanning it, Skars." AddConversationMessage
ShowConversation
PauseGame
endif
endonce


This checks if there is a unit at the specified coordinates, and if so, shows the conversation. Attach it to a new Core, set the input vars, and wait.
A narrative is a lightly-marked path to another reality.

PR0T05T33L

Okay, I figured out how to put in the coordinates. Now, how do I set it so it'll only show the message if a spore tower is there?

GoodMorning

The form you see checks if there is a unit there. If the player has destroyed the Spore Tower, it will have dropped a PZ, so this script will find that.

A version which checks the unit type:

#DelayedConversation
$Wait:18900 #10m30s
$UnitX:-1 #Set these to the cooordinates of the unit you want to check on.
$UnitY:-1
$Type:"SPORETOWER"
once
Self "main" "NONE" SetImage #Invisible
Self CONST_COUNTSFORVICTORY 0 SetUnitAttribute #Don't have to destroy this to win
Self CONST_TAKEMAPSPACE 0 SetUnitAttribute #Don't obstruct placement
Self CONST_NULLIFIERDAMAGES 0 SetUnitAttribute #Don't be accidentally killed
<-Wait Delay
<-UnitX <-UnitY GetUnitAt GetUnitType <-Type eq if
ClearConversation
0 "Lia, something odd is going on..." AddConversationMessage
1 "I'm scanning it, Skars." AddConversationMessage
ShowConversation
PauseGame
endif
endonce


This may not be the correct unit type, but the wiki has more information.
http://knucklecracker.com/wiki/doku.php?id=crpl:crplreference
A narrative is a lightly-marked path to another reality.