Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 1,086 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
WED [Need help understanding/creating actions] #441339
05/19/14 22:13
05/19/14 22:13
Joined: Mar 2013
Posts: 18
USA - East Coast
D
DarkProgrammer Offline OP
Newbie
DarkProgrammer  Offline OP
Newbie
D

Joined: Mar 2013
Posts: 18
USA - East Coast
I hope this is the correct forum to post this, if not, I apologize & someone please let me know where this post belongs?

I am new to Gamestudio & Lite-C programming.

Ok so here is what I need help understanding. I'm following along with the online tutorials/Lite-C workshops.

The first point I need help understanding is in

"Workshop 10: Actions"

In that lesson there is a 3D model of a jet plane rotating inside a hangar. now as I understand the model of the jet was placed in the scene using the WED editor. what I don't understand is how the code in the SED is actually causing the model to rotate. This is the code from the editor:

Code:
action rotate_plane()
{
    while (1)
    {
        my.pan = my.pan + 0.1;
        wait (1);
    }
}



The question is how is this linked to the 3D jet model? where is my.pan defined? It doesn't seem to be linked to the 3D model in any way.


My next question has to do with "Workshop 11: Pointers"

There are 2 wizard models in the scene, each assigned to their own actions, in the text of the lesson, it says the actions are assigned in the WED editor, how do I view those actions in WED and also how can I change the names of the actions or create my own new actions?

Any help and advice would be greatly appreciated. so thank you for reading this and offering your advice.

Re: WED [Need help understanding/creating actions] [Re: DarkProgrammer] #441340
05/19/14 22:29
05/19/14 22:29
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
The concept is pretty simple:

You (can) build your level(s) in WED. The "Map Properties" allow you to attach a (single) script to your level, usually your main script. WED will now scan that script automatically for functions called "actions" so they will appear in the action selection on the "Behaviour" tab next to the "Properties" tab which appears on the left side of the vertical toolbar when you click an entity. (This means that you can and have to change your action names there, i.e. in SED/ the script file.)

Your quoted action realizes a framerate dependent rotation around the z-axis because that is what pan does: http://www.conitec.net/beta/aentity-pan.htm
For more information, open (for example) the online manual and search for Engine Objects (and then ENTITY).

my (and you) are pointers that each function (usually only with actions) can use to manipulate certain entities. When you now assign rotate_plane to one or multiple entities in your level, the action will be started on level initialization (immediately after level_load) and the my-pointer will be assigned to each appropriate entity and saved and restored by the function scheduler (or similar) each frame.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: WED [Need help understanding/creating actions] [Re: Superku] #441342
05/19/14 23:40
05/19/14 23:40
Joined: Mar 2013
Posts: 18
USA - East Coast
D
DarkProgrammer Offline OP
Newbie
DarkProgrammer  Offline OP
Newbie
D

Joined: Mar 2013
Posts: 18
USA - East Coast
Superku thanks for your quick reply. in your post you said:

"WED will now scan that script automatically for functions called "actions"..."

Did you mean SED in that sentence?

Thank you again.

Re: WED [Need help understanding/creating actions] [Re: DarkProgrammer] #441343
05/19/14 23:56
05/19/14 23:56
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
No, WED was not a typo.
As I've stated in my post above you can attach actions in WED via the Behavior tab. Somehow WED needs to know what kind of actions you have at your disposal. For that reason WED automatically keeps track of your script files and when you update them and WED will generate a new list of available actions then.

Are you having any problems with that process in particular?


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: WED [Need help understanding/creating actions] [Re: Superku] #441344
05/20/14 00:00
05/20/14 00:00
Joined: Mar 2013
Posts: 18
USA - East Coast
D
DarkProgrammer Offline OP
Newbie
DarkProgrammer  Offline OP
Newbie
D

Joined: Mar 2013
Posts: 18
USA - East Coast
Thank you, so, in other words, I have to define the name of the action in SED. then WED will attach them to the model/object?

