View previous topic :: View next topic |
Author |
Message |
NightmareUSA Forum-Nutzer
Joined: 25 Apr 2004 Posts: 43
Location: New York USA
|
Posted: 25.04.2004, 05:24 Post subject: script help |
|
|
Hi everyone,
I am a noob to scripting and have been having some dificulty with getting them to run. I tried the game edit tutorial for teleporter and I got the spark but teleporter. I also tried the one titled basic scripting but I can't even see my robot. DwnUndr gave me an idea to try single player mode on that one, which I am going to try right now. Any help will be appreciated.
Thanks,
Nightmare of [RIP]
|
|
Back to top |
|
|
Atan Moderator
Joined: 27 Jul 2001 Posts: 876
|
Posted: 25.04.2004, 21:07 Post subject: |
|
|
Nightmare,
Sorry, I have some trouble to understand your question.
Could you please tell me what exactly you want to do, where you stuck?
If you would like to learn the basics,
I would suggest you should build a small 2-3 Room level
and insert a D3 switch object then, not more.
Name that switch as you like.
The player is inserted automaticly by D3Edit.
If you will follow my suggest,
I'll try to show you the first steps in Scripting by using that switch.
Tell me if this small level is ready and you can fly around inside
and see your switch inside.
(LL)Atan
Last edited by Atan on 25.04.2004, 21:49; edited 1 time in total |
|
Back to top |
|
|
Do_Checkor Administrator
Joined: 19 Nov 2000 Posts: 7768
Location: Oldenburg (Oldb.)
|
Posted: 25.04.2004, 21:12 Post subject: |
|
|
...but it would be nice if you would hold the conversation right here, because it may be interesting to others here too.
I have absolutely no clue of teleporters / scripting...
|
|
Back to top |
|
|
NightmareUSA Forum-Nutzer
Joined: 25 Apr 2004 Posts: 43
Location: New York USA
|
Posted: 26.04.2004, 06:32 Post subject: |
|
|
Thanks Atan that would be great! I would like to learn some. I will put a switch in a small level by tomorrow.
I have a print screen image of my script for the teleporter, does it look right? cause I cannot figure out why it won't work.
I hope I attached it right. heheh
Thanks,
Nightmare
|
|
Back to top |
|
|
Atan Moderator
Joined: 27 Jul 2001 Posts: 876
|
Posted: 26.04.2004, 18:52 Post subject: |
|
|
Can't see much detail at this bmp,
but it seems to be right.
But forget the teleporter in the moment, we'll come back to this later.
What I need to know is if you ever had any own script which is working inside your level.
Knowing this will give me an idea where to start.
Again:
Make a 2-3 room level by standard rooms and insert a switch anywhere,
best would be one of type 'Handleswitch'
Name it 'Sound'
Save your level.
Tell me how your testlevel is named ( the mn3 name)
If this way is not fast enough for you,
I must do a tuturial where you can follow all steps at once.
But this would not show where possible errors are done by your side.
|
|
Back to top |
|
|
NightmareUSA Forum-Nutzer
Joined: 25 Apr 2004 Posts: 43
Location: New York USA
|
Posted: 26.04.2004, 21:49 Post subject: |
|
|
Ok I will have one by tonight named "script.mn3".
I am at school right now then I have to go to work but I will be home tonight around 9:30 pm est-usa
|
|
Back to top |
|
|
Atan Moderator
Joined: 27 Jul 2001 Posts: 876
|
Posted: 26.04.2004, 23:14 Post subject: |
|
|
ok, we will have a one day delay, but that doesn't care.
Good things must have time
if your level ist ready, fly inside and look for your handleswitch.
Shooting it will do nothing, this is just to see if your level is ok.
Load your level into the editor, select world view.
Start Dallas
this should work without any problem. (config is ok)
//---------------
->NewScript
Script001: name it PlaySound
Owner: Sound (this is the name of the switch)
Event: Collided (With IT)
if the following condition is met :
Always
then perform following actions:
Play 2D Sound Bell for player object IT Volume 100%
(or which sound you'll like, except any ENV-sound)
Do Nothing
//---------------
ok, this should be your first script now, I hope I made no fault, because i made this one out of mind.
Press 'Save'
Dallas will work until 'done' and produce a file named: script.dll and script.msg (Osiris Folder) if all went well.
If you don't know where this new file went in, use the Windows Search function.
Open Quicktest and insert the two files into your hog now.
Save your level.
Start the level and fly against the switch now. (or shoot)
You should hear the sound.
Tell me if it works, or where you run into trouble now.
This little one must work before we go ahead!
Next time we'll animate the switch.
|
|
Back to top |
|
|
NightmareUSA Forum-Nutzer
Joined: 25 Apr 2004 Posts: 43
Location: New York USA
|
Posted: 28.04.2004, 01:08 Post subject: |
|
|
Nice, it is working now! Thanks for helping me Atan!
OK, everthing is working ready for animation..
|
|
Back to top |
|
|
Atan Moderator
Joined: 27 Jul 2001 Posts: 876
|
Posted: 28.04.2004, 16:38 Post subject: |
|
|
Nice
so we can go ahead with a few steps now, but I strongly suggest:
PLEASE test it one by one, ok?
let's go
--------------------------------------------------------------
Nr. 2:
Animate the switch by collide
//--------
Script001: PlaySound
Owner: Sound
Event: Collided (With IT)
if the following condition is met :
Always
then perform following actions:
Play 2D Sound Bell for player object IT Volume 100%
Play object Sound animation from frame 0 to 20, cycle time = 1.00, looping=FALSE
Do Nothing
--------------------------------------------------------------
Nr. 3:
Insert a condition which limit the trigger-action to player weapon hits.
//--------
Script001: PlaySound
Owner: Sound
Event: Collided (With IT)
if the following condition is met :
(IT is a player weapon)= (TRUE)
then perform following actions:
Play 2D Sound Bell for player object IT Volume 100%
Play object Sound animation from frame 0 to 20, cycle time = 1.00, looping=FALSE
Do Nothing
--------------------------------------------------------------
Nr. 4:
Show a message if switch is activated.
This needs to prepare some things before:
Open Dallas, generate a new message, name it : ShowHitText
Write a text into the Win below ChangeNameID
i.e.: Switch is activated
//--------
Script001: PlaySound
Owner: Sound
Event: Collided (With IT)
if the following condition is met :
(IT is a player weapon)= (TRUE)
then perform following actions:
Play 2D Sound Bell for player object IT Volume 100%
Play object Sound animation from frame 0 to 20, cycle time = 1.00, looping=FALSE
Show HUD message ShowHitText
Do Nothing
--------------------------------------------------------------
Tell me if it's working for you or what problem will come up.
Some more things could follow next days, or is my way to 'teach' too easy for you?
|
|
Back to top |
|
|
NightmareUSA Forum-Nutzer
Joined: 25 Apr 2004 Posts: 43
Location: New York USA
|
Posted: 29.04.2004, 05:12 Post subject: |
|
|
Finished Nr. 3:
Your teaching method is good Atan, the pace is just right. The difficulty level is just right. I have some beginning level programming experience from school [C++], which makes this is very interesting for me.
I do not see this part though
"Play object Sound animation from frame 0 to 20, cycle time = 1.00, looping=FALSE"
I do have the sound working though, just using the 2d sound for player mode.
I have it to the point where it is working with my player shots only and not just from contact. I will try the hud message in the tomorrow afternoon after school, it is late here and I have to go to bed. I will be ready for next lesson tomorrow.
Good news too, I got my teleporter working!
Many Thanks,
NightmareUSA
|
|
Back to top |
|
|
Atan Moderator
Joined: 27 Jul 2001 Posts: 876
|
Posted: 29.04.2004, 16:18 Post subject: |
|
|
I do not see this part though
"Play object Sound animation from frame 0 to 20, cycle time = 1.00, looping=FALSE"
this means it don't work for you?
or don't understand what this means?
|
|
Back to top |
|
|
NightmareUSA Forum-Nutzer
Joined: 25 Apr 2004 Posts: 43
Location: New York USA
|
Posted: 29.04.2004, 20:10 Post subject: |
|
|
my code basicly looks like this:
PlaySound
Owner: Switch1 (Object)
Event: Collided (with IT)
If the following condition is met:
(It is a player weapon) is TRUE
Bool: IT is a player weapon
Object: IT
Operation: is TRUE
Then perforn the following actions:
Play 2D Sound Bell2
PlayerObject: IT
Volume: 100.0%
Show HUD message SwitchActivated
Message: SwitchActivated
Everything is working I just did not see the following as a chioce to use:
"Play object Sound animation from frame 0 to 20, cycle time = 1.00, looping=FALSE"
but it seems to be working fine, so I am ready for more assignments if you are.
NightmareUSA
|
|
Back to top |
|
|
Atan Moderator
Joined: 27 Jul 2001 Posts: 876
|
Posted: 29.04.2004, 22:31 Post subject: |
|
|
Everything is working I just did not see the following as a chioce to use:
"Play object Sound animation from frame 0 to 20, cycle time = 1.00, looping=FALSE"
Sorry, my English is not the best
You'll say that you didn't see why this point was inserted by me?
If:
This should animate the switch if it's hit.
Ok, nevertheless, I hope you see the switch-animation.
Next time we will add some more things.
In the meantime please insert a normal door anywhere in your level and name it MyDoor.
|
|
Back to top |
|
|
NightmareUSA Forum-Nutzer
Joined: 25 Apr 2004 Posts: 43
Location: New York USA
|
Posted: 30.04.2004, 04:56 Post subject: |
|
|
OK I will do that in the morning.
|
|
Back to top |
|
|
NightmareUSA Forum-Nutzer
Joined: 25 Apr 2004 Posts: 43
Location: New York USA
|
Posted: 01.05.2004, 21:51 Post subject: |
|
|
OK I have a level with a door.
|
|
Back to top |
|
|
Atan Moderator
Joined: 27 Jul 2001 Posts: 876
|
Posted: 01.05.2004, 22:41 Post subject: |
|
|
ok, two very easy things are following now:
--------------------------------------------------------------
Nr. 6:
hit the switch should activate a door.
//--------
Script001: PlaySound
Owner: Sound
Event: Collided (With IT)
if the following condition is met :
(IT is a player weapon)= (TRUE)
then perform following actions:
Play 2D Sound Bell for player object IT Volume 100%
Play object Sound animation from frame 0 to 20, cycle time = 1.00, looping=FALSE
Show HUD message ShowHitText
Activate door MyDoor
Do Nothing
--------------------------------------------------------------
Please remove the 'Auto close' Flag for this door in D3Edit (DoorwayBar)
if it is set.
Nr. 7:
hit the switch should open a door.
//--------
Script001: PlaySound
Owner: Sound
Event: Collided (With IT)
if the following condition is met :
(IT is a player weapon)= (TRUE)
then perform following actions:
Play 2D Sound Bell for player object IT Volume 100%
Play object Sound animation from frame 0 to 20, cycle time = 1.00, looping=FALSE
Show HUD message ShowHitText
Set door MyDoor position to 100%
Do Nothing
--------------------------------------------------------------
See the difference between the last two examples?
First should Open/Close the door,
second should Open it only.
Next time we will add a timer to close that door again.
Please tell me how we could prevent opening the door
by direct hit, you know, so it can be opened by the switch only.
Any idea?
hint: we must do something at Event Levelstart
Last edited by Atan on 01.05.2004, 23:54; edited 1 time in total |
|
Back to top |
|
|
NightmareUSA Forum-Nutzer
Joined: 25 Apr 2004 Posts: 43
Location: New York USA
|
Posted: 02.05.2004, 03:09 Post subject: |
|
|
well I understand what the difference should be, but my script did not seem to change the door operation. I put opne switch to open and one switch to close it.
As far as your question goes I believe you would insert another script that would be owned by the level, named LevelStart
myDoor should be assigned to something but nothing I tried with the scripts worked. I did get it to work by locking the door in its properties window in D3Edit.
This is great Atan!
NightmareUSA
|
|
Back to top |
|
|
Atan Moderator
Joined: 27 Jul 2001 Posts: 876
|
Posted: 02.05.2004, 10:35 Post subject: |
|
|
Activate should Open the door which closes automaticly
if.. the Flag 'AutoClose' in DoorwayBar is set for this door.
(Sure we should not use a blastable door her )
Set postion to 100% means that the door should open only.
Flag 'autoClose' must be cleared for this otherwise it will close again with out a new event.
K, we must first see if this will work for you now,
or why it not work as discribed.
BTW, no need for a second switch for now, but let it still inside your level.
Yes you are right, at Levelstart we can set the Door behavior.
Please remove the Lock flag in DoorwayBar.
(This is fine too, but not what we want to do test out )
-----------------------------------------------------
->NewScript (add it to your existing, this was clear, or?)
Script002: name it Start
Owner : Level
Event : Level Start
If the following condition is met
always
Then perform the following actions:
LOCK door MyDoor
Do nothing
-----------------------------------------
This should Lock the door for you by script.
Test it out.
We need this new Script for the next steps, so let it inside.
Last stand should be a door which is locked
and set too 100% (opened but not closing) if you hit the switch.
Can we go ahead?
|
|
Back to top |
|
|
NightmareUSA Forum-Nutzer
Joined: 25 Apr 2004 Posts: 43
Location: New York USA
|
Posted: 03.05.2004, 23:44 Post subject: |
|
|
I will try to get my scipt working tonight in about 4 hours when I get home from work.
Go ahead and continue.
NightmareUSA
|
|
Back to top |
|
|
Atan Moderator
Joined: 27 Jul 2001 Posts: 876
|
Posted: 04.05.2004, 16:52 Post subject: |
|
|
Nr. 9:
Close door by timer event
This needs to prepare some things before:
Open Dallas, -> Open the user type workshop -> Timer Id -> Add new value
name it 'CloseDoor'
New Script003 Name: Close Door
//--------
Script003: Close Door
OWner: Level
Event: Timer(TIMER ID) Went Off
if the following condition is met:
(CloseDoor)=(TIMER ID)
Then perform the following actions:
Set door MyDoor to 0.0%
Do nothing
-------------
Ok, this script will look for the level timer event CloseDoor
and then set the door animation to 0.0 (Close the door)
But before it will work, we must do what?
Right, we must start a level timer first..
we change our well known Script001 like this:
--------------------------------------------------------------
Nr. 10:
hit the switch should open a door.
//--------
Script001: PlaySound
Owner: Sound
Event: Collided (With IT)
if the following condition is met :
(IT is a player weapon)= (TRUE)
then perform following actions:
Play 2D Sound Bell for player object IT Volume 100%
Play object Sound animation from frame 0 to 20, cycle time = 1.00, looping=FALSE
Show HUD message ShowHitText
Set door MyDoor position to 100%
Generate level timer event in 10 seconds using with ID CloseDoor
Do Nothing
--------------------------------------------------------------
Try it out, it should work.
The door opens abd after a 10 secs delay ist will close again.
Works for you?
So, what about multiple hitting the switch with i.e. vauss, laser?
could this be dangerous for our idea?
Hm, what idea?
Ok, goal is shooting the switch, it should open one time,
and close again. Next hits should not open the door again,
...you had your chance to reach a goody
Any idea how to realize that?
Next time we will try that by two different ways.
Last edited by Atan on 05.05.2004, 17:40; edited 1 time in total |
|
Back to top |
|
|
|