Hi all,
I'm new in these forums and I'm probably still considered a newbie when it comes to Unreal Script.
Anyway, I'm working on a game with classmates and we need to figure out some things.
1) We have an enemy that instantly kills the player when it touches them. We think there are two methods but we don't know how to do either. The first we thought of using "event Touch", but we can't find help on how to use it properly. So far we have this:
The above is placed in our EnemyController.uc but when we go up to the enemy, it doesn't kill us.
The second method we though of was making the AI trigger a Kismet event which kills the player. If we recall, there is a way in Kismet to deal lethal damage to the player via triggers.
So far, we can get the player to trigger a kismet event via this:
But we don't know how to change the above code so that it allows an enemy to trigger it.
2) First of all, does anyone here know how we can make a dialogue system? Currently, we are following one made by ShadGratte:
http://www.youtube.com/watch?v=MniOpcfhgwE
We got the code from him and basically, if we followed his instructions, it works. But when we try implementing it to our game, we get this error:
http://img.photobucket.com/albums/v727/jhawks/dia_msg.jpg
We believe it's referring to this code:
From Shad's original code, the only thing we changed in the code above is that instead of DIA_PlayerController (Shad's which extends PlayerController), we replaced it with the above, MyGamePlayerController (ours which extends GamePlayerController).
We don't know another dialogue system and we don't know how to make the above work.
3) We are trying to make an enemy Bot 1 "see" an enemy Bot 2.
We have this so far:
But the above doesn't work and we know because we don't get the message "I see the firefly!!!". We know that "Worldinfo.Game.Broadcast();" works because we used it in other sections of the code to see if functions or events are called.
Sorry for the long post but I didn't want to make 3 separate threads. So in the end, can anyone help us with the 3 above? Any help would be greatly appreciated and if anyone needs more information about something, just ask and we will provide it as much as we can. We really need help with these because these matter a lot in our game.
Thanks for your time.
Regards
Alchoris
I'm new in these forums and I'm probably still considered a newbie when it comes to Unreal Script.
Anyway, I'm working on a game with classmates and we need to figure out some things.
1) We have an enemy that instantly kills the player when it touches them. We think there are two methods but we don't know how to do either. The first we thought of using "event Touch", but we can't find help on how to use it properly. So far we have this:
Code:
event Touch(Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal)
{
local UTPawn HitPawn;
HitPawn = UTPawn(Other);
if(HitPawn != None)
{
if( PlayerController(HitPawn.Controller) != None )
{
HitPawn.TakeDamage( 9999, None, HitPawn.Location, vect(0,0,0) , class'UTDmgType_ShockPrimary');
}
}
}
The above is placed in our EnemyController.uc but when we go up to the enemy, it doesn't kill us.
The second method we though of was making the AI trigger a Kismet event which kills the player. If we recall, there is a way in Kismet to deal lethal damage to the player via triggers.
So far, we can get the player to trigger a kismet event via this:
Code:
PlayerController(Pawn.Controller).ServerCauseEvent('flashlight');
But we don't know how to change the above code so that it allows an enemy to trigger it.
2) First of all, does anyone here know how we can make a dialogue system? Currently, we are following one made by ShadGratte:
http://www.youtube.com/watch?v=MniOpcfhgwE
We got the code from him and basically, if we followed his instructions, it works. But when we try implementing it to our game, we get this error:
http://img.photobucket.com/albums/v727/jhawks/dia_msg.jpg
We believe it's referring to this code:
Code:
/*
-----------------------------------------------------------------------------
D I A L O G U E
-----------------------------------------------------------------------------
Class : SeqAct_DIA_Message
-----------------------------------------------------------------------------
Description : this is the Kimset node used to show
a simple message during a dialogue.
-----------------------------------------------------------------------------
Author : Aloïs "Shad" Deniel
Contact : haloice@homtail.fr
-----------------------------------------------------------------------------
Version : 0.1 (July)
-----------------------------------------------------------------------------
*/
class SeqAct_DIA_Message extends SeqAct_Latent;
var PlayerController Player;
var String Text;
var String SpeakerName;
var CameraActor Camera;
var() bool bDialogueBoxTop;
event bool Update(float DeltaTime)
{
local MyGamePlayerController PC;
if(Player != none)
{
PC = MyGamePlayerController(Player);
if(InputLinks[0].bHasImpulse)
{
PC.UpdateCurrentMessage(SpeakerName,Text,Camera,bDialogueBoxTop);
PC.UpdateCurrentChoices();
}
if(PC.bNextMessage)
{
PC.bNextMessage = false;
ActivateOutputLink(0);
return false;
}
return true;
}
else
{
ActivateOutputLink(0);
return false;
}
}
defaultproperties
{
ObjName="Message"
ObjCategory="Dialogue"
ObjColor=(R=195,G=248,B=66,A=255)
bCallHandler=false
OutputLinks.Empty
OutputLinks(0)=(LinkDesc="Next")
VariableLinks.Empty
VariableLinks(0)=(ExpectedType=class'SeqVar_Object',LinkDesc="Player",bWriteable=true,PropertyName=Player)
VariableLinks(1)=(ExpectedType=class'SeqVar_Object',LinkDesc="Camera",bWriteable=true,PropertyName=Camera)
VariableLinks(2)=(ExpectedType=class'SeqVar_String',LinkDesc="Text",bWriteable=true,PropertyName=Text)
VariableLinks(3)=(ExpectedType=class'SeqVar_String',LinkDesc="Name",bWriteable=true,PropertyName=SpeakerName)
}
From Shad's original code, the only thing we changed in the code above is that instead of DIA_PlayerController (Shad's which extends PlayerController), we replaced it with the above, MyGamePlayerController (ours which extends GamePlayerController).
We don't know another dialogue system and we don't know how to make the above work.
3) We are trying to make an enemy Bot 1 "see" an enemy Bot 2.
We have this so far:
Code:
event SeeMonster(Pawn SeenFirefly)
{
theFirefly = SeenFirefly;
distanceToFirefly = VSize(theFirefly.Location - Pawn.Location);
if (distanceToFirefly < LightPerceptionDistance)
{
Worldinfo.Game.Broadcast(self, "I see the firefly!!!");
GoToState('ChaseFirefly');
}
}
But the above doesn't work and we know because we don't get the message "I see the firefly!!!". We know that "Worldinfo.Game.Broadcast();" works because we used it in other sections of the code to see if functions or events are called.
Sorry for the long post but I didn't want to make 3 separate threads. So in the end, can anyone help us with the 3 above? Any help would be greatly appreciated and if anyone needs more information about something, just ask and we will provide it as much as we can. We really need help with these because these matter a lot in our game.
Thanks for your time.
Regards
Alchoris