Re: WED [Need help understanding/creating actions] [Re: DarkProgrammer] #441345
05/20/14 00:08
05/20/14 00:08
Joined: Mar 2013
Posts: 18
USA - East Coast
D
DarkProgrammer Offline OP
Newbie
DarkProgrammer  Offline OP
Newbie
D

Joined: Mar 2013
Posts: 18
USA - East Coast
So here is a specific example. This is from the Workshop 11 on pointers.

I'm playing around with the code & I want to define my own actions for the wizard models that were created with WED. How do I change the names of the actions that are defined in the script? or define new actions for the models? Those are my specific questions.

I want to rename the actions "wizard_with_pointer()" & "wizard_simple()"


Code:
#include <acknex.h>
#include <default.c>

ENTITY* wizard1;
ENTITY* wizard2;

function move_up()
{
  wizard1.z += 5;
}

function move_down()
{
  wizard1.z -= 5;
}

function main()
{
  level_load ("work11.wmb");
  on_u = move_up;
  on_d = move_down;
}

action wizard_with_pointer()
{
  wizard1 = my;
  my.ambient = 100;
}

action wizard_simple()
{
  wizard2 = my;
  my.ambient = 100;
}


Re: WED [Need help understanding/creating actions] [Re: DarkProgrammer] #441346
05/20/14 00:14
05/20/14 00:14
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I can only guess what your problem is right now, sorry. Please do the following:

1) Create a new level in WED, for instance a large hollowed cube, and save it.
2) Open the folder of the file, create a new text document, call it for example rotategame.c, fill it with the following content, add/ replace the appropriate level name and save it.
Click to reveal..
Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////

void main()
{
	fps_max = 60;
	level_load("your level name here.wmb");
}

action rotate_pan()
{
	while (1)
	{
		my.pan += time_step;
		my.pan %= 360;
		wait (1);
	}
}

action rotate_tilt()
{
	while (1)
	{
		my.tilt += time_step;
		my.tilt %= 360;
		wait (1);
	}
}


3) Go to Map Properties with your newly created level opened, then attach rotategame.c as the main script.
4) Add two entities to the room and attach one of the actions each.
5) Build your level, run the script (and press [0] to move the camera freely), watch the two entities rotate.
6) Now try to add a third action to the script, rotate_roll (that rotates "my" around roll).
7) Add a third entity and attach that new action.
8) Build, run and observe.

Does that clarify your issue/ question? If not, please state the step where things don't seem to work out.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: WED [Need help understanding/creating actions] [Re: Superku] #441347
05/20/14 00:15
05/20/14 00:15
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
How to change an action name? Just edit it, type whatever you want, there are barely any rules or restrictions for action names.
If you have already assigned one or more of those actions in WED you now need to assign the new changed ones again.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: WED [Need help understanding/creating actions] [Re: Superku] #441348
05/20/14 00:59
05/20/14 00:59
Joined: Mar 2013
Posts: 18
USA - East Coast
D
DarkProgrammer Offline OP
Newbie
DarkProgrammer  Offline OP
Newbie
D

Joined: Mar 2013
Posts: 18
USA - East Coast
Originally Posted By: Superku
How to change an action name? Just edit it, type whatever you want, there are barely any rules or restrictions for action names.
If you have already assigned one or more of those actions in WED you now need to assign the new changed ones again.


Sorry to keep asking all these questions....

Where do I edit the action name..,in WED or SED? also when you say assign, again do you mean in SED or WED?


Also, I'm going to try the example you provided, I'll let you know the results.

Thanks so much for taking the time to answer my questions.

Re: WED [Need help understanding/creating actions] [Re: DarkProgrammer] #441373
05/20/14 12:34
05/20/14 12:34
Joined: Mar 2013
Posts: 18
USA - East Coast
D
DarkProgrammer Offline OP
Newbie
DarkProgrammer  Offline OP
Newbie
D

Joined: Mar 2013
Posts: 18
USA - East Coast
Superku, The code worked, thank you very much for the help. You really cleared up the issues for me. Just 1 last thing... the methods my.pan & my.rotate, I assume they are built in functions of entities/models?

Page 1 of 2 1 2

Moderated by  HeelX, rvL_eXile 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1