| Author |
Topic: Same old scripting problem |
| drech |
General Member Since: Aug 25, 2004 Posts: 118 Last: Jul 31, 2005 [view latest posts] |
|
|
|
Category: DOOM III Mapping Posted: Wednesday, Sep. 22, 2004 11:09 pm |
 |
I'm getting really fed up with this, and I still can't understand why it doesn't work. I'm trying to make a rotating door script that is generic, so that it can be used by one of any doors in a map. After following a few tutorials, I've gained a fair understanding of how the scripting works, plus I've dealt with c-based scripting a lot in the past, so I'm pretty sure I'm doing it right..
I've got:
door.script:
void open_door( entity door )
{
door.rotateTo('0 90 0');
}
and a trigger_multiple entity set with
call
open_door(TheDoorIWantToOpen)
where, of course, TheDoorIWantToOpen is replaced by the name of the func_mover entity I want to run the script on. I've also tried it using
call
open_door($TheDoorIWantToOpen)
with the $, but still no luck. I get an error that says that "Trigger 'triggername' at (vector) calls unknown function 'open_door(TheDoorIWantToOpen)'" |
 |
|
|
| Liquefier |
 |
General Member Since: Aug 18, 2004 Posts: 67 Last: Oct 19, 2004 [view latest posts] |
|
|
|
|
| foyleman |
 |
Preferred PLUS Member Since: Nov 7, 2001 Posts: 95762 Last: Apr 13, 2021 [view latest posts] |
|
|
 |
 |
 |
|
|
| drech |
General Member Since: Aug 25, 2004 Posts: 118 Last: Jul 31, 2005 [view latest posts] |
|
|
|
|
|
|
|
| Liquefier |
 |
General Member Since: Aug 18, 2004 Posts: 67 Last: Oct 19, 2004 [view latest posts] |
|
|
|
Category: DOOM III Mapping Posted: Thursday, Sep. 23, 2004 08:03 am |
 |
ok, I'm just going with this here, I dunno how to make it work exactly.
You need to have the trigger that calls the function know the name of what entity you want triggered. Hypothetically, you should be able to give it a new value, under a new name. For Example: script_target = mydoor5
You'd type this into the trigger_relay in the game. OK.
Now, you need to tell the script to look at the entity calling it. In C/C++ you would use the this pointer. I dunno if doom3 has it for scripting. If it does, the syntax would look like this:
$this->script_target.rotateTo("rotation point");
I doubt that it is this simple, but I think it's along the right path.
If you know the address of the entity you want to manipulate, you should be able to use it in expressions. |
|
|
|
| foyleman |
 |
Preferred PLUS Member Since: Nov 7, 2001 Posts: 95762 Last: Apr 13, 2021 [view latest posts] |
|
|
 |
 |
 |
|
|
| Liquefier |
 |
General Member Since: Aug 18, 2004 Posts: 67 Last: Oct 19, 2004 [view latest posts] |
|
|
|
|
| drech |
General Member Since: Aug 25, 2004 Posts: 118 Last: Jul 31, 2005 [view latest posts] |
|
|
|
|
| drech |
General Member Since: Aug 25, 2004 Posts: 118 Last: Jul 31, 2005 [view latest posts] |
|
|
|
Category: DOOM III Mapping Posted: Saturday, Sep. 25, 2004 11:51 pm |
 |
JBAM writes...Quote:
| So if it is saying 'open_door(TheDoorIWantToOpen)', doesn't that suggest that the problem is at the editor end of things? --> ie it is not linking this line to the line in the script. do you need spaces either side like in the script
eg ( TheDoorIWantToOpen )
Maybe you need to specify the entity type in the brackets, and then put the name in that field as you've done...
void open_door( func_mover )
{
door.rotateTo('0 90 0');
}
I DONT CODE, AND I DONT KNOW WHAT I'M TALKING ABOUT WOOT! lol
just wanted to help
EDIT:
Should you have a $ in the script before "door.rotateTo('0 90 0'); "
void open_door( func_mover )
{
$door.rotateTo('0 90 0');
}
|
|
Thanks for your help, but nah, that won't work. You have to have a variable type in the function declaration (in the braces). You see, declaring (entity door) in the function declaration is also declaring a new variable of type entity, named "door," that will be set equal to whatever is put in the braces when that function is called. The new variable (door) can then be used throughout the function.
At least, that's the way I'm used to it working. |
 |
|
|
|
|
mp_TempleCall of Duty: Mods: Multiplayer (624.12Kb)
|