Custom message artifact

Started by TheTiconTech, April 05, 2015, 04:19:54 AM

Previous topic - Next topic

TheTiconTech

Hi everyone!
I need some help:

How to set messages to message artifact created via "CreateUnit" command?

I cant just create it in the editor. I need it to be created in proccess via "CreateUnit".

Anyone can help?

planetfall

You can't.

However you can create a CRPL core under the message artifact which detects when it has been collected and then displays the message.


$Message:"0:Hello.;1:Yes?"

<-Artifact CONST_ISDESTROYED GetUnitAttribute if
ClearConversation
<-Message ";" split ->convo
<-convo GetListCount 0 do
<-convo I GetListElement ";" Split ->i
<-i 0 GetListElement
<-i 1 GetListElement "&colon" ":" StringReplace "&semi" ";" StringReplace "&amp" "&" StringReplace
AddConversationMessage
loop
ShowConversation
Self 0 Destroy
endif

:awake
1 OperateWhilePaused
Self CONST_TAKEMAPSPACE 0 SetUnitAttribute
Self CONST_CREATEPZ 0 SetUnitAttribute
Self CONST_NULLIFIERDAMAGES 0 SetUnitAttribute
Self CONST_SUPPORTSDIGITALIS 0 SetUnitAttribute


Then for the script which spawns it:


"MESSAGEARTIFACT" X Y CreateUnit ->art
"CRPLCORE" X Y CreateUnit ->crpl
<-crpl "MessageArtifact.crpl" AddScriptToUnit
<-crpl "MessageArtifact.crpl" "Message" "TypeMessageHere" SetScriptVar
<-crpl "MessageArtifact.crpl" "Artifact" <-art SetScriptVar


For this example the message needs to be formatted like so:

speaker:message;speaker:message;speaker:message

Speaker must be a number, and what each number correlates to is listed here: http://knucklecracker.com/wiki/doku.php?id=crpl:docs:addconversationmessage
However since colons and semicolons separate the values, you cannot include them directly in the message. Instead, you can do &colon and &semi which the script will replace. If for some reason you want your displayed text to include "&colon" or "&semi" you can use &amp to display an ampersand.
Pretty sure I'm supposed to be banned, someone might want to get on that.

Quote from: GoodMorning on December 01, 2016, 05:58:30 PM"Build a ladder to the moon" is simple as a sentence, but actually doing it is not.

TheTiconTech

Well... I dont understand nearly a half of what you're talking about because showing messages is incredibly easy [speaker num, message in quotes], but thanks for pickup detecting idea!

planetfall

The point of this is so that you can have one script for all artifacts, and then whatever script(s) spawn it set the message. If there is only one spawned message artifact, it makes more sense to just hard-code it.
Pretty sure I'm supposed to be banned, someone might want to get on that.

Quote from: GoodMorning on December 01, 2016, 05:58:30 PM"Build a ladder to the moon" is simple as a sentence, but actually doing it is not.