Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 10 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 4
Category: CoD4 Scripting
Scripting and coding with Call of Duty 4.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: What is the relationship of script orgins and AI 's?
Wraith411
General Member
Since: Jan 23, 2012
Posts: 6
Last: Jan 26, 2012
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Tuesday, Jan. 24, 2012 12:06 am
Hi all,

So I am currently learning how to script in CoD4 and I am coming along. This might 4th set of tools I have learned and scripted in so I not a huge newb but very new to the CoD toolset.

I have got AI to spawn when linked to a trigger and some basic scripts like firing script off a trigger and thread and notify basics and such.

My question is why did IW link there enemy actor placments with script origins in blackout? This seems to be fundamental work flow so I would like to know why :).

If I figure it out I will post up the solution.

Cheers,
-W
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Tuesday, Jan. 24, 2012 09:44 pm
script_origins are locators in 3d space, they mark a location for a script. But they can also be used as helper/dummy objects. You can access them like other entities via script and read their properties (key-value-pairs, e.g. script_noteworthy, can be set in Radiant).

A possibility of using script_origins:

There's a trigger at the mountain top, where the player stands. When triggered, you get two origins placed in radiant via script

Code:
start = getent("start_node", "targetname");
end =getent("end_node", "targetname");


start_node is near the trigger, end_node at the bottom of the mountain. You move the player from where he stands to the start location, then to the bottom location.

Code:
org = spawn("script_origin", player.origin); // helper origin
player linkto(org);
org moveto(start.origin, 2);
wait 2;
org moveto(end.origin, 4);
org waittill("movedone");
player unlink();
org delete();


There are also nodes (basically like script_origins), which accept certain key-value-pairs to control AI behaviour etc. I'm not sure if such KVPs work on script_origins the same as script nodes. You may have a look at stock scripts and see what they do.
Share |
Wraith411
General Member
Since: Jan 23, 2012
Posts: 6
Last: Jan 26, 2012
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Wednesday, Jan. 25, 2012 09:48 pm
Thanks for the response, much appreciated :)

A few quick questions on your code.

What does linkto do? Does it take the specified enties and somehow make them aware of each other in some way?

Which leads me to...

"org moveto (start.origin, 2);"

Which seems like it would on entity org call function moveto and gives the location of our defined start.origin and tells it to go there (I am guessing what this last parameter does) at speed 2.

So now with talking it out here a bit more does the linkto (in this case because its a script node) take whatever its linked to and treat as the same entity in script?

So would this code do the same thing as your code without linking?

Code:

org = spawn("script_origin", player.origin); // helper origin
player moveto(start.origin, 2);
wait 2;
player moveto(start.origin, 2);
org waittill("movedone");
org delete();


Thanks again sir.

-W
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Wednesday, Jan. 25, 2012 10:31 pm
linkto links an entity to another. If child is linked to parent and you move parent, parent and child will move together, keeping the relation they had when they were linked. Example:

parent at 2/5
child at 4/5
child linkto parent
move parent to 3/6
parent moves to 3/6, child to 5/6 (parent moved relatively +1/+1, so did the child)

linkto does nothing else then this, AI is not involved.

the moveto parameters are:
point, time, acceleration time, deceleration time (the latter 2 are optional)

See: http://zeroy.com/script/motion/moveto.htm

your script wouldn't work:
- org waittill("movedone"); will wait for org movement, but player was moved
- there's no point in spawning/using org-entitiy in your script
- it's not possible to use moveto on a player, that's why i use the helper origin in my code. moveto works for script_origins and you can link players to them. It's an indirect way of moving a player.
Share |
Wraith411
General Member
Since: Jan 23, 2012
Posts: 6
Last: Jan 26, 2012
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Wednesday, Jan. 25, 2012 10:36 pm
Gotcha. Link seems like Attach in Unreal and Script Origins are like Notes. Thanks again.
-W

edited on Jan. 25, 2012 03:47 pm by Wraith411
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Thursday, Jan. 26, 2012 09:54 pm
Glad to helped you :)

Not sure if it's like attach, there's an attach() function in CoD too which might be more like the Unreal attach - but both do about the same either way ;)
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»